:root {
  --paper: #f2f1ea;
  --white: #fff;
  --ink: #111310;
  --muted: #6f726a;
  --line: #c9cbc2;
  --lime: #d8ff3e;
  --yellow: #ffdd55;
  --red: #ec4b43;
  --blue: #5588ff;
  font-family: "Pretendard", "SUIT", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.football-shell { min-height: 100vh; }
.football-wordmark { color: inherit; font-size: 0.75rem; font-weight: 950; letter-spacing: 0; text-decoration: none; }
.football-wordmark::before { display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.5rem; border: 1px solid var(--ink); border-radius: 50%; background: var(--lime); content: ""; vertical-align: -0.02rem; }

.football-intro { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(18rem, 0.8fr) minmax(34rem, 1.2fr); grid-template-rows: auto 1fr; column-gap: clamp(3rem, 8vw, 8.5rem); align-items: center; width: min(1280px, 100%); min-height: 100vh; margin: 0 auto; padding: 1.5rem clamp(1.25rem, 4vw, 4rem) 2.5rem; overflow: hidden; animation: football-intro-enter 560ms 150ms cubic-bezier(.2,.8,.2,1) both; }
.football-topbar { position: relative; z-index: 2; grid-column: 1 / -1; display: flex; min-height: 3.5rem; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--ink); }
.football-topbar > span { color: var(--muted); font-size: 0.75rem; font-weight: 900; }
.intro-copy, .intro-card { position: relative; z-index: 2; }
.ambient-globe { position: absolute; z-index: 0; width: clamp(25rem, 38vw, 38rem); aspect-ratio: 1; opacity: 0.2; perspective: 900px; pointer-events: none; animation: ambient-globe-float 7s ease-in-out infinite; }
.ambient-globe--football { bottom: -12rem; left: -8rem; }
.ambient-globe::before { position: absolute; inset: 3%; border: 1px dashed rgba(17,19,16,.5); border-radius: 50%; content: ""; animation: ambient-orbit 18s linear infinite; }
.ambient-globe::after { position: absolute; top: 50%; left: -5%; width: 110%; height: 16%; border: 1px solid rgba(17,19,16,.42); border-radius: 50%; content: ""; transform: translateY(-50%) rotate(-15deg); }
.ambient-globe-core { position: absolute; inset: 12%; border: 1.5px solid var(--ink); border-radius: 50%; background: radial-gradient(circle at 34% 28%, rgba(216,255,62,.65), rgba(216,255,62,.08) 40%, transparent 66%); transform-style: preserve-3d; animation: ambient-globe-spin 16s linear infinite; }
.ambient-globe-core i { position: absolute; display: block; border: 1px solid rgba(17,19,16,.68); border-radius: 50%; backface-visibility: visible; }
.globe-longitude { inset: 0; }
.longitude-1 { transform: rotateY(0deg); }
.longitude-2 { transform: rotateY(30deg); }
.longitude-3 { transform: rotateY(60deg); }
.longitude-4 { transform: rotateY(90deg); }
.longitude-5 { transform: rotateY(120deg); }
.longitude-6 { transform: rotateY(150deg); }
.globe-latitude { right: 7%; left: 7%; height: 20%; }
.latitude-1 { top: 18%; }
.latitude-2 { top: 40%; }
.latitude-3 { top: 62%; }
.ambient-globe > span { position: absolute; right: 7%; bottom: 3%; padding: .32rem .5rem; border: 1px solid rgba(17,19,16,.65); background: var(--lime); color: var(--ink); font-size: .55rem; font-weight: 950; letter-spacing: .08em; }
.intro-copy { align-self: center; padding: 3rem 0; }
.football-eyebrow { display: inline-block; margin: 0; padding: 0.45rem 0.7rem; border: 1px solid var(--ink); border-radius: 999px; background: var(--yellow); font-size: 0.7rem; font-weight: 950; }
.intro-copy h1 { display: grid; gap: 0.16em; margin: 1.35rem 0 1.5rem; font-size: clamp(4rem, 7.3vw, 7.1rem); letter-spacing: -0.075em; line-height: 0.88; }
.intro-copy h1 span, .intro-copy h1 em { display: block; }
.intro-copy h1 em { color: transparent; font-size: 0.76em; font-style: normal; letter-spacing: -0.055em; line-height: 0.96; white-space: nowrap; -webkit-text-stroke: 2px var(--ink); }
.intro-copy > p:last-child { color: var(--muted); font-size: 1rem; font-weight: 650; line-height: 1.75; }
.intro-card { align-self: center; padding: clamp(1.5rem, 3vw, 2.4rem); border: 1px solid var(--ink); background: var(--white); box-shadow: 10px 10px 0 var(--ink); }
.football-mode-back { display: flex; width: max-content; min-height: 2.7rem; margin-bottom: 1.15rem; padding: 0 0.9rem; align-items: center; border: 1px solid var(--ink); background: var(--lime); box-shadow: 3px 3px 0 var(--ink); color: var(--ink); font-size: 0.75rem; font-weight: 950; text-decoration: none; transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease; }
.football-mode-back:hover, .football-mode-back:focus-visible { background: var(--yellow); outline: 0; transform: translate(-1px, -1px); }
.football-mode-back:active { box-shadow: 1px 1px 0 var(--ink); transform: translate(1px, 1px); }
.intro-card > span { color: var(--muted); font-size: 0.68rem; font-weight: 950; }
.intro-card h2 { margin: 0.35rem 0 1.5rem; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; }
.intro-rule-list { border-top: 1px solid var(--ink); }
.intro-rule-list div { display: grid; grid-template-columns: 3rem 1fr; min-height: 4rem; align-items: center; border-bottom: 1px solid var(--line); }
.intro-rule-list b { font-size: 0.75rem; }
.intro-rule-list span { font-weight: 800; }
.roster-picker { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.55rem; margin: 1.2rem 0 0; padding: 0; border: 0; }
.roster-picker legend { grid-column: 1 / -1; margin-bottom: 0.1rem; color: var(--muted); font-size: 0.58rem; font-weight: 950; }
.roster-picker label { position: relative; cursor: pointer; }
.roster-picker input { position: absolute; opacity: 0; pointer-events: none; }
.roster-picker label > span { display: grid; min-height: 4.2rem; padding: 0.7rem; align-content: center; border: 1px solid var(--line); background: var(--paper); }
.roster-picker b { font-size: 0.86rem; }
.roster-picker small { margin-top: 0.25rem; color: var(--muted); font-size: 0.6rem; font-weight: 750; }
.roster-picker input:checked + span { border-color: var(--ink); background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); }
.roster-picker input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
#football-start { display: flex; width: 100%; min-height: 4.2rem; margin-top: 1.5rem; padding: 0 1.1rem; align-items: center; justify-content: space-between; border: 1px solid var(--ink); background: var(--lime); cursor: pointer; font-weight: 950; }
#football-start:hover, #football-start:focus-visible { background: var(--ink); color: var(--white); }
#football-load-status { min-height: 1rem; margin: 0.75rem 0 0; color: var(--muted); font-size: 0.66rem; font-weight: 750; }

