/* PIANO ARMY · the stage (web/army-stage.css): the HUD, the partial's strip, the arena, the keys, the draft. */
#stage { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto auto; background: #0d1018;
  grid-template-areas: "hud" "strip" "arena" "keys" "status"; }
/* (each part its own row by name: a part hidden, the strip or the keys, leaves its row empty and the arena keeps the
   one that grows; by order alone the arena slid up into the strip's row and shrank to nothing) */
#hud { grid-area: hud; } #strip { grid-area: strip; } #arena { grid-area: arena; } #keys { grid-area: keys; } #status { grid-area: status; }

/* -------------------------------------------------------------------- the HUD -- */
#hud { display: flex; align-items: center; gap: 14px; padding: 6px 12px; background: linear-gradient(#1f2638, #161b28); border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 14px; }
#hud .gold { display: flex; align-items: center; gap: 6px; }
#hud .gold img { height: 28px; }
#hud .gold b { font: 800 26px/1 "Barlow Condensed", sans-serif; color: var(--gold2); min-width: 2.2ch; }
#hud .squad { display: flex; gap: 2px; }
#hud .squad i { display: block; width: 24px; height: 26px; border-radius: 5px; background: rgba(255, 255, 255, .05); opacity: .5; }
#hud .squad i img { width: 100%; height: 100%; object-fit: contain; }
#hud .squad i.now { opacity: 1; background: rgba(240, 207, 133, .25); box-shadow: 0 0 0 1px var(--gold); }
#hud .vs { display: flex; align-items: center; gap: 10px; font-family: "Barlow Condensed", sans-serif; font-size: 18px; }
#hud .vs .army b { color: #8fb0ff; } #hud .vs .horde b { color: #ff8a7a; }
#hud .vs img { height: 22px; vertical-align: -5px; }
#hud .vs i { font-style: normal; font-size: 12px; letter-spacing: 1px; }
#hud .vs .army i { color: #8fb0ff; } #hud .vs .horde i { color: #ff8a7a; }
#hud .wave { color: var(--soft); }
#hud .spoils { display: flex; align-items: center; gap: 6px; }
#hud .spoils .track { width: 90px; height: 8px; border-radius: 4px; background: #0b0e15; border: 1px solid var(--line); overflow: hidden; }
#hud .spoils #meter { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b07d1e, #f0cf85); transition: width .25s; }
#hud .btns { margin-left: auto; display: flex; gap: 6px; }
#hud .btns button { padding: 4px 9px; font-size: 16px; }
#hud .btns button#bkeys:not(.on) { opacity: .45; }

