@font-face {
  font-family: "JuxuSerif";
  src: url("./final/assets/NotoSerifSC.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: "JuxuSans";
  src: url("./final/assets/NotoSansSC.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --forest: #102a24;
  --forest-light: #21483d;
  --paper: #eee9dd;
  --paper-deep: #ddd5c4;
  --ink: #17241f;
  --ink-soft: #52605a;
  --cream: #f8f3e7;
  --vermilion: #a33b2c;
  --gold: #d4b461;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--forest);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--cream);
  background: var(--forest);
  font-family: "JuxuSans", "Noto Sans CJK TC", sans-serif;
}

button,
a,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.prototype {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) auto minmax(230px, 0.76fr);
  gap: clamp(24px, 3vw, 52px);
  align-items: center;
  width: min(100%, 1440px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 24px 30px;
}

.brief {
  width: min(100%, 330px);
}

.brief--right {
  justify-self: end;
}

.brief__logo {
  width: 190px;
  height: auto;
}

.brief h2 {
  max-width: 340px;
  margin: 52px 0 0;
  font-family: "JuxuSerif", serif;
  font-size: clamp(32px, 3vw, 46px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.brief--right h2 {
  margin-top: 0;
}

.brief__lead {
  margin: 22px 0 0;
  font-size: 16px;
  line-height: 1.72;
  color: rgba(248, 243, 231, 0.76);
}

.brief__steps {
  display: grid;
  gap: 22px;
  padding: 0;
  margin: 44px 0 0;
  list-style: none;
  counter-reset: steps;
}

.brief__steps li {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 42px;
  padding-left: 48px;
  counter-increment: steps;
}

.brief__steps li::before {
  position: absolute;
  top: -4px;
  left: 0;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  content: counter(steps);
  color: var(--cream);
  background: var(--vermilion);
  font-family: "JuxuSerif", serif;
  font-size: 16px;
  font-weight: 800;
}

.brief__steps strong {
  font-size: 15px;
  line-height: 1.45;
}

.brief__steps span {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(248, 243, 231, 0.58);
}

.brief__foot {
  padding-top: 24px;
  margin: 32px 0 0;
  color: rgba(248, 243, 231, 0.52);
  font-size: 13px;
  line-height: 1.65;
  background: var(--forest);
}

.player {
  justify-self: center;
}

.stage {
  position: relative;
  height: min(calc(100svh - 48px), 960px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #d9d1c2;
}

.stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #d9d1c2;
}

.hud {
  position: absolute;
  top: 18px;
  right: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud img {
  width: 118px;
  height: auto;
}

.hud span {
  padding: 8px 10px;
  color: var(--cream);
  background: rgba(13, 38, 31, 0.9);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 37, 30, 0.84);
}

.hook__card,
.answer__card,
.ending__card {
  width: 100%;
  padding: clamp(20px, 4.5vw, 30px);
  color: var(--ink);
  background: var(--paper);
}

.hook__card h1 {
  max-width: 430px;
  margin: 0;
  font-family: "JuxuSerif", serif;
  font-size: clamp(36px, 4.2vw, 52px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.hook__card > p:not(.hook__note) {
  margin: 16px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.choices button {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  min-height: 82px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  background: var(--paper-deep);
  border: 0;
  transition: background 180ms ease, transform 140ms var(--ease-out);
}

.choices button > span {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  color: var(--cream);
  background: var(--vermilion);
  font-family: "JuxuSerif", serif;
  font-size: 19px;
  font-weight: 800;
}

.choices button strong {
  align-self: end;
  padding: 14px 12px 2px 0;
  font-size: 16px;
  line-height: 1.4;
}

.choices button small {
  align-self: start;
  padding: 2px 12px 14px 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.choices button:hover {
  background: #d3c9b6;
}

.choices button:active {
  transform: scale(0.985);
}

.hook__note {
  margin: 18px 0 0;
  color: var(--vermilion);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.hook.is-leaving {
  animation: leave 320ms ease forwards;
}

.answer__card strong {
  display: block;
  font-family: "JuxuSerif", serif;
  font-size: clamp(28px, 3.5vw, 40px);
  line-height: 1.2;
  color: var(--vermilion);
}

.answer__card p {
  margin: 16px 0 0;
  font-size: 17px;
  line-height: 1.7;
}

.answer__card > span {
  display: block;
  margin-top: 22px;
  padding-top: 16px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
  background: var(--paper);
}

.answer:not([hidden]) .answer__card {
  animation: card-in 540ms var(--ease-expo) both;
}

.ending {
  background: rgba(11, 33, 27, 0.9);
}

.ending__card {
  color: var(--cream);
  background: var(--forest);
}

.ending__card h2 {
  margin: 0;
  font-family: "JuxuSerif", serif;
  font-size: clamp(36px, 4.2vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.ending__card p {
  margin: 22px 0 0;
  font-size: 16px;
  line-height: 1.7;
  color: rgba(248, 243, 231, 0.72);
}

.ending__actions {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.ending__actions a,
.ending__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 16px;
  color: var(--forest);
  text-decoration: none;
  cursor: pointer;
  background: var(--gold);
  border: 0;
  font-size: 15px;
  font-weight: 800;
}

.ending__actions button {
  color: var(--cream);
  background: var(--forest-light);
}

.player__controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 11px;
  background: rgba(12, 32, 26, 0.9);
}

.control-button {
  min-width: 50px;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--cream);
  background: var(--vermilion);
  border: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}

.time {
  min-width: 82px;
  color: var(--cream);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chapter-preview {
  display: grid;
  gap: 18px;
  margin-top: 34px;
}

.chapter-preview article {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 14px;
  align-items: center;
}

.chapter-preview img {
  width: 132px;
  height: 150px;
  object-fit: cover;
  filter: saturate(0.82) contrast(0.96);
}

.chapter-preview strong {
  display: block;
  font-family: "JuxuSerif", serif;
  font-size: 18px;
  line-height: 1.4;
}

.chapter-preview p {
  margin: 5px 0 0;
  color: rgba(248, 243, 231, 0.58);
  font-size: 13px;
  line-height: 1.55;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes leave {
  to {
    opacity: 0;
  }
}

@media (max-width: 1120px) {
  .prototype {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 18px;
  }

  .brief {
    display: none;
  }

  .stage {
    height: min(calc(100svh - 36px), 1000px);
  }
}

@media (max-width: 700px) {
  .prototype {
    display: block;
    padding: 0;
  }

  .player {
    width: 100%;
  }

  .stage {
    width: 100vw;
    height: 100svh;
    aspect-ratio: auto;
  }

  .hud {
    top: 14px;
    right: 14px;
    left: 14px;
  }

  .hud img {
    width: 108px;
  }

  .hud span {
    font-size: 13px;
  }

  .overlay {
    padding: 14px;
  }

  .hook__card,
  .answer__card,
  .ending__card {
    padding: 20px 18px;
  }

  .hook__card h1 {
    font-size: clamp(31px, 9vw, 39px);
  }

  .hook__card > p:not(.hook__note) {
    margin-top: 12px;
    font-size: 18px;
  }

  .choices {
    gap: 9px;
    margin-top: 18px;
  }

  .choices button {
    min-height: 78px;
  }

  .hook__note {
    margin-top: 14px;
    font-size: 13px;
  }

  .player__controls {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .js .brief__logo {
    opacity: 0;
    animation: side-in 620ms var(--ease-out) 80ms forwards;
  }

  .js .brief h2 {
    opacity: 0;
    animation: side-in 680ms var(--ease-expo) 140ms forwards;
  }

  .js .brief__lead {
    opacity: 0;
    animation: side-in 640ms var(--ease-out) 220ms forwards;
  }

  .js .brief__steps,
  .js .chapter-preview {
    opacity: 0;
    animation: side-in 640ms var(--ease-out) 300ms forwards;
  }

  .js .brief__foot {
    opacity: 0;
    animation: side-in 640ms var(--ease-out) 380ms forwards;
  }

  .js .stage {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    animation: stage-in 760ms var(--ease-expo) 100ms forwards;
  }

  .js .hud {
    opacity: 0;
    animation: side-in 520ms var(--ease-out) 280ms forwards;
  }

  .js .hook__card h1 {
    opacity: 0;
    animation: side-in 620ms var(--ease-expo) 360ms forwards;
  }

  .js .hook__card > p {
    opacity: 0;
    animation: side-in 560ms var(--ease-out) 440ms forwards;
  }

  .js .choices {
    opacity: 0;
    animation: side-in 560ms var(--ease-out) 520ms forwards;
  }

  .js .choices button:first-child {
    opacity: 0;
    animation: side-in 480ms var(--ease-out) 560ms forwards;
  }

  .js .choices button:nth-child(2) {
    opacity: 0;
    animation: side-in 480ms var(--ease-out) 620ms forwards;
  }

  .js .hook__note {
    opacity: 0;
    animation: side-in 560ms var(--ease-out) 600ms forwards;
  }
}

@keyframes side-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes stage-in {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
