/* Megalith on the iPad: the picture on the left (the stream's picture, with its status bar like
   the old shooters' bar along the bottom), the chat simulator on the right. Fills the screen
   exactly; nothing on the page scrolls (only the chat list, inside its own box). */
@font-face { font-family: 'Lato'; src: url('fonts/Lato-Bold.ttf') format('truetype'); font-weight: 700; font-display: block; }
:root {
  --bg: #07080a; --panel: #0e1013; --steel: #1b1f25; --steel2: #262b33; --line: #3a3f47;
  --ink: #ece6da; --muted: #b3aa9a; --amber: #ffb43c; --red: #ff4a3a; --gold: #ffd25a; --cyan: #6fe6ff;
  --sh: calc(var(--stageH, 760px) / 100);   /* one hundredth of the picture's height */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: Lato, -apple-system, sans-serif; font-weight: 700; -webkit-user-select: none; user-select: none; }
body { display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

/* one row when it fits, a second row when it does not (both Remove keys and Settings showing) */
header { flex: 0 0 auto; min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 16px; background: #0b0c0e; border-bottom: 2px solid var(--line); }
header h1 { margin: 0; font-size: 28px; letter-spacing: .18em; color: var(--amber); }
header .grow { flex: 1; }
header label { font-size: 20px; color: var(--muted); }
select { font: 700 20px Lato, sans-serif; color: var(--ink); background: var(--steel); border: 2px solid var(--line); border-radius: 8px; height: 44px; padding: 0 40px 0 12px; max-width: 280px; min-width: 0; flex: 0 1 auto;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M4 7l6 6 6-6' fill='none' stroke='%23ffb43c' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

.hlabel { font-size: 20px; color: var(--muted); margin-left: 6px; }
.hgroup { display: flex; align-items: center; gap: 10px; min-width: 0; }   /* a label and its controls, kept together */
#nameBox { font: 700 19px Lato, sans-serif; color: var(--ink); background: var(--steel); border: 2px solid var(--line); border-radius: 8px; height: 44px; padding: 0 10px; width: 160px; min-width: 90px; flex: 0 1 160px; -webkit-user-select: text; user-select: text; }
.hbtn { height: 44px; padding: 0 14px; font-size: 19px; flex: 0 0 auto; }
main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 460px; }

/* --- the picture --- */
#stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #000; }
#view { flex: 1; min-height: 0; position: relative; overflow: hidden; }
/* the judges' picture-in-picture, bottom left inside the 5% margin (they look to their left, into the picture); the picture itself is drawn
   into this box by the arena, this is its frame and name */
#pip { position: absolute; left: 5%; bottom: 5%; width: 30%; aspect-ratio: 4 / 3; border: calc(.5 * var(--sh)) solid var(--gold); border-radius: calc(.8 * var(--sh)); box-shadow: 0 0 0 2px #000, 0 calc(.6 * var(--sh)) calc(2 * var(--sh)) rgba(0,0,0,.7); pointer-events: none; visibility: hidden; }
#pip.on { visibility: visible; }
#pip span { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: calc(.4 * var(--sh)); text-align: center; font-size: max(14px, calc(2.4 * var(--sh))); color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 6px #000; white-space: nowrap; }
/* the replay of a big hit: big, in the middle, below the company's name; drawn into this box by
   the arena; the punch words step aside while it plays */
#replay { position: absolute; left: 50%; top: 22%; height: 54%; aspect-ratio: 16 / 10; max-width: 80%; transform: translateX(-50%); border: calc(.6 * var(--sh)) solid var(--gold); border-radius: calc(.8 * var(--sh)); box-shadow: 0 0 0 2px #000, 0 calc(.8 * var(--sh)) calc(3 * var(--sh)) rgba(0,0,0,.8); pointer-events: none; visibility: hidden; }
#replay.on { visibility: visible; }
#replay.frozen { border-color: #fff; box-shadow: 0 0 0 2px #000, 0 0 calc(3 * var(--sh)) rgba(255,255,255,.7); }   /* the freeze on the blow */
#replay span { position: absolute; left: calc(1.2 * var(--sh)); top: calc(1 * var(--sh)); font-size: max(16px, calc(3.4 * var(--sh))); color: var(--gold); letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 2px 0 #000, 0 0 8px #000; }
#stage:has(#replay.on) #punch { visibility: hidden; }
#top { position: absolute; left: 5%; right: 5%; top: calc(4 * var(--sh)); pointer-events: none; text-align: center; }
#company { font-size: calc(6 * var(--sh)); line-height: 1.15; white-space: nowrap; color: #fff; text-shadow: 0 0 6px #000, 0 2px 0 #000, 0 0 18px rgba(0,0,0,.9); letter-spacing: .02em; }
#health { display: flex; align-items: center; gap: calc(1.4 * var(--sh)); margin-top: calc(1 * var(--sh)); }
#healthBar { position: relative; flex: 1; height: calc(2.6 * var(--sh)); background: rgba(0,0,0,.7); border: 2px solid #000; outline: 2px solid rgba(255,255,255,.25); overflow: hidden; }
#healthBar i, #healthBar b { position: absolute; left: 0; top: 0; bottom: 0; display: block; }
#healthBar i { background: repeating-linear-gradient(90deg, #d42a1e 0 10px, #a81e14 10px 12px); transition: width .25s linear; z-index: 2; }
#healthBar b { background: #fff3c0; transition: width 1.2s ease-in .4s; z-index: 1; }
#healthBar.heal { animation: heal 1.2s ease-out; }
@keyframes heal { 0%, 40% { outline-color: #7dff8a; box-shadow: 0 0 calc(2 * var(--sh)) #7dff8a; } 100% { outline-color: rgba(255,255,255,.25); box-shadow: none; } }
#healthNum { flex: 0 0 auto; min-width: 5.6em; text-align: right; font-size: calc(3.2 * var(--sh)); font-variant-numeric: tabular-nums; text-shadow: 0 0 6px #000, 0 2px 0 #000; }

#punch { position: absolute; left: 5%; right: 5%; top: 38%; text-align: center; pointer-events: none; visibility: hidden; }
#punch.on { visibility: visible; animation: punch .35s ease-out; }
@keyframes punch { 0% { transform: scale(1.15); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
#punchBig { font-size: calc(8 * var(--sh)); line-height: 1.1; white-space: nowrap; color: var(--gold); -webkit-text-stroke: 2px #000; text-shadow: 0 4px 0 #000, 0 0 24px rgba(0,0,0,.8); }
#punchSmall { font-size: calc(4.4 * var(--sh)); line-height: 1.2; white-space: nowrap; color: #fff; -webkit-text-stroke: 1px #000; text-shadow: 0 3px 0 #000; min-height: 1.2em; }

/* the fighters' cards under the picture, as in MyAdventure: a coloured top edge, a dot of the
   same colour, the name, what they fight with, and their health */
#party { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(1 * var(--sh)); padding: calc(1 * var(--sh)); background: #0b0c0e; }
.fcard { background: var(--panel); border: calc(.25 * var(--sh)) solid var(--line); border-top-width: calc(.7 * var(--sh)); border-radius: calc(1.2 * var(--sh)); padding: calc(.7 * var(--sh)) calc(1 * var(--sh)); display: flex; flex-direction: column; gap: calc(.4 * var(--sh)); min-width: 0; }
.fcard .top { display: flex; align-items: center; gap: calc(.8 * var(--sh)); min-width: 0; }
.fcard .swatch { flex: 0 0 auto; width: calc(2.4 * var(--sh)); height: calc(2.4 * var(--sh)); border-radius: 50%; border: calc(.3 * var(--sh)) solid #0c0d10; }
.fcard .name { font-size: max(17px, calc(2.6 * var(--sh))); flex: 0 0 auto; }
.fcard .strat { font-size: max(16px, calc(2.4 * var(--sh))); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fcard .mid { display: flex; align-items: baseline; justify-content: space-between; gap: calc(.8 * var(--sh)); min-width: 0; }
.fcard .with { font-size: max(15px, calc(2 * var(--sh))); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fcard .track { height: calc(1.4 * var(--sh)); border-radius: calc(.7 * var(--sh)); background: #0d0e12; border: 1px solid var(--line); overflow: hidden; }
.fcard .fill { height: 100%; border-radius: calc(.7 * var(--sh)); transition: width .6s ease; }
.fcard .num { flex: 0 0 auto; font-size: max(15px, calc(2 * var(--sh))); font-variant-numeric: tabular-nums; text-align: right; }
.fcard.down { opacity: .7; }

/* the status bar along the bottom, part of the picture */
#status { flex: 0 0 auto; height: calc(15 * var(--sh)); display: flex; flex-direction: column; justify-content: center; gap: calc(1 * var(--sh)); padding: 0 calc(3 * var(--sh));
  background: linear-gradient(#2a2620, #16130f); border-top: 3px solid #4a4236; box-shadow: inset 0 3px 0 #0006; }
#status .row { display: flex; align-items: center; justify-content: space-between; gap: calc(2 * var(--sh)); min-width: 0; }
#phase { font-size: calc(4 * var(--sh)); color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#clock { flex: 0 0 auto; width: 3.4em; text-align: right; font-size: calc(4 * var(--sh)); font-variant-numeric: tabular-nums; color: #fff; }
#picks { font-size: calc(3.1 * var(--sh)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; color: var(--ink); }
#meter { flex: 0 0 auto; display: flex; align-items: center; gap: calc(1 * var(--sh)); font-size: calc(3 * var(--sh)); font-variant-numeric: tabular-nums; }
#meter .count { width: 2.2em; text-align: center; }
#leers { color: var(--red); } #cheers { color: var(--gold); }
#meterBar { position: relative; width: calc(18 * var(--sh)); height: calc(2.4 * var(--sh)); background: #000; border: 2px solid #5a5040; overflow: hidden; }
#meterBar b { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #fff; transform: translateX(-1px); z-index: 2; }
#meterFill { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; transition: all .25s; }

/* --- the chat simulator --- */
aside { min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; background: var(--panel); border-left: 2px solid var(--line); }
aside section { flex: 0 0 auto; }
aside section.chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.arms h2.gap { margin-top: 10px; }
.grid5, .grid4, .grid2 { display: grid; gap: 8px; }
.grid5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
button { font: 700 19px Lato, sans-serif; color: var(--ink); background: linear-gradient(var(--steel2), var(--steel)); border: 2px solid var(--line); border-bottom-color: #0a0b0d; border-radius: 8px; height: 50px; padding: 0 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; touch-action: manipulation; }
button:active, button.hit { background: var(--amber); color: #120c02; border-color: var(--amber); }
.speaker { height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 2px; }
.speaker { border-top: 6px solid var(--pc); }   /* each fighter's colour, as in the picture */
.speaker .who { font-size: 21px; }
.speaker .what { font-size: 15px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.speaker.on { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan) inset; }
.speaker.on .what { color: var(--cyan); }
.speaker.fighting .what { color: var(--gold); }
.speaker.flat .what { color: var(--red); }
#crowdKeys button { height: 58px; font-size: 22px; }
#crowdKeys .cheer { color: var(--gold); } #crowdKeys .leer { color: var(--red); }
#crowdKeys .cheer:active, #crowdKeys .cheer.hit { background: var(--gold); color: #120c02; }
#crowdKeys .leer:active, #crowdKeys .leer.hit { background: var(--red); color: #120c02; }
#chat { flex: 1; min-height: 0; overflow-y: auto; background: #08090b; border: 2px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 18px; line-height: 1.3; -webkit-user-select: text; user-select: text; }
#chat .line { display: flex; gap: 8px; }
#chat .from { flex: 0 0 auto; color: var(--cyan); }
#chat .said { flex: 0 0 auto; color: var(--ink); }
#chat .reply { color: var(--muted); min-width: 0; }
#chat .reply.no { color: #ff8a7a; }
#chat > :first-child { margin-top: auto; }

/* upright: the picture on top, the simulator below in two columns */
@media (max-aspect-ratio: 1/1) {
  /* the header's controls wrap onto a second row rather than run off the screen */
  header { flex: 0 0 auto; flex-wrap: wrap; row-gap: 8px; padding: 6px 16px; }
  header .grow { flex-basis: 20px; }
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52% 48%; }
  aside { border-left: 0; border-top: 2px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); column-gap: 16px; row-gap: 10px; }
  aside > section { grid-column: 1; }
  aside > section:first-child { grid-column: 1 / span 2; }
  aside > section.arms { grid-column: 2; grid-row: 2 / span 2; }
  aside > section.arms .grid4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* online: the host's settings key, and the sign-in in place of the keys for anyone else */
a.button { display: inline-flex; align-items: center; justify-content: center; font: 700 19px Lato, sans-serif; color: var(--ink); text-decoration: none; background: linear-gradient(var(--steel2), var(--steel)); border: 2px solid var(--line); border-radius: 8px; height: 50px; padding: 0 16px; white-space: nowrap; }
a.hbtn { height: 44px; }
.online { display: none !important; }
html.isOnline .online { display: inline-flex !important; }
body.guest header .hgroup, body.guest #settingsLink { display: none !important; }
#panel { position: relative; }
#signin { position: absolute; inset: 0; z-index: 5; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; }
#signin p { margin: 0; font-size: 22px; line-height: 1.35; color: var(--ink); }
.fcard .holder { font-size: max(15px, calc(2.2 * var(--sh))); color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.fcard .holder.idle { color: var(--muted); }
.chathead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.chathead h2 { margin: 0; }
a.button.small { height: 40px; font-size: 18px; padding: 0 14px; }
