:root {
  color-scheme: light dark;
  --paper: #f1ecdf;
  --card: #fffdf6;
  --ink: #171816;
  --muted: #68685f;
  --red: #e34a2e;
  --yellow: #f2c84b;
  --line: #aaa99e;
  --arena: #1b1c19;
  --arena-ink: #f8f4e9;
  --page-width: 1120px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
}

body::before {
  position: fixed;
  z-index: -1;
  top: 12vh;
  right: -0.06em;
  color: rgb(23 24 22 / 4%);
  content: "午餐";
  font-size: clamp(9rem, 30vw, 30rem);
  font-weight: 900;
  letter-spacing: -.12em;
  line-height: .8;
  pointer-events: none;
  writing-mode: vertical-rl;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

main, footer {
  width: min(var(--page-width), calc(100% - 40px));
  margin-inline: auto;
}

.pk-hero { padding: clamp(42px, 7vw, 82px) 0 28px; }
.eyebrow {
  margin: 0 0 17px;
  color: var(--red);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .13em;
}
.hero-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
  gap: 42px;
  align-items: end;
}
.hero-line h1 {
  margin: 0;
  font-size: clamp(3.6rem, 9vw, 8rem);
  font-weight: 950;
  letter-spacing: -.085em;
  line-height: .82;
}
.hero-line h1 span {
  display: inline-block;
  margin-left: .14em;
  color: var(--red);
  font-size: .34em;
  letter-spacing: -.03em;
  vertical-align: top;
}
.hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.75;
}
.hero-share {
  min-height: 44px;
  margin-top: 14px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--ink);
  background: transparent;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}
.hero-share:hover { color: var(--red); }

.arena {
  position: relative;
  isolation: isolate;
  min-height: 570px;
  padding: clamp(20px, 4vw, 42px);
  overflow: hidden;
  color: var(--arena-ink);
  background: var(--arena);
}
.arena::before, .arena::after {
  position: absolute;
  z-index: -1;
  border: 1px solid rgb(248 244 233 / 13%);
  content: "";
  pointer-events: none;
  transform: rotate(-8deg);
}
.arena::before { inset: 18% -8% 24% 56%; }
.arena::after { inset: 42% 48% -34% -16%; }
.arena-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(44px, 7vw, 74px);
}
.round-label { margin: 0 0 8px; font-size: .77rem; font-weight: 900; letter-spacing: .08em; }
progress {
  display: block;
  width: min(310px, 48vw);
  height: 5px;
  overflow: hidden;
  border: 0;
  color: var(--red);
  background: rgb(248 244 233 / 18%);
  appearance: none;
}
progress::-webkit-progress-bar { background: rgb(248 244 233 / 18%); }
progress::-webkit-progress-value { background: var(--red); transition: width 240ms cubic-bezier(.2, 0, 0, 1); }
progress::-moz-progress-bar { background: var(--red); }
.change-button {
  min-height: 44px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: #c9c7bd;
  background: transparent;
  font-size: .76rem;
  font-weight: 750;
  cursor: pointer;
}
.change-button:hover { color: var(--arena-ink); }

.match {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: clamp(18px, 4vw, 52px);
  align-items: center;
  max-width: 930px;
  margin-inline: auto;
}
.food-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 260px;
  padding: 28px;
  grid-template-rows: auto 1fr auto;
  border: 2px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: var(--card);
  box-shadow: 10px 10px 0 var(--red);
  text-align: left;
  cursor: pointer;
  transform: translate(0);
  transition: box-shadow 100ms ease-out, transform 100ms ease-out;
  touch-action: manipulation;
}
.food-card:hover { box-shadow: 6px 6px 0 var(--red); transform: translate(4px, 4px); }
.food-card:active { box-shadow: 2px 2px 0 var(--red); transform: translate(8px, 8px) scale(.99); }
.food-card:disabled { cursor: default; }
.card-role { font-size: .68rem; font-weight: 900; letter-spacing: .12em; }
.food-name {
  align-self: center;
  font-size: clamp(2.1rem, 5.2vw, 4.7rem);
  font-weight: 950;
  letter-spacing: -.075em;
  line-height: .96;
  overflow-wrap: anywhere;
}
.card-action {
  justify-self: end;
  padding-bottom: 3px;
  border-bottom: 2px solid currentColor;
  font-size: .78rem;
  font-weight: 900;
}
.versus {
  display: grid;
  width: clamp(48px, 6vw, 68px);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid var(--arena-ink);
  border-radius: 50%;
  color: var(--yellow);
  font-size: .86rem;
  font-weight: 950;
  transform: rotate(-7deg);
}
.challenger.is-entering { animation: contender-in 380ms cubic-bezier(.05, .7, .1, 1) both; }
.versus.is-entering { animation: versus-in 260ms 70ms cubic-bezier(.05, .7, .1, 1) both; }