/* ---------------------------------------------------- the partial on the stand -- */
#strip { position: relative; display: flex; align-items: stretch; justify-content: center; gap: 10px; padding: 6px 10px; background: #141926; border-bottom: 1px solid var(--line); min-height: 112px; }
#strip .side { position: absolute; right: 12px; margin-top: 2px; width: calc((100% - min(980px, 100%)) / 2 - 24px); max-width: 260px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
#strip .side b { width: 100%; text-align: right; font-weight: 500; color: var(--dim); }
#strip .side span { background: #222a3c; border-radius: 999px; padding: 1px 7px; color: var(--soft); }
.paper { position: relative; background: var(--paper); color: #2a2418; border-radius: 10px; padding: 4px 10px 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, .45); max-width: min(980px, 100%); min-width: 260px; display: flex; flex-direction: column; transition: box-shadow .3s, transform .3s; }
.paper .head { display: flex; align-items: baseline; gap: 10px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.paper .head b { font-family: "Barlow Condensed", sans-serif; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.paper .head .dim { color: #7a705c; }
.paper .head .made { margin-left: auto; color: #8a5a10; font-weight: 700; }
#sheet { flex: 1; min-height: 64px; display: flex; align-items: center; justify-content: center; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
#sheet svg { display: block; flex: none; }
#sheet .spelled { display: flex; gap: 8px; flex-wrap: wrap; font: 700 16px/1 "Barlow Condensed", sans-serif; padding: 8px; }
#sheet .spelled span { padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, .06); }
#sheet .spelled span.done { color: #2f9e55; } #sheet .spelled span.next { color: #fff; background: #d4891a; }
.paper.fresh { animation: pa-in .45s ease-out; }
.paper.done { box-shadow: 0 0 0 3px #f0cf85, 0 0 26px rgba(240, 207, 133, .8); }
@keyframes pa-in { from { transform: translateY(-12px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ the arena -- */
#arena { position: relative; overflow: hidden; min-height: 0; }
#ground, #field { position: absolute; inset: 0; display: block; }
#toasts { position: absolute; top: 10px; left: 12px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; z-index: 3; max-width: min(520px, 80%); }
.toast { background: rgba(14, 18, 28, .82); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: 5px 10px; font-size: 14px; transition: opacity .5s, transform .5s; animation: t-in .25s ease-out; }
.toast.out { opacity: 0; transform: translateX(-10px); }
.toast.big { font-size: 17px; border-left-color: var(--gold); }
.toast.hint { border-left-color: var(--dim); color: var(--soft); }
.toast.combo { border-left-color: var(--gold); } .toast.combo b { color: var(--gold2); }
.toast.used { border-left-color: #59607a; color: var(--dim); font-size: 13px; }
.toast.partial, .toast.bonus { border-left-color: var(--green); } .toast.partial b, .toast.bonus b { color: #9fe0b0; }
.toast.gold { border-left-color: var(--gold); }
.toast.short { border-left-color: #c07a1a; color: #f3c27a; }
.toast.danger { border-left-color: var(--red); } .toast.danger b { color: #ff9a8a; }
@keyframes t-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; background: rgba(18, 22, 34, .96); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); max-width: calc(100% - 24px); max-height: calc(100% - 16px); overflow-y: auto; }
.modal h2 { font-size: 34px; margin-bottom: 4px; }
.modal .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0 8px; }
.end.won h2 { color: var(--gold2); } .end.lost h2 { color: #ff8a7a; }
.stats { display: grid; grid-template-columns: auto auto; gap: 2px 18px; margin: 12px auto 0; width: max-content; text-align: left; }
.stats dt { color: var(--dim); } .stats dd { margin: 0; text-align: right; font-weight: 700; }

/* the draft (falls.css's cards, in this palette) */
#draft h3 { font-size: 28px; color: var(--gold2); }
#draft .cards { display: flex; gap: 12px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
#draft .card { position: relative; width: 190px; background: linear-gradient(#262e44, #1a2032); border: 2px solid var(--line); border-radius: 14px; padding: 26px 10px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .15s, border-color .15s; }
#draft .card:hover { border-color: var(--gold); }
#draft .card.sel { border-color: var(--gold2); transform: translateY(-6px); box-shadow: 0 0 22px rgba(240, 207, 133, .4); }
#draft .card.chosen { border-color: #9fe0b0; transform: scale(1.05); }
#draft .card .key { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #2a2010; font: 800 15px/1 "Barlow Condensed", sans-serif; padding: 5px 10px; border-radius: 999px; }
#draft .card .confirm { display: none; position: absolute; top: 10px; font-size: 11px; color: var(--gold2); }
#draft .card.sel .confirm { display: block; }
#draft .card .art { position: relative; height: 70px; display: flex; align-items: center; justify-content: center; }
#draft .card .art img { height: 64px; }
#draft .card .art img.who { position: absolute; right: -28px; bottom: -4px; height: 40px; }
#draft .card b { font-family: "Barlow Condensed", sans-serif; font-size: 20px; }
#draft .card .tier { display: flex; gap: 3px; }
#draft .card .tier i { width: 12px; height: 5px; border-radius: 3px; background: #3a4258; }
#draft .card .tier i.on { background: var(--gold); } #draft .card .tier i.now { background: var(--gold2); box-shadow: 0 0 6px var(--gold2); }
#draft .card .chg { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
#draft .card .chg .k { display: block; color: var(--dim); } #draft .card .chg .v { font-weight: 700; color: #9fe0b0; }

/* ------------------------------------------------------------------- the keys -- */
.keys { position: relative; height: 96px; background: #0b0c10; border-top: 3px solid #26304a; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.keys-off .keys { display: none; }
.keys i { position: absolute; top: 0; display: block; font-style: normal; cursor: pointer; }
.keys i.w { bottom: 0; background: linear-gradient(#f7f4ec, #e6e1d4 86%, #cfc8b6); border-right: 1px solid #a9a191; border-radius: 0 0 6px 6px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .08); z-index: 1; }
.keys i.b { height: 60%; background: linear-gradient(#2c2d33, #121317 80%, #050506); border-radius: 0 0 4px 4px; box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .06), 0 2px 3px rgba(0, 0, 0, .6); z-index: 2; }
.keys i s { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; text-decoration: none; font: 700 10px/1 Barlow, sans-serif; color: #b2a98f; }
.keys i.next.w { background: linear-gradient(#ffe48a, #f2c643 86%, #c99a24); }
.keys i.next.b { background: linear-gradient(#c8961f, #7a5a10 80%, #3d2c06); }
.keys i.down.w { background: linear-gradient(#bcd0ff, #8fb0ff); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .25); }
.keys i.down.b { background: linear-gradient(#4a62a8, #2a3a6e); }
.keys i.pick.b { background: linear-gradient(#e2b452, #a37a10 80%, #5b4208); box-shadow: 0 0 10px rgba(255, 211, 74, .55); }
.keys i.pick.armed.b { background: linear-gradient(#fff1b0, #ffd34a 70%, #c9971f); }
.keys i.pick::before { content: attr(data-pick); position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font: 800 12px/1 "Barlow Condensed", sans-serif; color: #fff; text-shadow: 0 1px 0 #000; }
#status { padding: 3px 12px; background: #0b0d14; font-size: 12px; }

/* ----------------------------------------------------------------- portrait -- */
/* the HUD in two rows that never wrap to a third (the gold's and the armies' digits growing had made it wrap, and the
   arena under it shrink, mid-round): gold, timer, armies, buttons; then the squad and the cards' meter */
#stage[data-orient="portrait"] #hud { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-rows: 30px 24px;
  grid-template-areas: "gold timer vs btns" "squad squad spoils spoils"; gap: 4px 8px; padding: 5px 8px; font-size: 12.5px; }
#stage[data-orient="portrait"] #hud > * { min-width: 0; white-space: nowrap; overflow: hidden; }
#stage[data-orient="portrait"] #hud .gold { grid-area: gold; } #stage[data-orient="portrait"] #hud .timer { grid-area: timer; }
#stage[data-orient="portrait"] #hud .vs { grid-area: vs; font-size: 16px; gap: 5px; justify-content: center; }
#stage[data-orient="portrait"] #hud .vs img { display: none; }
#stage[data-orient="portrait"] #hud .vs i { font-size: 8px; letter-spacing: 0; }
#stage[data-orient="portrait"] #hud .btns { grid-area: btns; margin-left: 0; gap: 4px; }
#stage[data-orient="portrait"] #hud .squad { grid-area: squad; align-items: center; }
#stage[data-orient="portrait"] #hud .spoils { grid-area: spoils; justify-content: flex-end; }
#stage[data-orient="portrait"] #hud .spoils > span:first-child { display: none; }
#stage[data-orient="portrait"] #hud .wave { display: none; }
#stage[data-orient="portrait"] #hud .btns button { padding: 1px 5px; font-size: 12px; }
#stage[data-orient="portrait"] #hud .gold span { display: none; }
#stage[data-orient="portrait"] #toasts { top: 42%; left: 50%; transform: translateX(-50%); align-items: center; max-width: 92%; }
#stage[data-orient="portrait"] .toast { font-size: 13px; padding: 3px 8px; }
#stage[data-orient="portrait"] #hud .gold b { font-size: 18px; min-width: 0; }
#stage[data-orient="portrait"] #hud .gold img { height: 22px; }
#stage[data-orient="portrait"] #hud .squad i { width: 15px; height: 20px; flex: none; }
#stage[data-orient="portrait"] #hud .spoils .track { width: 60px; }
#stage[data-orient="portrait"] #strip { min-height: 96px; padding: 4px 6px; }
#stage[data-orient="portrait"] .paper { min-width: 0; width: 100%; }
#stage[data-orient="portrait"] .keys { height: 76px; }
#stage[data-orient="portrait"] #draft .card { width: 150px; padding-top: 22px; }
#stage[data-orient="portrait"] #draft .card .art img { height: 48px; }
@media (max-width: 700px) {
  #hud .wave { display: none; }
  #strip .side { display: none; }
}
/* (the narrowest phones: the buildings' pips go, the buildings themselves being on the field right under them) */
@media (max-width: 380px) { #stage[data-orient="portrait"] #hud .vs i { display: none; } }
