:root {
  --ink: #16222e; --teal: #0e6e66; --amber: #c77414; --paper: #faf8f3;
  --line: #d8d2c6; --grey: #7f7f7f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, 'PingFang SC', 'Hiragino Sans GB',
       'Microsoft YaHei', 'Helvetica Neue', sans-serif;
       color: var(--ink); }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; align-items: center; justify-content: center; }
.screen.paper { background: var(--paper); padding: 20px; }
/* Trial + response chrome is strictly mid-grey: adaptation state must not
   shift between clips and the response prompt. */
.screen.grey { background: var(--grey); }

.card { max-width: 550px; width: 100%; }
h1 { font-size: 28px; margin: 0 0 14px; font-weight: 600; }
p, li { font-size: 16px; line-height: 1.6; }
ol { padding-left: 22px; } li { margin-bottom: 8px; }
.dim { color: #6c7078; font-size: 18px; }
.err { color: #a03232; font-size: 13px; min-height: 18px; }

label { display: block; font-size: 14px; margin: 14px 0 4px; }
input { width: 100%; font-size: 17px; padding: 10px 12px; margin-top: 6px;
        border: 1.5px solid var(--line); border-radius: 6px;
        background: white; font-family: inherit; }
input:focus { outline: none; border-color: var(--teal); }
input::placeholder { color: #b0b0b0; }

button { font-family: inherit; cursor: pointer;
         border-radius: 8px; border: none; }
button.primary { width: 100%; margin-top: 22px; padding: 14px;
                 font-size: 16px; background: var(--teal); color: white; }
button.primary:active { filter: brightness(0.9); }
button.secondary { width: 100%; margin-top: 12px; padding: 12px;
                   font-size: 14px; background: transparent;
                   color: var(--ink); border: 1.5px solid var(--line); }

/* language toggle — sits top-right of the start-screen title */
.title-row { display: flex; align-items: flex-start;
             justify-content: space-between; }
.title-row h1 { flex: 1; margin-right: 8px; }
#btn-lang {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 50%;
}
#btn-lang:active { color: var(--teal); border-color: var(--teal); }
#btn-lang svg { display: block; }

/* -------------- fullscreen mobile media -------------- */
#screen-trial video, #screen-trial img {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  display: none;
  background: var(--grey);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  /* On desktop: contain to avoid cropping.
     On mobile (narrow): cover fills edge-to-edge. */
  object-fit: contain;
}
/* Phones in portrait — fill width, may crop top/bottom */
@media (max-width: 768px) {
  #screen-trial video, #screen-trial img { object-fit: cover; }
}
/* Phones in landscape — fill height, may crop sides */
@media (max-height: 500px) {
  #screen-trial video, #screen-trial img { object-fit: cover; }
}

#interval-tag { position: fixed; top: max(12px, env(safe-area-inset-top));
                left: 0; right: 0; text-align: center; color: #ffffff99;
                font-size: 13px; letter-spacing: 0.12em; z-index: 10;
                display: none; }
#loading { color: #ffffff99; font-size: 14px; }
/* "提交中" overlay shown during the respond POST round-trip */
#submitting { position: fixed; inset: 0; display: none; align-items: center;
              justify-content: center; background: rgba(22, 34, 46, 0.55);
              color: #ffffff; font-size: 18px; letter-spacing: 0.08em;
              z-index: 20; }
#media-fail { display: none; max-width: 480px; padding: 18px 22px;
              background: #16222ef0; color: #f2c9c9; border-radius: 8px;
              font-size: 13px; line-height: 1.6; }
#media-fail b { color: #ffffff; }

/* response screen */
.respond-box { width: 100%; max-width: 420px; padding: 24px;
               text-align: center; }
.q { color: white; font-size: 20px; margin-bottom: 22px; }
.row { display: flex; gap: 14px; }
button.choice { flex: 1; padding: 20px 0; font-size: 18px;
                background: #ffffffe8; color: var(--ink); }
button.choice:active { background: #ffffffc0; }
button.ghost { margin-top: 18px; padding: 10px 26px; font-size: 14px;
               background: transparent; color: #ffffffcc;
               border: 1.5px solid #ffffff88; }
button.ghost:disabled { opacity: 0.35; }

/* progress bar */
.progress-wrap { margin-top: 24px; width: 100%; }
.progress-bar { width: 100%; height: 5px; background: #ffffff22;
                border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: #ffffff99;
                 border-radius: 3px; transition: width 0.4s; }
.progress-text { margin-top: 6px; color: #ffffff88; font-size: 12px;
                 text-align: center; }
.practice-hint { display: none; margin: 0 auto 14px; padding: 4px 14px;
                 border-radius: 999px; background: var(--amber);
                 color: #fff; font-size: 13px; width: fit-content; }
