:root {
  --ink: #292522;
  --muted: #827b74;
  --paper: #f7f2eb;
  --cream: #fffdf9;
  --accent: #e86e52;
  --line: rgba(41, 37, 34, .13);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Gowun Dodum", sans-serif;
}

body::before, body::after {
  content: "";
  position: fixed;
  width: 25rem;
  height: 25rem;
  border-radius: 50%;
  filter: blur(1px);
  opacity: .48;
  pointer-events: none;
}
body::before { top: -13rem; right: -7rem; background: #f6c5ae; }
body::after { bottom: -15rem; left: -8rem; background: #e4d9be; }

.app-shell { position: relative; z-index: 1; width: min(100% - 2rem, 1100px); min-height: 100vh; margin: auto; padding: 5rem 0 4rem; }
.hero, .result { text-align: center; }
.eyebrow { color: var(--accent); font-family: "Space Grotesk", sans-serif; font-size: .72rem; font-weight: 700; letter-spacing: .2em; }
.eyebrow-dot { display: inline-block; width: .45rem; height: .45rem; margin-right: .45rem; border-radius: 50%; background: var(--accent); vertical-align: .08em; }
h1, h2, p { margin: 0; }
h1 { margin-top: 1.4rem; font-size: clamp(4.5rem, 13vw, 9rem); font-weight: 400; line-height: .82; letter-spacing: -.09em; }
h1 em, h2 em { color: var(--accent); font-style: normal; }
.hero-copy { margin-top: 2rem; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }
.primary-button { border: 0; border-radius: 999px; padding: 1.05rem 1.5rem 1.05rem 1.7rem; color: white; background: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: transform .2s, background .2s; }
.hero .primary-button, .result .primary-button { margin-top: 2.2rem; }
.primary-button span { display: inline-block; margin-left: 1rem; color: #ffc6a8; font-size: 1.25rem; }
.primary-button:hover { background: var(--accent); transform: translateY(-2px); }
.hidden { display: none !important; }

.game { position: relative; padding-top: 1rem; }
.game-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.text-button { padding: 0; border: 0; color: var(--muted); background: transparent; font: inherit; cursor: pointer; justify-self: start; }
.text-button:hover { color: var(--accent); }
.round-label { font-family: "Space Grotesk", sans-serif; font-size: 1.2rem; font-weight: 700; }
.match-count { justify-self: end; color: var(--muted); font-family: "Space Grotesk", sans-serif; font-size: .85rem; }
.progress-track { height: 4px; margin-top: 1.5rem; overflow: hidden; border-radius: 9px; background: #e8ded4; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.game-intro { margin: 3.5rem 0 2.5rem; text-align: center; }
.game-intro h2, .result h2 { margin-top: .9rem; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 400; line-height: 1.15; letter-spacing: -.06em; }
.matchup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.candidate { position: relative; min-height: 480px; overflow: hidden; border-radius: 1.5rem; background: var(--cream); cursor: pointer; box-shadow: 0 1rem 2.5rem rgba(77, 53, 38, .08); transition: transform .3s ease, box-shadow .3s ease; }
.candidate:hover { transform: translateY(-8px) rotate(-.4deg); box-shadow: 0 1.5rem 3rem rgba(77, 53, 38, .15); }
.candidate:nth-child(2):hover { transform: translateY(-8px) rotate(.4deg); }
.candidate img { display: block; width: 100%; height: 100%; min-height: 480px; object-fit: cover; transition: transform .45s ease; }
.candidate:hover img { transform: scale(1.04); }
.candidate::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(20, 16, 13, .72)); }
.candidate-info { position: absolute; z-index: 1; right: 1.5rem; bottom: 1.25rem; left: 1.5rem; display: flex; align-items: end; justify-content: space-between; color: white; }
.candidate-name { font-size: 1.7rem; }
.choice-number { display: grid; width: 2.4rem; height: 2.4rem; place-items: center; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; font-family: "Space Grotesk", sans-serif; font-size: .85rem; }
.hint { margin-top: 1.3rem; color: var(--muted); text-align: center; font-size: .85rem; }
.selection-overlay { position: absolute; z-index: 3; inset: 0; display: flex; align-items: center; justify-content: center; min-height: 720px; overflow: hidden; border-radius: 1.5rem; background: rgba(247, 242, 235, .96); }
.selection-glow { position: absolute; top: 50%; left: 50%; width: 28rem; height: 28rem; border-radius: 50%; background: #f5c4ad; filter: blur(55px); opacity: .55; transform: translate(-50%, -50%); }
.selection-overlay > *:not(.selection-glow) { position: relative; z-index: 1; }
.selected-winner { width: min(66vw, 330px); text-align: center; animation: slide-from-left .7s cubic-bezier(.2,.8,.2,1) both; }
.selected-winner.from-right { animation-name: slide-from-right; }
.selected-winner img { display: block; width: 100%; height: 390px; border-radius: 1rem; object-fit: cover; box-shadow: 0 1rem 2.5rem rgba(77, 53, 38, .16); }
.selected-winner-name { margin-top: 1.15rem; color: var(--ink); font-size: 1.8rem; }
@keyframes slide-from-left { from { opacity: 0; transform: translateX(-28vw); } to { opacity: 1; transform: translateX(0); } }
@keyframes slide-from-right { from { opacity: 0; transform: translateX(28vw); } to { opacity: 1; transform: translateX(0); } }

.result { max-width: 580px; margin: auto; padding-top: 3rem; }
.winner-card { width: min(100%, 360px); margin: 2.5rem auto 0; overflow: hidden; border-radius: 1.5rem; background: var(--cream); box-shadow: 0 1rem 2.5rem rgba(77, 53, 38, .12); }
.winner-card img { display: block; width: 100%; height: 400px; object-fit: cover; }
.winner-name { padding: 1.3rem; font-size: 1.8rem; }
.ranking-section { margin-top: 4rem; text-align: left; }
.ranking-heading { display: flex; align-items: end; justify-content: space-between; padding-bottom: .85rem; border-bottom: 1px solid var(--line); }
.ranking-heading h3 { font-size: 1.35rem; font-weight: 400; }
.ranking-note { margin: .8rem 0 0; color: var(--muted); font-size: .8rem; }
.ranking-list { overflow: hidden; border-bottom: 1px solid var(--line); }
.ranking-item { display: grid; grid-template-columns: 2.2rem 3.2rem 1fr auto; gap: .8rem; align-items: center; padding: .85rem .2rem; border-bottom: 1px solid var(--line); }
.ranking-item:last-child { border-bottom: 0; }
.ranking-number { color: var(--accent); font-family: "Space Grotesk", sans-serif; font-size: 1.05rem; font-weight: 700; }
.ranking-item:first-child .ranking-number { font-size: 1.3rem; }
.ranking-thumb { width: 3.2rem; height: 3.2rem; border-radius: .65rem; object-fit: cover; }
.ranking-name { font-size: 1.1rem; }
.ranking-round { color: var(--muted); font-size: .78rem; text-align: right; line-height: 1.5; }
.result > .primary-button { margin-bottom: 2rem; }

@media (max-width: 650px) {
  .app-shell { padding-top: 3rem; }
  .game-intro { margin: 2.5rem 0 1.5rem; }
  .matchup { gap: .7rem; }
  .candidate, .candidate img { min-height: 350px; }
  .candidate-info { right: .9rem; bottom: .9rem; left: .9rem; }
  .candidate-name { font-size: 1.25rem; }
  .choice-number { width: 2rem; height: 2rem; }
  .selection-overlay { min-height: 650px; }
  .selected-winner img { height: 300px; }
}
