:root {
    --ink: #171714;
    --muted: #716d65;
    --line: #dedbd3;
    --paper: #f3f0e9;
    --soft: #efede7;
    --ok: #eef4ea;
    --miss: #f7f3e9
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, sans-serif
}

button,
textarea {
    font: inherit
}

button {
    cursor: pointer
}

.page {
    width: min(1220px, calc(100% - 32px));
    margin: auto;
    padding: 40px 0 80px
}

.hero,
.panel-head,
.results-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start
}

.hero {
    margin-bottom: 26px
}

.kicker {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    color: var(--muted);
    margin-bottom: 8px
}

h1,
h2 {
    font-family: Georgia, serif;
    font-weight: 500;
    letter-spacing: -.03em;
    margin: 0 0 8px
}

h1 {
    font-size: clamp(44px, 6vw, 72px)
}

h2 {
    font-size: clamp(28px, 3vw, 40px)
}

h3 {
    font-size: 17px
}

.hero p,
#summary,
#challengePrompt {
    color: var(--muted);
    line-height: 1.55
}

.hero p {
    max-width: 700px;
    font-size: 18px
}

.pill {
    white-space: nowrap;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 800
}

.panel {
    background: rgba(255, 255, 255, .88);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(32, 28, 22, .09)
}

.picker {
    padding: 22px;
    margin-bottom: 24px
}

.panel-head {
    align-items: center;
    margin-bottom: 14px
}

.round {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: white;
    font-size: 28px
}

.carousel {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    scroll-snap-type: x mandatory
}

.card {
    flex: 0 0 180px;
    padding: 8px 8px 12px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: white;
    box-shadow: 0 7px 18px rgba(20, 18, 14, .08);
    scroll-snap-align: center;
    text-align: left
}

.card.selected {
    border-color: var(--ink)
}

.card img {
    width: 100%;
    aspect-ratio: 1.18/1;
    object-fit: cover;
    border-radius: 10px;
    display: block
}

.card span {
    display: block;
    padding: 9px 4px 0;
    font-family: Georgia, serif
}

.play {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    gap: 28px;
    padding: 26px;
    margin-bottom: 24px
}

.photo-wrap {
    padding: 14px 14px 46px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(20, 18, 14, .16);
    transform: rotate(-.35deg);
    align-self: start
}

.photo-wrap img {
    width: 100%;
    display: block;
    border-radius: 4px
}

.challenge {
    padding: 8px 4px
}

.timer-box {
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--soft);
    padding: 16px;
    border-radius: 18px;
    margin: 20px 0
}

.timer-box>div:last-child {
    display: grid;
    gap: 4px
}

.timer-box span {
    font-size: 14px;
    color: var(--muted)
}

.clock {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: white;
    font: 700 34px Georgia, serif
}

.clock.warning {
    animation: pulse .8s infinite alternate
}

@keyframes pulse {
    to {
        transform: scale(1.1)
    }
}

.primary,
.secondary {
    min-height: 50px;
    border-radius: 999px;
    padding: 0 20px;
    font-weight: 800
}

.primary {
    background: var(--ink);
    color: white;
    border: 1px solid var(--ink)
}

.secondary {
    background: white;
    color: var(--ink);
    border: 1px solid var(--line)
}

#startBtn,
#stopBtn {
    width: 100%
}

.primary:disabled {
    opacity: .35
}

.heard {
    border-top: 1px solid var(--line);
    margin-top: 18px;
    padding-top: 18px;
    min-height: 100px
}

.heard small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    letter-spacing: .1em;
    margin-bottom: 8px
}

.heard div {
    line-height: 1.6;
    color: #5f5b54
}

.fallback {
    margin-top: 14px
}

.fallback textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 8px
}

.results {
    padding: 26px
}

.score {
    width: 110px;
    height: 110px;
    flex: 0 0 110px;
    border: 8px solid var(--ink);
    border-radius: 50%;
    display: grid;
    place-content: center;
    text-align: center
}

.score strong {
    font-size: 25px
}

.score span {
    font-size: 12px;
    color: var(--muted)
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 24px 0
}

.stats>div {
    background: var(--soft);
    padding: 17px;
    border-radius: 16px
}

.stats strong {
    display: block;
    font-size: 25px
}

.stats span {
    font-size: 13px;
    color: var(--muted)
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px
}

.object-grid {
    display: grid;
    gap: 8px
}

.object {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 10px;
    padding: 12px;
    border-radius: 13px
}

.object.found {
    background: var(--ok)
}

.object.missed {
    background: var(--miss)
}

.object b {
    font-size: 20px
}

.object strong {
    display: block;
    font-size: 14px
}

.object span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
    margin-top: 2px
}

.empty {
    padding: 14px;
    background: var(--soft);
    border-radius: 12px;
    color: var(--muted)
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 24px
}

@media(max-width:850px) {
    .page {
        width: min(100% - 20px, 760px);
        padding-top: 22px
    }

    .play {
        grid-template-columns: 1fr;
        padding: 16px
    }

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

    .hero p {
        font-size: 16px
    }
}

@media(max-width:580px) {

    .hero,
    .results-head {
        display: block
    }

    .pill {
        display: inline-block
    }

    .picker,
    .results {
        padding: 16px;
        border-radius: 18px
    }

    .card {
        flex-basis: 150px
    }

    .photo-wrap {
        padding: 9px 9px 34px
    }

    .score {
        margin-top: 18px
    }

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

    .actions {
        display: grid
    }
}
.heard {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.heard small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .1em;
  margin-bottom: 8px;
}

#transcript {
  min-height: 78px;
  max-height: 130px;
  overflow-y: auto;
  line-height: 1.6;
  color: #5f5b54;
  white-space: pre-wrap;
}

#transcript.is-complete {
  max-height: none;
  overflow: visible;
  padding: 14px 16px;
  background: var(--soft);
  border-radius: 14px;
  color: var(--ink);
}

/* =========================================================
   Polaroid top actions
   ========================================================= */

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.close-link:hover {
    background: var(--soft);
}

/* =========================================================
   Practice Language selector
   ========================================================= */

.language-control {
    display: inline-flex;
    align-items: center;
}

.language-control select {
    min-height: 42px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.language-control select:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hidden on larger screens. Mobile shows this while the challenge runs. */
.mobile-clock {
    display: none;
}

@media(max-width:580px) {
    .hero-actions {
        margin-top: 14px;
        justify-content: space-between;
    }

    .mobile-clock {
        position: fixed;
        top: max(12px, env(safe-area-inset-top));
        right: 12px;
        z-index: 1000;
        width: 58px;
        height: 58px;
        border: 3px solid var(--ink);
        border-radius: 50%;
        background: rgba(255,255,255,.96);
        box-shadow: 0 8px 24px rgba(20,18,14,.18);
        place-items: center;
        font: 700 26px Georgia, serif;
        pointer-events: none;
    }

    .mobile-clock.is-visible {
        display: grid;
    }

    .mobile-clock.warning {
        animation: pulse .8s infinite alternate;
    }
}
