:root {
    --error-color: #e53935;
}

.app-container {
    width: 95%;
    max-width: 900px;
    height: 90vh;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 30px;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Экран 1 */
h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.instruction {
    font-size: 1.1rem;
    text-align: center;
    max-width: 600px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.5);
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    max-width: 600px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.setting-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.gap-10 {
    gap: 10px;
}

.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(70, 114, 48, 0.3);
}

.btn.outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.btn.outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn.small {
    padding: 8px 16px;
    font-size: 1rem;
    border-radius: 8px;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn:active {
    transform: scale(0.98);
}

/* Экран 2: Игра */
.game-header {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.7);
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--error-color);
    font-variant-numeric: tabular-nums;
}

.target-indicator {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.tables-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: #555;
}

.grid-wrapper {
    display: grid;
    gap: 5px;
    background: #ccc;
    border: 2px solid #ccc;
    user-select: none;
}

/* Размеры сетки */
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-7 { grid-template-columns: repeat(7, 1fr); }

.schulte-cell {
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s ease, opacity 0.2s ease;
    /* Адаптивный размер: таблица всегда помещается на экран */
    width: 16vmin;
    height: 16vmin;
    max-width: 80px;
    max-height: 80px;
}

/* На маленьких сетках можно чуть крупнее */
.grid-3 .schulte-cell {
    width: 22vmin;
    height: 22vmin;
    max-width: 120px;
    max-height: 120px;
    font-size: 2.5rem;
}

/* На большой сетке чуть мельче */
.grid-7 .schulte-cell {
    width: 12vmin;
    height: 12vmin;
    max-width: 60px;
    max-height: 60px;
    font-size: 1.5rem;
}


.schulte-cell.found {
    opacity: 0.2;
    cursor: default;
}

.schulte-cell.error {
    background: var(--error-color) !important;
    color: white;
}

.schulte-cell.honest-mode {
    cursor: default;
}

/* Экран 3: Результаты */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
    width: 100%;
    max-width: 600px;
}

.stat-box {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.history-container {
    margin-top: 30px;
    width: 100%;
    max-width: 600px;
    max-height: 250px;
    overflow-y: auto;
}

.history-container h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.5);
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.9rem;
}

.history-table th, .history-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.history-table th {
    background: rgba(0,0,0,0.05);
    font-weight: 600;
}
