/* The original console was 700 x 300 pixels. --u is one of those pixels, so
   calc(32 * var(--u)) is 32 original pixels at whatever size fits the window.
   The window is filled whatever its size, so the bitmaps are scaled smoothly by a fraction. */
:root {
  --fit: min(100vw / 700, 100svh / 300);
  --u: var(--fit);
  --ink: #1b1712;
  --parchment: #efe3c4;
  --panel: #d8c79b;
  --line: #6b5532;
  --wood: #4a3520;
  --gold: #ffd35c;
  --blue: #16356e;
  --red: #a3201c;
  --green: #2c6b2f;
  --purple: #6a47d8;
  --lavender: #b9a3f0;
  --navy: #1d2194;
  --amber: #e8a925;
  --serif: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0e0a24;
  color: #fff;
  font-family: Verdana, Geneva, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#stage {
  position: relative;
  width: calc(700 * var(--u));
  height: calc(300 * var(--u));
  margin: 0;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(#202a86 0, #5667d0 45%, #8da4ea 60%, #2d8a3a 60.4%, #1f6a2c 100%);
  font-size: calc(11 * var(--u));
  line-height: 1.25;
}

/* The scenery behind the menus, then the console's frame over it. Everything else is above both. */
#scene { position: absolute; inset: 0; width: 100%; height: 100%; }
#console { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
html.art #console { background: url('/assets/gfx/generic/console_bg.png') 0 0 / calc(700 * var(--u)) calc(300 * var(--u)); }

/* The frame drawn in CSS, for the screens before sign-in, which cannot load any artwork. */
html:not(.art) #console { border: calc(3 * var(--u)) solid var(--lavender); }
html:not(.art) #console::before { content: ''; position: absolute; left: 0; right: 0; top: calc(60 * var(--u)); height: calc(5 * var(--u)); background: var(--purple); border-top: calc(1 * var(--u)) solid #4a2fb8; }
html:not(.art) #console::after { content: ''; position: absolute; left: calc(223 * var(--u)); top: 0; width: calc(3 * var(--u)); height: calc(60 * var(--u)); background: var(--purple); }

#strip {
  position: absolute;
  z-index: 2;
  left: calc(3 * var(--u));
  top: calc(3 * var(--u));
  width: calc(694 * var(--u));
  height: calc(60 * var(--u));
}
#brand {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(223 * var(--u));
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5a2cb8, #a86cf0);
  font: italic 900 calc(30 * var(--u)) / 1 Impact, 'Arial Black', var(--serif);
  color: #ffc21a;
  letter-spacing: calc(1 * var(--u));
  -webkit-text-stroke: calc(1 * var(--u)) #2a0f5c;
  text-shadow: calc(2 * var(--u)) calc(2 * var(--u)) 0 #2a0f5c;
}
#brand span { font-size: calc(17 * var(--u)); color: #fff2a8; letter-spacing: calc(5 * var(--u)); }
html.art #brand { background: none; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; align-items: flex-start; justify-content: flex-start; white-space: nowrap; }

#home { position: absolute; left: calc(187 * var(--u)); top: calc(17 * var(--u)); width: calc(26 * var(--u)); height: calc(26 * var(--u)); border: 0; padding: 0; background: url('/assets/gfx/generic/homebutt.png') 0 0 / calc(26 * var(--u)) calc(78 * var(--u)); cursor: pointer; }
#home:hover { background-position: 0 calc(-26 * var(--u)); }
#home:active { background-position: 0 calc(-52 * var(--u)); }

#crest { position: absolute; left: calc(231 * var(--u)); top: 0; width: calc(60 * var(--u)); height: calc(60 * var(--u)); background: center / contain no-repeat; }
#status {
  position: absolute;
  left: calc(298 * var(--u));
  top: calc(13 * var(--u));
  width: calc(392 * var(--u));
  height: calc(34 * var(--u));
  padding: calc(2 * var(--u)) calc(10 * var(--u));
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  font-size: calc(10.5 * var(--u));
  color: #fff;
  background: radial-gradient(ellipse at 50% 50%, #3035c2, #1a1f8e);
  border: calc(1.5 * var(--u)) solid var(--amber);
  border-radius: calc(5 * var(--u));
}
#status:empty { display: none; }
#status b { display: block; overflow: hidden; text-overflow: ellipsis; font: bold calc(13 * var(--u)) var(--serif); color: var(--gold); }
#status i { display: none; }

#title {
  position: absolute;
  z-index: 3;
  top: calc(68 * var(--u));
  left: calc(70 * var(--u));
  right: calc(70 * var(--u));
  height: calc(28 * var(--u));
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font: bold calc(20 * var(--u)) var(--serif);
  color: var(--gold);
  text-shadow: calc(1 * var(--u)) calc(1 * var(--u)) 0 #000, calc(-1 * var(--u)) calc(-1 * var(--u)) 0 #000, calc(1 * var(--u)) calc(-1 * var(--u)) 0 #000, calc(-1 * var(--u)) calc(1 * var(--u)) 0 #000;
  outline: none;
}

