/* Gridiron Dynasty — shared UI look: chalkboard panels in wooden frames, sunset-orange varsity buttons,
   chalk-white display type with navy outlines. Everything sized in rem; 1rem ≈ 15px on a phone (704×396). */
:root {
  --navy: #14213d; --navy2: #1d2c52; --turf: #2f7d3a; --orange: #ff8a2b; --gold: #ffd27a;
  --chalk: #f4f1e8; --slate: #22352e; --red: #e5484d; --green: #5bd16a;
  --fd: "Arial Black", "Arial Rounded MT Bold", Impact, sans-serif;  /* replaced by I18n.font() in main.js */
  --fb: system-ui, sans-serif;
  --outline: 0 0 0 transparent;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0b1224; overflow: hidden; }
html { font-size: clamp(14px, min(2.2vw, 3.9vh), 22px); }
body { font-family: var(--fb); color: var(--chalk); user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- type ---------- */
.fd { font-family: var(--fd); font-weight: 900; letter-spacing: .02em; }
.outl { text-shadow: -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy), 2px 2px 0 var(--navy), 0 3px 0 var(--navy); }
.outl-s { text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy), 0 2px 0 var(--navy); }
.dim { opacity: .75; }
.small { font-size: .9rem; }
.big { font-size: 1.5rem; }

/* ---------- panels & buttons (9-slice art) ---------- */
.panel {
  border-style: solid; border-width: 1rem;
  border-image: url("assets/ui-panel.webp") 36 fill / 1rem stretch;
  background-clip: padding-box; padding: .25rem; color: var(--chalk);
  filter: drop-shadow(0 .3rem .4rem rgba(0,0,0,.45));
}
.btn {
  appearance: none; -webkit-appearance: none; cursor: pointer; position: relative;
  min-height: 2.9rem; min-width: 2.9rem; padding: .2rem 1rem; margin: 0;
  border-style: solid; border-width: .55rem; background: none;
  border-image: url("assets/ui-button.webp") 22 fill / .55rem stretch;
  font-family: var(--fd); font-weight: 900; font-size: 1rem; color: var(--chalk); line-height: 1.1;
  text-shadow: -1.5px -1.5px 0 var(--navy), 1.5px -1.5px 0 var(--navy), -1.5px 1.5px 0 var(--navy), 1.5px 1.5px 0 var(--navy), 0 2px 0 var(--navy);
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .12s;
}
.btn:hover, .btn.nav-focus { filter: brightness(1.15) drop-shadow(0 0 .35rem rgba(255,210,122,.85)); transform: scale(1.04); }
.btn:active, .btn.pressed { transform: scale(.93); }
.btn[disabled], .btn.disabled { filter: grayscale(.85) brightness(.7); cursor: default; }
.btn.ghost { border-image: none; border: 2px dashed rgba(244,241,232,.55); border-radius: .5rem; background: rgba(10,20,30,.35); }
.btn.ghost:hover, .btn.ghost.nav-focus { background: rgba(255,255,255,.12); }
.btn.sel { border-image: none; border: 3px solid var(--gold); border-radius: .5rem; background: rgba(255,210,122,.22); }
.btn img.ico { width: 1.5rem; height: 1.5rem; object-fit: contain; }
.icon-btn {
  position: absolute; width: 2.9rem; height: 2.9rem; padding: 0; border: none; cursor: pointer;
  background: none; display: flex; align-items: center; justify-content: center;
  border-style: solid; border-width: .45rem; border-image: url("assets/ui-button.webp") 22 fill / .45rem stretch;
  transition: transform .12s;
}
.icon-btn:hover, .icon-btn.nav-focus { filter: brightness(1.15); transform: scale(1.06); }
.icon-btn:active { transform: scale(.92); }