.football-game { min-height: 100vh; padding: 0 clamp(0.75rem, 2vw, 1.5rem) 1rem; }
.game-topbar { display: grid; grid-template-columns: 1fr auto auto; gap: 1.2rem; align-items: center; width: min(1380px, 100%); min-height: 5.6rem; margin: auto; border-bottom: 1px solid var(--ink); }
.game-metrics { display: flex; }
.game-metrics div { display: grid; min-width: 4.7rem; padding: 0.4rem 0.8rem; border-left: 1px solid var(--line); }
.game-metrics div:last-child { border-right: 1px solid var(--line); }
.game-metrics span { color: var(--muted); font-size: 0.61rem; font-weight: 850; }
.game-metrics strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.exit-button { display: inline-flex; min-height: 2.7rem; padding: 0 0.85rem; gap: 0.35rem; align-items: center; justify-content: center; border: 1px solid var(--ink); background: var(--lime); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; font-size: 0.72rem; font-weight: 950; }
.exit-button:hover, .exit-button:focus-visible { background: var(--yellow); transform: translate(-1px, -1px); }
.exit-label-short { display: none; }
.football-progress { width: min(1380px, 100%); height: 0.65rem; margin: 0 auto; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); border-left: 1px solid var(--ink); background: #d9dbd3; }
.football-progress span { display: block; width: 0; height: 100%; border-right: 1px solid var(--ink); background: var(--lime); transition: width 260ms ease; }

