* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: #17211d;
    background: #f7f3eb;
    line-height: 1.55
}

button,
textarea {
    font: inherit
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 6%;
    background: #fff;
    border-bottom: 1px solid rgba(23, 33, 29, .12);
    position: sticky;
    top: 0;
    z-index: 20
}

.brand-logo {
    height: 54px;
    width: auto;
    display: block
}

.top-nav {
    display: flex;
    gap: 24px;
    flex-wrap: wrap
}

.top-nav a {
    color: #17211d;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px
}

.quiz-page {
    width: min(1320px, 88%);
    margin: 56px auto 90px
}

.hidden {
    display: none !important
}

.eyebrow,
.mode-label,
.question-type,
.model-label {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6f3fd6
}

.mode-screen>h1,
.result-screen>h1 {
    margin: 18px 0 54px;
    font-size: clamp(54px, 7vw, 108px);
    line-height: .94;
    letter-spacing: -.055em
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px
}

.mode-card {
    min-height: 330px;
    padding: 48px;
    border: 1px solid #17211d;
    background: #fff;
    color: #17211d;
    text-align: left;
    cursor: pointer
}

.mode-card strong {
    display: block;
    margin: 32px 0 14px;
    font-size: clamp(30px, 3vw, 48px);
    line-height: 1.05
}

.mode-card p {
    max-width: 550px;
    margin: 0;
    font-size: 18px
}

.progress-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(23, 33, 29, .08);
    overflow: hidden
}

.progress-fill {
    width: 0;
    height: 100%;
    background: #6f3fd6;
    transition: width .25s ease
}

.question-nav,
.result-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 26px 0 32px
}

.question-nav-btn,
.result-nav-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer
}

.question-nav-btn {
    border: 1px solid #c9c4ba;
    background: #fff;
    color: #17211d
}

.question-nav-btn.answered {
    background: #eee7fb;
    border-color: #6f3fd6
}

.question-nav-btn.current {
    background: #17211d;
    border-color: #17211d;
    color: #fff
}

.question-card {
    padding: clamp(30px, 5vw, 68px);
    border: 1px solid rgba(23, 33, 29, .18);
    border-radius: 24px;
    background: #fff
}

.question-number {
    margin: 0 0 12px;
    font-weight: 700;
    color: #737a76
}

.question-type {
    margin-bottom: 26px
}

.question-card h2 {
    max-width: 1100px;
    margin: 0 0 42px;
    font-size: clamp(30px, 3.4vw, 52px);
    line-height: 1.25;
    letter-spacing: -.025em
}

.answer-list {
    display: grid;
    gap: 14px
}

.answer-option {
    width: 100%;
    padding: 20px 26px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: #f4efe5;
    color: #17211d;
    text-align: left;
    font-size: 18px;
    cursor: pointer
}

.answer-option.selected {
    border-color: #6f3fd6;
    background: #eee7fb
}

.answer-option.correct {
    border-color: #3f9b59;
    background: #e8f6eb
}

.answer-option.wrong {
    border-color: #d95858;
    background: #fde9e9
}

.written-area label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase
}

#written-response {
    width: 100%;
    min-height: 150px;
    padding: 18px 20px;
    border: 1px solid #cfc9be;
    border-radius: 16px;
    background: #fcfaf6;
    color: #17211d;
    resize: vertical;
    font-size: 17px
}

.word-bank-inline {
    margin-top: 26px;
    padding: 20px;
    border: 1px solid rgba(111, 63, 214, .22);
    border-radius: 14px;
    background: #f7f3ff
}

.word-bank-inline strong {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase
}

.word-bank-inline span {
    display: inline-block;
    margin: 4px 6px 4px 0;
    padding: 6px 10px;
    border: 1px solid rgba(111, 63, 214, .18);
    border-radius: 999px;
    background: #fff;
    font-size: 14px
}

.practice-feedback {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f3eefc;
    font-weight: 800
}

.model-answer-box {
    margin-top: 18px;
    padding: 20px;
    border-left: 5px solid #6f3fd6;
    background: #f7f3ff
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 28px
}

.primary-btn,
.secondary-btn,
.result-filter {
    min-height: 48px;
    padding: 13px 20px;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer
}

.primary-btn {
    border: 1px solid #17211d;
    background: #17211d;
    color: #fff
}

.secondary-btn,
.result-filter {
    border: 1px solid #17211d;
    background: transparent;
    color: #17211d
}

.secondary-btn:disabled {
    opacity: .35;
    cursor: not-allowed
}

.score-box {
    display: flex;
    align-items: baseline;
    gap: 28px;
    margin-bottom: 20px
}

#score-number {
    font-size: clamp(64px, 8vw, 118px);
    line-height: 1;
    letter-spacing: -.055em
}

#score-percent {
    font-size: clamp(28px, 3vw, 46px);
    font-weight: 800
}

.result-note {
    max-width: 900px;
    font-size: 18px
}

.result-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 38px 0 24px
}

.result-summary-item {
    padding: 14px 18px;
    border: 1px solid #d5d0c7;
    background: #fff;
    font-weight: 800
}

.result-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px
}

.result-filter.active {
    background: #17211d;
    color: #fff
}

.result-nav {
    margin-top: 0
}

.result-nav-btn.correct {
    border: 2px solid #3f9b59;
    background: #e6f5ea
}

.result-nav-btn.incorrect {
    border: 2px solid #d95858;
    background: #fde9e9
}

.result-nav-btn.written {
    border: 2px solid #6f3fd6;
    background: #eee7fb
}

.result-list {
    display: grid;
    gap: 18px
}

.result-item {
    scroll-margin-top: 110px;
    padding: 28px 30px;
    border: 1px solid #d8d2c8;
    background: #fff
}

.result-item.correct {
    border-left: 7px solid #3f9b59;
    background: #f2faf4
}

.result-item.incorrect {
    border-left: 7px solid #d95858;
    background: #fff3f3
}

.result-item.written {
    border-left: 7px solid #6f3fd6;
    background: #f8f5fd
}

.result-status {
    display: inline-block;
    margin-bottom: 14px;
    font-weight: 800
}

.result-status.correct {
    color: #2c7d42
}

.result-status.incorrect {
    color: #b63e3e
}

.result-status.written {
    color: #6f3fd6
}

.retry-btn {
    margin-top: 34px
}

@media(max-width:800px) {
    .site-header {
        align-items: flex-start;
        gap: 16px;
        flex-direction: column
    }

    .quiz-page {
        width: 92%;
        margin-top: 34px
    }

    .mode-grid {
        grid-template-columns: 1fr
    }

    .mode-card {
        min-height: 0;
        padding: 30px
    }

    .question-card {
        padding: 28px 22px
    }

    .question-card h2 {
        font-size: 30px
    }

    .quiz-controls {
        align-items: stretch;
        flex-direction: column
    }

    .quiz-controls button {
        width: 100%
    }

    .score-box {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px
    }
}

/* Quiz mode cards: hover animation */

.mode-card {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.mode-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 32px rgba(40, 30, 70, 0.12);
  border-color: #6f3fd6;
}

.mode-card:active {
  transform: translateY(-3px);
}

/* Keyboard accessibility */
.mode-card:focus-visible {
  outline: 3px solid #6f3fd6;
  outline-offset: 4px;
}

/* Reduce motion when requested */
@media (prefers-reduced-motion: reduce) {
  .mode-card {
    transition: none;
  }

  .mode-card:hover,
  .mode-card:active {
    transform: none;
  }
}