/* ---------- cards, chips, meters ---------- */
.card { background: rgba(255,255,255,.06); border: 2px dashed rgba(244,241,232,.35); border-radius: .6rem; padding: .4rem .55rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .05rem .5rem; border-radius: 1rem; font-weight: 800; font-size: .9rem; background: rgba(0,0,0,.35); white-space: nowrap; }
.town { color: #10151f; text-shadow: none; }
.ovr { display: inline-flex; align-items: center; justify-content: center; min-width: 2.2rem; height: 2.2rem; border-radius: 50%;
  font-family: var(--fd); font-weight: 900; font-size: 1rem; color: var(--navy); background: var(--chalk); border: 3px solid var(--navy); }
.ovr.elite { background: var(--gold); } .ovr.good { background: #b8f0c0; } .ovr.low { background: #c9c9c9; }
.meter { position: relative; height: .7rem; border-radius: .4rem; background: rgba(0,0,0,.45); overflow: hidden; border: 2px solid var(--navy); }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--orange), var(--gold)); border-radius: .3rem; transition: width .4s; }
.scroll { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; overscroll-behavior: contain; touch-action: pan-y; }
.scroll::-webkit-scrollbar { display: none; }
.emblem { width: 2.4rem; height: 2.4rem; object-fit: contain; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.gold-ico { width: 1.3rem; height: 1.3rem; object-fit: contain; vertical-align: middle; }

/* ---------- motion ---------- */
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
@keyframes slideL { from { transform: translateX(-2rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drop { 0% { transform: translateY(-1.5rem); opacity: 0; } 70% { transform: translateY(.2rem); opacity: 1; } 100% { transform: none; } }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .75; } }
@keyframes slam { 0% { transform: scale(2.2) rotate(-6deg); opacity: 0; } 60% { transform: scale(.95) rotate(-4deg); opacity: 1; } 100% { transform: scale(1) rotate(-4deg); } }
.anim-pop { animation: pop .26s cubic-bezier(.3,1.4,.5,1) both; }
.anim-l { animation: slideL .25s ease-out both; }
.anim-r { animation: slideR .25s ease-out both; }
.anim-drop { animation: drop .3s cubic-bezier(.3,1.4,.5,1) both; }

/* ---------- title ---------- */
#title { background: #0b1224; }
#title .title-art { position: absolute; inset: 0; background: url("assets/title-bg.webp") center/cover no-repeat; }
#title .title-logo { position: absolute; left: 4%; top: 7%; width: 52%; max-height: 38%; object-fit: contain; object-position: left center;
  animation: drop .6s cubic-bezier(.3,1.5,.5,1) both; filter: drop-shadow(0 .4rem .3rem rgba(0,0,0,.5)); }
#title .title-buttons { position: absolute; left: 4%; top: 52%; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
#title .title-prompt { position: absolute; left: 0; right: 0; bottom: 7%; text-align: center; font-family: var(--fd); font-weight: 900; font-size: 1.2rem;
  animation: pulse 1.6s ease-in-out infinite; pointer-events: none; }
#title .trophy-btn { right: max(.7rem, env(safe-area-inset-right)); top: .7rem; }

/* ---------- toast, subtitle, modal ---------- */
#toast-root { position: absolute; left: 50%; top: 3.6rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; align-items: center; pointer-events: none; z-index: 40; }
.toast { padding: .45rem 1rem; border-radius: .6rem; background: rgba(20,33,61,.92); border: 2px solid var(--gold); font-weight: 800; animation: drop .3s both; max-width: 60vw; text-align: center; }
#subtitle { position: absolute; left: 50%; bottom: 5.2rem; transform: translateX(-50%); max-width: 60%; padding: .35rem .9rem; border-radius: .5rem;
  background: rgba(0,0,0,.6); font-weight: 800; text-align: center; z-index: 30; pointer-events: none; }
#modal-root { z-index: 50; }
.modal-back { position: absolute; inset: 0; background: rgba(5,10,20,.6); display: flex; align-items: center; justify-content: center; }
.modal { width: min(28rem, 80%); text-align: center; animation: pop .25s both; }
.modal .msg { padding: .6rem .4rem 1rem; font-weight: 800; line-height: 1.35; }
.modal .row { display: flex; gap: .8rem; justify-content: center; padding-bottom: .2rem; }

/* keyboard / gamepad focus for non-.btn elements */
.nav-focus:not(.btn):not(.icon-btn) { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: .4rem; }