.result {
  position: relative;
  display: grid;
  min-height: 330px;
  place-content: center;
  text-align: center;
}
.result[hidden] { display: none; }
.result::before, .result::after {
  position: absolute;
  inset: 50%;
  border: 2px solid var(--red);
  content: "";
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.result.is-revealing::before { animation: result-frame 760ms cubic-bezier(.05, .7, .1, 1) both; }
.result.is-revealing::after { animation: result-frame 760ms 90ms cubic-bezier(.05, .7, .1, 1) both; }
.result p { margin: 0 0 16px; color: var(--yellow); font-size: .72rem; font-weight: 900; letter-spacing: .18em; }
.result-name {
  position: relative;
  z-index: 1;
  font-size: clamp(3.4rem, 10vw, 8rem);
  font-weight: 950;
  letter-spacing: -.09em;
  line-height: .9;
}
.result.is-revealing .result-name { animation: winner-in 620ms cubic-bezier(.05, .7, .1, 1) both; }
.result-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 42px;
}
.result-actions button {
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid var(--arena-ink);
  color: var(--arena-ink);
  background: transparent;
  font-weight: 850;
  cursor: pointer;
}
.result-actions button:first-child { border-color: var(--red); background: var(--red); }
.result-actions button:hover { color: var(--ink); background: var(--arena-ink); }
.status { min-height: 24px; margin: 36px 0 0; color: #aaa99f; font-size: .76rem; text-align: center; }

.explanation {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 700px);
  gap: clamp(30px, 8vw, 96px);
  padding: clamp(70px, 11vw, 130px) 0;
  border-bottom: 1px solid var(--line);
}
.explanation h2 { margin: 0 0 22px; font-size: clamp(2rem, 5vw, 3.8rem); letter-spacing: -.055em; line-height: 1.05; }
.explanation > div > p { max-width: 62ch; margin: 0; color: var(--muted); line-height: 1.85; }
.explanation ol { margin: 42px 0 0; padding: 0; border-bottom: 1px solid var(--line); list-style: none; }
.explanation li { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 17px 0; border-top: 1px solid var(--line); font-weight: 750; }
.explanation li span { color: var(--red); font-size: .7rem; font-weight: 900; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 0 36px;
  color: var(--muted);
  font-size: .75rem;
}
footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }
footer a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes contender-in {
  from { opacity: 0; transform: translateX(70px) rotate(2deg) scale(.96); }
  to { opacity: 1; transform: translateX(0) rotate(0) scale(1); }
}
@keyframes versus-in {
  from { opacity: 0; transform: rotate(-25deg) scale(.6); }
  to { opacity: 1; transform: rotate(-7deg) scale(1); }
}
@keyframes winner-in {
  0% { opacity: 0; transform: scale(.72); letter-spacing: -.18em; }
  68% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); letter-spacing: -.09em; }
}
@keyframes result-frame {
  from { width: 0; height: 0; opacity: .9; transform: translate(-50%, -50%) rotate(-4deg); }
  to { width: min(82%, 760px); height: 92%; opacity: 0; transform: translate(-50%, -50%) rotate(3deg); }
}

@media (max-width: 720px) {
  main, footer { width: min(100% - 24px, var(--page-width)); }
  .hero-line { grid-template-columns: 1fr; gap: 18px; }
  .hero-line h1 { font-size: clamp(3.5rem, 18vw, 6rem); }
  .arena { min-height: 680px; padding: 18px 14px 24px; }
  .arena-head { align-items: start; margin-bottom: 34px; }
  .match { grid-template-columns: 1fr; gap: 18px; max-width: 430px; }
  .food-card { min-height: 190px; padding: 20px; box-shadow: 7px 7px 0 var(--red); }
  .food-card:hover { box-shadow: 4px 4px 0 var(--red); transform: translate(3px, 3px); }
  .food-card:active { box-shadow: 1px 1px 0 var(--red); transform: translate(6px, 6px) scale(.99); }
  .food-name { font-size: clamp(2rem, 12vw, 3.7rem); }
  .versus { position: absolute; z-index: 2; top: 50%; left: 50%; width: 48px; background: var(--arena); transform: translate(-50%, -50%) rotate(-7deg); }
  .versus.is-entering { animation-name: versus-in-mobile; }
  .challenger.is-entering { animation-name: contender-in-mobile; }
  .status { margin-top: 28px; }
  .explanation { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 430px) {
  .pk-hero { padding-top: 28px; }
  .arena-head { gap: 12px; }
  .change-button { max-width: 110px; text-align: right; }
  progress { width: 44vw; }
  .food-card { min-height: 178px; }
  .result-actions { display: grid; }
  .result-actions button { width: min(260px, 72vw); }
}

@keyframes contender-in-mobile {
  from { opacity: 0; transform: translateY(55px) rotate(1deg) scale(.96); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
@keyframes versus-in-mobile {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-25deg) scale(.6); }
  to { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1); }
}

@media (prefers-color-scheme: dark) {
  :root { --paper: #171816; --card: #f4f0e5; --ink: #f3f0e7; --muted: #aaa99f; --line: #55564f; }
  body::before { color: rgb(243 240 231 / 3%); }
  .food-card { color: #171816; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