#screen { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#screen > * { pointer-events: auto; }

#message {
  position: absolute;
  z-index: 3;
  bottom: calc(4 * var(--u));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(560 * var(--u));
  margin: 0;
  text-align: center;
  color: var(--gold);
  pointer-events: none;
}
#message.bad { color: #ffc2b8; }
#message:not(:empty) { background: radial-gradient(ellipse at 50% 50%, #3035c2, #1a1f8e); border: calc(1.5 * var(--u)) solid var(--amber); border-radius: calc(4 * var(--u)); padding: calc(2 * var(--u)); }

/* Everything placed with at() in dom.js. */
.at { position: absolute; margin: 0; }

/* Mr Zen and what he says: the screen asks for him with `zen`. */
#zen { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#zen-man { position: absolute; left: calc(6 * var(--u)); top: calc(189 * var(--u)); width: calc(98 * var(--u)); height: calc(107 * var(--u)); background: url('/assets/gfx/menu/mrzenstand.png') 0 0 / 100% 100%; }
#zen-says {
  position: absolute;
  margin: 0;
  padding: calc(20 * var(--u)) calc(14 * var(--u)) calc(8 * var(--u)) calc(14 * var(--u));
  border: calc(1 * var(--u)) solid transparent;
  border-image: url('/assets/gfx/menu/speech.png') 20 14 14 40 fill / calc(20 * var(--u)) calc(14 * var(--u)) calc(14 * var(--u)) calc(40 * var(--u)) stretch;
  color: #14143c;
  font-size: calc(10.5 * var(--u));
  line-height: 1.2;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }
button { padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: calc(2 * var(--u)) solid #fff; outline-offset: calc(1 * var(--u)); }
[hidden] { display: none !important; }

/* The Back and Next flags. */
.flag {
  position: absolute;
  z-index: 3;
  width: calc(66 * var(--u));
  height: calc(35 * var(--u));
  border: 0;
  border-top: calc(3 * var(--u)) solid #8a4a2a;
  border-radius: 0 0 calc(8 * var(--u)) calc(8 * var(--u));
  background: linear-gradient(90deg, #b4130f, #e31b17 30%, #c8140f 60%, #e31b17 85%, #b4130f);
  color: #ffe600;
  font: bold calc(13 * var(--u)) Impact, 'Arial Black', var(--serif);
  letter-spacing: calc(1 * var(--u));
  text-shadow: calc(1 * var(--u)) calc(1 * var(--u)) 0 #5a0705;
  
}
#back { left: 0; top: calc(70 * var(--u)); }
#next { right: 0; top: calc(260 * var(--u)); }
.flag:hover:not(:disabled) { filter: brightness(1.15); }
.flag:disabled { filter: grayscale(0.6) brightness(0.65); }
html.art .flag:not(.custom) {
  border: 0;
  border-radius: 0;
  background: url('/assets/gfx/menu/backflag.png') 0 0 / calc(66 * var(--u)) calc(105 * var(--u));
  color: transparent;
  text-shadow: none;
  filter: none;
}
html.art #next:not(.custom) { background-image: url('/assets/gfx/menu/nextflag.png'); }
html.art .flag:not(.custom):hover:not(:disabled) { background-position: 0 calc(-35 * var(--u)); filter: brightness(1.12); }
html.art .flag:not(.custom):active:not(:disabled) { background-position: 0 calc(-70 * var(--u)); }
html.art .flag:not(.custom):disabled { filter: grayscale(0.7) brightness(0.6); }

/* Text drawn in one of the original fonts over the real text, which stays for screen readers. */
.has-art { color: transparent !important; text-shadow: none !important; -webkit-text-stroke: 0 !important; }
.has-art:not(.at, .flag, #title) { position: relative; }
.bt { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.bt.left { left: calc(8 * var(--u)); transform: translate(0, -50%); }

/* Blade buttons. */
.blade {
  padding: 0 calc(10 * var(--u));
  color: #fff4c0;
  font-weight: bold;
  text-shadow: 0 calc(1 * var(--u)) 0 #0a1450;
  background: linear-gradient(#5a8be0, #2a56a8 50%, #1f3f86);
  border: calc(1.5 * var(--u)) solid #8fb0f0;
  border-radius: calc(14 * var(--u)) / 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blade:hover:not(:disabled) { background: linear-gradient(#d49a62, #96602f 50%, #754619); border-color: #f0c490; }
.blade[aria-pressed='true'], .blade[aria-checked='true'] { background: linear-gradient(#ffe28a, #e8a925 50%, #c27d10); border-color: #fff4c0; color: #2a1800; text-shadow: none; }
.blade:active:not(:disabled) { background: linear-gradient(#1c3a80, #16306c); }
.blade:disabled { opacity: 0.5; filter: grayscale(0.5); }
html.art .blade {
  padding: 0;
  background: none;
  border: solid transparent;
  border-width: 0 calc(14 * var(--u));
  border-image: var(--blade0) 0 14 fill / 0 calc(14 * var(--u)) / 0 stretch;
  overflow: visible;
  border-radius: 0;
  text-shadow: none;
  
}
html.art .blade:hover:not(:disabled) { background: none; filter: brightness(1.3); }
html.art .blade[aria-pressed='true'], html.art .blade[aria-checked='true'] { background: none; border-image-source: var(--blade1); color: #fff; text-shadow: 0 calc(1 * var(--u)) 0 #000; filter: none; }
html.art .blade:active:not(:disabled) { background: none; border-image-source: var(--blade2); filter: none; }
html.art .blade:disabled { opacity: 0.55; filter: grayscale(0.7); }

input:not([type='checkbox'], [type='radio']) {
  padding: 0 calc(4 * var(--u));
  background: #fff;
  color: #111;
  border: calc(1 * var(--u)) solid #7a7a7a;
  box-shadow: inset calc(1 * var(--u)) calc(1 * var(--u)) 0 #c4c4c4;
  border-radius: 0;
}
input[readonly] { background: #eceff8; }
label { font-weight: bold; text-shadow: 0 calc(1 * var(--u)) 0 #000; }

/* The blue panels the original put behind its text. */
.panel {
  background: radial-gradient(ellipse at 50% 50%, #3035c2 0%, #232aa8 55%, #1a1f8e 100%);
  color: #fff;
  border: calc(1.5 * var(--u)) solid var(--amber);
  border-radius: calc(5 * var(--u));
}
.blue { color: var(--blue); font-weight: bold; }
.right { text-align: right; }
.centre { text-align: center; }

/* A scrolling box of rows, each a button. A black arrow on each side points at the chosen one. */
.list {
  overflow-y: auto;
  background: #fff;
  color: #111;
  border: calc(1 * var(--u)) solid #7a7a7a;
  scrollbar-width: thin;
  scrollbar-color: #2a56a8 #e7ecfa;
}
.list button { position: relative; display: block; width: 100%; padding: calc(4 * var(--u)) calc(12 * var(--u)); text-align: left; background: none; color: #111; border: 0; border-bottom: calc(1 * var(--u)) solid #d5dbef; border-radius: 0; }
.list button:hover:not(:disabled) { background: #e7eeff; }
.list button[aria-pressed='true'] { background: #cddcff; }
.list button[aria-pressed='true']::before, .list button[aria-pressed='true']::after {
  content: '';
  position: absolute;
  top: 50%;
  margin-top: calc(-4 * var(--u));
  border: calc(4 * var(--u)) solid transparent;
}
.list button[aria-pressed='true']::before { left: 0; border-left: calc(5 * var(--u)) solid #000; border-right-width: 0; }
.list button[aria-pressed='true']::after { right: 0; border-right: calc(5 * var(--u)) solid #000; border-left-width: 0; }
.list p { margin: 0; padding: calc(6 * var(--u)); }

/* Round yellow arrows and the red cross, from the original sheets. */
.sprite { border: 0; padding: 0; background: none; background-repeat: no-repeat; }
.sprite:hover:not(:disabled) { filter: brightness(1.2); }
.sprite:disabled { opacity: 0.4; }
html:not(.art) .sprite { background: var(--amber); border: calc(1.5 * var(--u)) solid #fff4c0; border-radius: 50%; color: #2a1800; font-weight: bold; }
.arrow-left, .arrow-right, .arrow-up, .arrow-down { width: calc(25 * var(--u)); height: calc(25 * var(--u)); background-size: calc(25 * var(--u)) calc(75 * var(--u)); }
html.art .arrow-left { background-image: url('/assets/gfx/menu/leftarrow.png'); }
html.art .arrow-right { background-image: url('/assets/gfx/menu/rightarrow.png'); }
html.art .arrow-up { background-image: url('/assets/gfx/menu/uparrow.png'); }
html.art .arrow-down { background-image: url('/assets/gfx/menu/downarrow.png'); }
html.art .sprite:active:not(:disabled) { background-position: 0 calc(-25 * var(--u)); }
html.art .sprite { color: transparent; }

#stage.busy { cursor: progress; }
#turn { display: none; text-align: center; }
@media (orientation: portrait) and (max-width: 600px) { #turn { display: block; } }