.football-arena { position: relative; width: min(1380px, 100%); height: calc(100vh - 8rem); min-height: 590px; margin: 1rem auto 0; overflow: hidden; border: 1px solid #070907; background: #111713; box-shadow: inset 0 0 0 1px rgba(199,255,87,.14); }
.football-globe-stage { position: absolute; inset: 0; background: #111713; touch-action: none; }
.football-globe-stage .globe-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.football-globe-stage .globe-canvas.is-dragging { cursor: grabbing; }
.football-globe-error { display: grid; height: 100%; margin: 0; padding: 2rem; place-items: center; color: var(--white); font-weight: 900; text-align: center; }
.football-globe-hint { position: absolute; top: 0.8rem; right: 0.8rem; z-index: 2; padding: 0.38rem 0.55rem; border: 1px solid rgba(255,255,255,.75); background: var(--lime); color: var(--ink); font-size: 0.56rem; font-weight: 950; pointer-events: none; }
.player-card { position: absolute; top: 1rem; left: 1rem; z-index: 4; display: grid; grid-template-rows: minmax(0, 1fr) auto; width: min(16.5rem, 21%); height: min(20.5rem, calc(100% - 2rem)); min-height: 17.5rem; border: 1px solid var(--white); background: var(--ink); box-shadow: 7px 7px 0 var(--yellow); }
.player-photo-wrap { position: relative; min-height: 0; overflow: hidden; background: #252922; }
.player-photo-wrap::after { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.32)); content: ""; pointer-events: none; }
#player-photo { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 18%; opacity: 1; transition: opacity 180ms ease, transform 320ms ease; }
.player-photo-wrap.is-loading #player-photo { opacity: 0; }
.player-photo-wrap.has-fallback #player-photo { visibility: hidden; }
.player-photo-wrap.is-new #player-photo { animation: photo-punch 360ms cubic-bezier(.16,1,.3,1); }
.player-fallback { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, #30352b, #151814); color: var(--lime); font-size: clamp(5rem, 12vw, 10rem); font-weight: 950; }
.player-fallback:empty { display: none; }
.photo-number { position: absolute; top: 0.8rem; left: 0.8rem; z-index: 2; display: grid; width: 3rem; height: 3rem; place-items: center; border: 1px solid var(--ink); background: var(--yellow); font-size: 0.78rem; font-weight: 950; }
.player-copy { padding: 1.1rem 1.3rem 1.25rem; color: var(--white); }
.player-copy > span { color: #aeb2a8; font-size: 0.62rem; font-weight: 900; }
.player-copy h1 { margin: 0.3rem 0 0.65rem; font-size: clamp(1.9rem, 3.4vw, 3.6rem); letter-spacing: -0.055em; line-height: 0.95; }
.player-copy a { color: var(--lime); font-size: 0.58rem; font-weight: 850; text-decoration: none; }

.country-choices { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.country-choice { position: absolute; display: grid; grid-template-columns: 3.1rem minmax(0, 1fr); gap: 0.72rem; align-items: center; width: min(17rem, 25%); min-height: 4.5rem; padding: 0.65rem; border: 1px solid var(--ink); background: rgba(255,255,255,.97); box-shadow: 5px 5px 0 var(--lime); cursor: pointer; pointer-events: auto; text-align: left; transition: transform 110ms ease, box-shadow 110ms ease, background 110ms ease; animation: choice-in 230ms ease both; animation-delay: calc(var(--order) * 48ms); }
.country-choice.up { top: 1rem; left: 50%; transform: translateX(-50%); }
.country-choice.down { bottom: 1rem; left: 50%; transform: translateX(-50%); }
.country-choice.left { top: 62%; bottom: auto; left: 1rem; transform: translateY(-50%); }
.country-choice.right { top: 50%; right: 1rem; transform: translateY(-50%); }
.country-choice:hover, .country-choice:focus-visible { background: var(--lime); outline: 0; box-shadow: 2px 2px 0 var(--ink); }
.country-choice.up:hover, .country-choice.down:hover, .country-choice.up:focus-visible, .country-choice.down:focus-visible { transform: translateX(-50%) translateY(-3px); }
.country-choice.right:hover, .country-choice.right:focus-visible { transform: translateY(-50%) translateY(-3px); }
.country-choice.left:hover, .country-choice.left:focus-visible { transform: translateY(calc(-50% - 3px)); }
.country-choice:disabled { cursor: default; }
.country-choice.is-correct { background: var(--lime); animation: correct-pulse 420ms ease both; }
.country-choice.is-wrong { background: var(--red); color: var(--white); }
.country-choice > b { display: grid; width: 3.1rem; height: 3.1rem; place-items: center; border: 1px solid var(--ink); background: var(--yellow); color: var(--ink); font-family: "Segoe UI Symbol", sans-serif; font-size: 1.4rem; }
.country-copy { display: grid; gap: 0.45rem; }
.country-copy img { width: 2.1rem; height: 1.4rem; object-fit: cover; border: 1px solid var(--ink); }
.country-copy strong { font-size: clamp(1rem, 1.6vw, 1.35rem); line-height: 1.05; }

.football-feedback { position: absolute; top: 50%; left: 50%; z-index: 8; min-width: 12rem; padding: 0.9rem 1.2rem; border: 2px solid var(--ink); background: var(--lime); box-shadow: 8px 8px 0 var(--ink); font-size: clamp(1.3rem, 3vw, 2.4rem); font-weight: 950; opacity: 0; pointer-events: none; text-align: center; transform: translate(-50%, -50%) scale(.9) rotate(-1deg); }
.football-feedback.is-visible { animation: feedback-pop 650ms ease forwards; }
.football-feedback.is-wrong { background: var(--red); color: var(--white); animation-duration: 1050ms; }
.confetti-layer { position: absolute; inset: 0; z-index: 7; overflow: hidden; pointer-events: none; }
.confetti { position: absolute; top: 45%; left: 50%; width: 0.55rem; height: 1.1rem; border: 1px solid var(--ink); background: var(--color); animation: confetti 620ms ease-out forwards; }

.football-finish { position: absolute; top: 50%; left: 50%; z-index: 10; display: grid; width: min(34rem, calc(100% - 2rem)); padding: 2rem; border: 2px solid var(--ink); background: var(--white); box-shadow: 12px 12px 0 var(--yellow); text-align: center; transform: translate(-50%, -50%); }
.football-finish > p { justify-self: center; margin: 0; padding: 0.35rem 0.6rem; border: 1px solid var(--ink); border-radius: 999px; background: var(--lime); font-size: 0.67rem; font-weight: 950; }
.football-finish h2 { margin: 0.8rem 0 0; font-size: 2rem; }
.football-finish > strong { margin: 0.7rem 0; font-size: clamp(4rem, 12vw, 7rem); letter-spacing: -0.08em; line-height: 1; }
.football-finish > span { color: var(--muted); font-weight: 750; }
.football-finish > div { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-top: 1.5rem; }
.football-finish button, .football-finish a { display: grid; min-height: 3.4rem; place-items: center; border: 1px solid var(--ink); background: var(--lime); color: var(--ink); cursor: pointer; font-weight: 950; text-decoration: none; }
.football-finish a { background: var(--white); }
.prototype-note { width: min(1380px, 100%); margin: 0.7rem auto 0; color: var(--muted); font-size: 0.58rem; font-weight: 700; text-align: right; }

.football-entry-transition {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
  color: var(--white);
  pointer-events: none;
  animation: football-entry-reveal 680ms cubic-bezier(.72,0,.28,1) both;
}

.football-entry-transition::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0.8rem;
  background: var(--lime);
  content: "";
}

.football-entry-transition span { font-size: clamp(.85rem, 2vw, 1.2rem); font-weight: 950; }
.football-entry-transition.is-exiting { animation: football-exit-cover 420ms cubic-bezier(.72,0,.28,1) both; }
body.is-football-exiting .football-intro { animation: football-intro-exit 280ms ease-in both; }

@keyframes photo-punch { from { opacity: .2; transform: scale(1.08); } }
@keyframes choice-in { from { opacity: 0; } }
@keyframes correct-pulse { 45% { box-shadow: 0 0 0 8px rgba(216,255,62,.28); filter: brightness(1.08); } }
@keyframes feedback-pop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.65) rotate(-5deg); } 22%,72% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-1deg); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.04); } }
@keyframes confetti { to { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); } }
@keyframes football-entry-reveal { 0%, 31% { transform: translateX(0); } 100% { transform: translateX(105%); } }
@keyframes football-exit-cover { from { transform: translateX(105%); } to { transform: translateX(0); } }
@keyframes football-intro-enter { from { opacity: .35; transform: translateY(.75rem) scale(.995); } }
@keyframes football-intro-exit { to { opacity: .45; transform: translateY(.5rem) scale(.995); } }
@keyframes ambient-globe-spin { from { transform: rotateX(-9deg) rotateY(0deg) rotateZ(-4deg); } to { transform: rotateX(-9deg) rotateY(360deg) rotateZ(-4deg); } }
@keyframes ambient-globe-float { 0%, 100% { transform: translate3d(0,0,0) rotate(-2deg); } 50% { transform: translate3d(0,-.9rem,0) rotate(1deg); } }
@keyframes ambient-orbit { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .football-intro { display: block; min-height: auto; padding: 0 1rem 2rem; }
  .football-topbar { min-height: 3.3rem; }
  .football-topbar > span { font-size: .58rem; }
  .ambient-globe--football { top: 5rem; right: -7rem; bottom: auto; left: auto; width: 21rem; opacity: .14; }
  .intro-copy { padding: 2.5rem 0 2rem; }
  .intro-copy h1 { gap: 0.18em; font-size: clamp(3.8rem, 17vw, 5.2rem); line-height: 0.9; }
  .intro-copy h1 em { font-size: 0.72em; white-space: normal; }
  .intro-card { padding: 1.1rem; box-shadow: 7px 7px 0 var(--ink); }
  .football-game { height: 100dvh; min-height: 100dvh; padding: 0 0.65rem 0.65rem; overflow: hidden; }
  .game-topbar { grid-template-columns: 1fr auto; gap: 0.5rem; min-height: 3.9rem; }
  .game-topbar .football-wordmark { display: none; }
  .game-metrics { min-width: 0; }
  .game-metrics div { min-width: 3.55rem; padding: 0.28rem 0.42rem; }
  .game-metrics span { font-size: 0.52rem; }
  .game-metrics strong { font-size: 0.8rem; }
  .exit-button { min-height: 2.4rem; padding: 0 0.55rem; }
  .exit-label { display: none; }
  .exit-label-short { display: inline; }
  .football-arena { height: calc(100dvh - 5.8rem); min-height: 0; margin-top: 0.5rem; }
  .football-globe-hint { top: 0.45rem; right: 0.45rem; font-size: 0.48rem; }
  .player-card { top: 0.55rem; left: 0.55rem; grid-template-columns: minmax(0, 1.05fr) minmax(7.5rem, .95fr); grid-template-rows: 1fr; width: min(18rem, calc(100% - 5.7rem)); height: 34%; min-height: 10rem; box-shadow: 4px 4px 0 var(--yellow); }
  .player-photo-wrap { min-height: 0; }
  .player-copy { display: flex; padding: 0.75rem; flex-direction: column; justify-content: flex-end; }
  .player-copy h1 { font-size: clamp(1.35rem, 6.5vw, 2rem); }
  .player-copy a { margin-top: auto; }
  .photo-number { top: 0.45rem; left: 0.45rem; width: 2.2rem; height: 2.2rem; }
  .country-choices { right: 0.45rem; bottom: 0.45rem; left: 0.45rem; top: auto; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.45rem; }
  .country-choice, .country-choice.up, .country-choice.down, .country-choice.left, .country-choice.right { position: relative; top: auto; right: auto; bottom: auto; left: auto; width: auto; min-height: 4.2rem; transform: none; }
  .country-choice { grid-template-columns: 2.45rem minmax(0,1fr); gap: 0.5rem; padding: 0.45rem; box-shadow: 3px 3px 0 var(--lime); }
  .country-choice:hover, .country-choice:focus-visible, .country-choice.up:hover, .country-choice.down:hover, .country-choice.left:hover, .country-choice.right:hover { transform: translateY(-2px); }
  .country-choice > b { width: 2.45rem; height: 2.45rem; font-size: 1.1rem; }
  .country-copy { display: flex; gap: 0.45rem; align-items: center; }
  .country-copy img { width: 1.55rem; height: 1.05rem; }
  .country-copy strong { font-size: 0.78rem; overflow-wrap: anywhere; }
  .prototype-note { display: none; }
  .football-finish { padding: 1.35rem; box-shadow: 8px 8px 0 var(--yellow); }
}

@media (max-width: 390px) {
  .game-metrics div { min-width: 3.1rem; }
  .country-copy img { display: none; }
  .player-copy > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .ambient-globe, .ambient-globe::before, .ambient-globe-core { animation: none !important; }
  .football-entry-transition { display: none; }
}
