/* The page takes its look from the game: the sky blue of its boards, white
   lettering with a navy edge, and buttons like the ones on its screens. */
:root {
  --navy: #0a3c86;
  --deep: #062a63;
  --sky: #17b3ff;
  --glass: rgba(18, 112, 206, .92);
  --ink: #ffffff;
  --gold: #ffe12e;
  --warn: #ffd0d8;
  --game: "PingFang SC", "Microsoft YaHei", "Heiti SC", "Noto Sans SC", sans-serif;
}

html, body {
  margin: 0;
  height: 100%;
  background: #0b2c5c;
  color: var(--ink);
  font-family: var(--game);
  overflow: hidden;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The game's picture is 800 by 600; it is shown as large as the window allows. */
#screen, .door {
  width: min(100vw, 133.333vh);
  height: min(75vw, 100vh);
}

#screen {
  background: #000;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

/* Where what is typed goes. Not seen: the game draws the text itself. */
#typing {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 2px;
  height: 1.2em;
  padding: 0;
  border: 0;
  outline: 0;
  opacity: 0;
  pointer-events: none;
  font-size: 16px;
}

/* ------------------------------------------------------------------ door */
/* Positions are in the dots of the 800 by 600 picture: --x and --y. */
.door {
  position: relative;
  container-type: size;
  background: url("login.png") center / 100% 100% no-repeat;
  image-rendering: auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, .45);
}

.door > * {
  position: absolute;
  left: calc(var(--x) / 8 * 1cqw);
  top: calc(var(--y) / 6 * 1cqh);
  margin: 0;
  box-sizing: border-box;
}

#caption-username { --x: 268; --y: 472; }
#username { --x: 326; --y: 472; }
#caption-password { --x: 268; --y: 506; }
#password { --x: 326; --y: 506; }
#enter { --x: 468; --y: 474; }
/* Under the fields: whether this browser remembers the account's name. The
   password field ends at about 524 (2.3cqw high); this keeps clear of it. */
#remember-line { --x: 326; --y: 527; }
.tick {
  display: flex;
  align-items: center;
  gap: .5cqw;
  font-size: 1.45cqw;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy);
}
.tick input { width: 1.5cqw; height: 1.5cqw; margin: 0; accent-color: var(--gold); cursor: pointer; }

/* The three small buttons: one row, in the middle of the glass panel. */
#door-buttons {
  --x: 272; --y: 542;
  width: calc(256 / 8 * 1cqw);
  display: flex;
  justify-content: center;
  gap: 1.2cqw;
}
#door-buttons .knob { position: static; min-width: 0; }
#progress { --x: 292; --y: 545; }

.caption {
  width: 7cqw;
  height: 2.4cqw;
  font-size: 1.9cqw;
  font-weight: 800;
  line-height: 2.4cqw;
  text-align: right;
  color: var(--ink);
  text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy),
               1px 1px 0 var(--navy), 0 0 .5cqw rgba(0, 60, 150, .8);
}

.field {
  width: 17cqw;
  height: 2.3cqw;
  padding: 0 .8cqw;
  border: 0;
  border-radius: .6cqw;
  background: rgba(255, 255, 255, .88);
  color: #0a2a5c;
  font: 700 1.7cqw/2.3cqw var(--game);
  box-shadow: inset 0 .15cqw .3cqw rgba(0, 40, 110, .35);
}

/* The ring of the field in use is drawn inside it: one outside would reach
   over what lies under the field. */
.field:focus {
  outline: none;
  box-shadow: inset 0 0 0 .25cqw var(--gold);
  background: #fff;
}

.knob {
  min-width: 7cqw;
  height: 4cqw;
  padding: 0 1.1cqw;
  border: .25cqw solid var(--navy);
  border-radius: 1.2cqw;
  background: linear-gradient(#bff0ff 0%, #5fcbff 45%, #1693e8 55%, #0f7bd6 100%);
  color: var(--ink);
  font: 800 1.8cqw/1 var(--game);
  white-space: nowrap;
  text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy);
  box-shadow: 0 .3cqw 0 var(--deep), inset 0 .2cqw 0 rgba(255, 255, 255, .7);
  cursor: pointer;
}

.knob:hover { filter: brightness(1.08) saturate(1.1); }
.knob:active { transform: translateY(.25cqw); box-shadow: 0 .05cqw 0 var(--deep); }
.knob:focus-visible { outline: .3cqw solid var(--gold); outline-offset: .2cqw; }
.knob:disabled { filter: grayscale(.7) brightness(.85); cursor: default; }

