/* ==================== RESET AND BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f1419;
    background-image:
        radial-gradient(at 20% 30%, rgba(255, 107, 53, 0.12) 0px, transparent 50%),
        radial-gradient(at 80% 70%, rgba(52, 211, 153, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(168, 85, 247, 0.05) 0px, transparent 50%);
    min-height: 100vh;
    color: #e5e7eb;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== SCREEN MANAGEMENT ==================== */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== HEADER ==================== */
.app-header {
    text-align: center;
    margin-bottom: 32px;
}

.app-header h1 {
    color: #ffffff;
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-header .subtitle {
    color: #9ca3af;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.back-link {
    display: inline-block;
    color: #9ca3af;
    text-decoration: none;
    padding: 10px 18px;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 107, 53, 0.3);
    color: #ff6b35;
    transform: translateX(-2px);
}

/* ==================== CARDS ==================== */
.card {
    background: rgba(31, 41, 55, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 20px;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.2);
}

h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #f9fafb;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #e5e7eb;
}

p {
    margin-bottom: 12px;
    color: #9ca3af;
}

/* ==================== FEATURE LIST ==================== */
.feature-list {
    list-style: none;
    margin: 24px 0;
}

.feature-list li {
    padding: 10px 0 10px 32px;
    position: relative;
    color: #9ca3af;
    line-height: 1.6;
}

.feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
    font-size: 20px;
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: rgba(107, 114, 128, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(107, 114, 128, 1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.8);
    color: white;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 1);
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
    margin-top: 16px;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.button-group .btn {
    width: 100%;
}

/* ==================== PROGRESS HEADER ==================== */
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

/* ==================== CLOCK DISPLAY ==================== */
.clock-display {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 20px;
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    margin-bottom: 28px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.clock-digital {
    display: flex;
    align-items: center;
}

.digital-time {
    font-size: 96px;
    font-weight: bold;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    color: #f9fafb;
    line-height: 1;
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

.clock-analog {
    display: flex;
    align-items: center;
}

.clock-svg {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.clock-svg circle[fill="white"] {
    fill: #1f2937;
}

.clock-svg line,
.clock-svg circle[fill="#333"] {
    stroke: #f9fafb;
    fill: #f9fafb;
}

.time-period-icon {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 48px;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* ==================== INPUT SECTION ==================== */
.input-section {
    margin-top: 28px;
}

.input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: stretch;
}

.input-display {
    flex: 1;
    background: rgba(15, 20, 25, 0.6);
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 12px;
    padding: 24px;
    min-height: 70px;
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    word-wrap: break-word;
    color: #f9fafb;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease;
}

.input-display:empty::before {
    content: 'Start typing...';
    color: #6b7280;
}

.input-display:focus-within {
    border-color: rgba(255, 107, 53, 0.6);
}

.input-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-controls .btn {
    min-width: 100px;
    padding: 12px 16px;
    white-space: nowrap;
}

/* ==================== LANGUAGE TOGGLE ==================== */
.language-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
    background: rgba(31, 41, 55, 0.4);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.language-toggle button {
    padding: 10px 28px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    color: #9ca3af;
}

.language-toggle button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}

.language-toggle button.active {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* ==================== BUTTON GRIDS ==================== */
.button-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.button-grid.numbers {
    grid-template-columns: repeat(5, 1fr);
}

.button-grid.special-numbers {
    grid-template-columns: repeat(4, 1fr);
}

.button-grid.time-words {
    grid-template-columns: repeat(4, 1fr);
}

.button-grid.special {
    grid-template-columns: repeat(3, 1fr);
}

.input-btn {
    padding: 14px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(31, 41, 55, 0.6);
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    color: #e5e7eb;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.input-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(247, 147, 30, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.input-btn:hover::before {
    opacity: 1;
}

.input-btn:hover {
    border-color: rgba(255, 107, 53, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

.input-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ==================== FEEDBACK SCREEN ==================== */
.feedback-result {
    text-align: center;
    padding: 28px;
    border-radius: 16px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.feedback-result h2 {
    margin: 0;
    font-size: 36px;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.feedback-result.correct {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 2px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.feedback-result.correct::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    animation: pulse 2s infinite;
}

.feedback-result.incorrect {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 2px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.user-answer-display {
    background: rgba(15, 20, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.user-answer-display p {
    margin: 0;
    font-size: 16px;
    color: #9ca3af;
}

.user-answer-display strong {
    color: #f9fafb;
    font-size: 19px;
}

.valid-answers-section {
    background: rgba(15, 20, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.valid-answers-section h3 {
    margin-bottom: 16px;
    color: #e5e7eb;
}

.valid-answers-section ul {
    list-style: none;
    padding: 0;
}

.valid-answers-section li {
    padding: 12px 16px;
    margin: 6px 0;
    background: rgba(31, 41, 55, 0.6);
    border-radius: 8px;
    border-left: 3px solid rgba(156, 163, 175, 0.3);
    font-size: 16px;
    color: #e5e7eb;
    transition: all 0.2s ease;
}

.valid-answers-section li:hover {
    background: rgba(31, 41, 55, 0.8);
    border-left-color: rgba(255, 107, 53, 0.5);
}

.valid-answers-section li.user-matched {
    background: rgba(16, 185, 129, 0.15);
    border-left-color: #10b981;
    font-weight: 600;
    color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.clock-reference {
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 24px;
}

.clock-reference p {
    margin: 0;
    font-size: 14px;
    color: #9ca3af;
}

.clock-reference strong {
    font-size: 18px;
    color: #f9fafb;
}

.hint {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-top: 12px;
}

.hint span {
    font-weight: bold;
    color: #ff6b35;
}

/* ==================== RESULTS SCREEN ==================== */
.results-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.result-stat {
    text-align: center;
    padding: 28px 20px;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.result-stat:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 107, 53, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.result-stat .stat-label {
    font-size: 14px;
    color: #9ca3af;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.result-stat .stat-value {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== MOBILE RESPONSIVENESS ==================== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 20px;
    }

    .app-header h1 {
        font-size: 28px;
    }

    .clock-display {
        padding: 16px 12px;
    }

    .digital-time {
        font-size: 64px;
    }

    .time-period-icon {
        font-size: 36px;
        right: 16px;
    }

    .input-row {
        flex-direction: column;
    }

    .input-display {
        font-size: 20px;
        padding: 16px;
        min-height: 50px;
    }

    .input-controls {
        flex-direction: row;
    }

    .input-controls .btn {
        flex: 1;
    }

    .button-grid.numbers,
    .button-grid.time-words {
        grid-template-columns: repeat(3, 1fr);
    }

    .button-grid.special-numbers {
        grid-template-columns: repeat(3, 1fr);
    }

    .button-grid.special {
        grid-template-columns: repeat(2, 1fr);
    }

    .input-btn {
        padding: 10px;
        font-size: 14px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }

    .results-summary {
        grid-template-columns: 1fr;
    }

    .feedback-result h2 {
        font-size: 24px;
    }
}

/* ==================== TOUCH ENHANCEMENTS ==================== */
@media (hover: none) {
    .btn:hover,
    .input-btn:hover {
        transform: none;
    }

    .btn:active,
    .input-btn:active {
        transform: scale(0.95);
    }
}