.knob-ok {
  min-width: 6.8cqw;
  height: 5.6cqw;
  font-size: 2.2cqw;
  background: linear-gradient(#fff6b8 0%, #ffe12e 45%, #ffb400 55%, #ff9800 100%);
  border-color: #7a3c00;
  text-shadow: -1px -1px 0 #7a3c00, 1px -1px 0 #7a3c00, -1px 1px 0 #7a3c00, 1px 1px 0 #7a3c00;
  box-shadow: 0 .3cqw 0 #5a2c00, inset 0 .2cqw 0 rgba(255, 255, 255, .7);
}

.bar {
  width: 27cqw;
  height: 1.6cqw;
  border: .2cqw solid var(--navy);
  border-radius: 1cqw;
  background: rgba(255, 255, 255, .8);
  overflow: hidden;
}

.bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(#fff6b8, #ffb400);
  transition: width .2s;
}

#notice {
  left: 0;
  right: 0;
  top: calc(580 / 6 * 1cqh);
  font-size: 1.8cqw;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy),
               0 0 .6cqw var(--navy);
}

#notice.warn { color: var(--warn); }

/* ------------------------------------------------------ over the game */
#loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(70vw, 360px);
  padding: 20px 26px;
  border: 3px solid var(--navy);
  border-radius: 16px;
  background: var(--glass);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .5);
  text-align: center;
  pointer-events: none;
}

#loading p {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 1px 0 var(--navy);
}

#loading .hint {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 500;
}

#loading progress {
  width: 100%;
  height: 12px;
  accent-color: var(--gold);
}

/* The way to the key settings while playing: small, in the corner of the
   logo, where the game shows nothing to click. */
.corner {
  position: fixed;
  left: 6px;
  top: 6px;
  z-index: 3;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: linear-gradient(#bff0ff, #1693e8);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  opacity: .55;
  cursor: pointer;
}

.corner:hover, .corner:focus-visible { opacity: 1; }

/* ------------------------------------------------------------ the board */
.board {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 18, 45, .55);
}

.board-in {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 16px 20px 18px;
  border: 3px solid var(--navy);
  border-radius: 18px;
  background: linear-gradient(#35c3ff 0, #1d8fe0 70px, #1479cf 100%);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .6);
  box-sizing: border-box;
}

.board h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  text-shadow: -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy), 2px 2px 0 var(--navy);
}

.board-lead { margin: 0; font-size: 14px; line-height: 1.6; }
.board-lead.small { font-size: 12.5px; opacity: .92; }

.keys-scroll {
  overflow: auto;
  border-radius: 10px;
  background: rgba(4, 38, 96, .55);
}

.board table { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th, .board td { padding: 6px 10px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.board thead th { position: sticky; top: 0; background: #0b3f8f; font-size: 12.5px; font-weight: 700; }
.board tbody th { font-weight: 700; white-space: nowrap; }

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 7px;
  border: 1px solid var(--navy);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #eaf6ff;
  color: #0a2a5c;
  font: 700 13px/1.5 var(--game);
  text-align: center;
}

.pick {
  min-width: 6.5em;
  padding: 4px 10px;
  border: 2px solid var(--navy);
  border-radius: 8px;
  background: #eaf6ff;
  color: #0a2a5c;
  font: 700 13px/1.4 var(--game);
  cursor: pointer;
}

.pick.waiting { background: var(--gold); }
.pick.none { color: #5b7aa8; font-weight: 500; }
.pick:focus-visible { outline: 3px solid var(--gold); }

.board-buttons { display: flex; justify-content: center; gap: 14px; }

/* Registering: captions left, fields right, one row each. */
.join-in {
  width: min(460px, 100%);
  grid-template-rows: none;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 14px;
}
.join-in h2, .join-in .span { grid-column: 1 / -1; }
.join-in .board-lead.small { margin-top: -4px; }
.line { font-size: 15px; font-weight: 800; text-align: right; white-space: nowrap;
        text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy); }
.entry {
  height: 34px;
  padding: 0 10px;
  border: 2px solid var(--navy);
  border-radius: 8px;
  background: #fff;
  color: #0a2a5c;
  font: 700 16px/30px var(--game);
  box-sizing: border-box;
  min-width: 0;
}
.entry:focus { outline: 3px solid var(--gold); }
/* Registration open to all: no invitation code is asked for. */
.join-in.open .invite { display: none; }
#join-notice { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 800; text-align: center; }
#join-notice.warn { color: var(--warn); }
/* Prepaid cards. In the game the player is known: no account is asked for. */
.charge-shop { margin: 0; display: flex; justify-content: center; align-items: center; min-height: 38px; }
.charge-shop .knob { display: inline-grid; place-items: center; padding: 0 18px; text-decoration: none; }
#charge-form.signed-in .out { display: none; }
#charge-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
#charge-notice { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 800; text-align: center; }
#charge-notice.warn { color: var(--warn); }
#charge-notice.done { color: var(--gold); }

/* Back to logging in: why, and whether the server is still awaited. */
.dropped-in { width: min(380px, 100%); grid-template-rows: none; text-align: center; }
.dropped-in .board-lead { font-size: 15px; font-weight: 700; }
.board .knob { height: 38px; min-width: 96px; font-size: 16px; border-width: 3px; border-radius: 12px; }

#status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--ink);
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}

@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
}

[hidden] {
  display: none !important;
}
