/* Mirrors the game's UI (frontend/src/ui/): the resting backdrop colour (colors.backdrop), Bubblegum Sans,
   white boxes with a black border that shrink on press, black dim behind menus. The game is mobile, so touch only, nothing on hover. */
@font-face { font-family: "Bubblegum Sans"; src: url("/ui/BubblegumSans-Regular.ttf") format("truetype"); }
:root {
  --ink: #000;
  --night: #2f3447;
  --on-night: #fff;
  --box: #fff;
  --dim: rgba(0, 0, 0, 0.55);
  --line: 2px;
  --font-xl: clamp(40px, 6.4vh, 69px);
  --font-m: clamp(18px, 3.4vh, 36px);
  --font-s: clamp(16px, 2.5vh, 27px);
  --font-xs: clamp(14px, 2.2vh, 24px);
  --button-w: clamp(200px, 20vw, 400px);
  --button-h: clamp(48px, 10vh, 108px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--on-night);
  font: var(--font-s) / 1.3 "Bubblegum Sans", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, textarea, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.box { background: var(--box); border: var(--line) solid var(--ink); color: var(--ink); }
.button {
  background: var(--box); border: var(--line) solid var(--ink); border-radius: 0;
  font-size: var(--font-m); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink);
}
.button:active { transform: scale(0.95); }
.button:disabled { opacity: 0.5; transform: none; cursor: default; }
.button.small { font-size: var(--font-s); padding: 0.3em 1em; }

main { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vh; padding: 16px; }
h1 { margin: 0 0 2vh; font-size: var(--font-xl); font-weight: normal; }
#menu, #install { display: flex; flex-direction: column; align-items: center; gap: 2.2vh; }
#menu .button, #install .button { width: var(--button-w); height: var(--button-h); }
#install-skip { color: var(--on-night); }
#status { width: var(--button-w); padding: 0.4em 0.8em; font-size: var(--font-xs); text-align: center; cursor: pointer; }
.message { padding: 0.8em 1.2em; font-size: var(--font-s); text-align: center; max-width: 36em; }

.overlay { position: fixed; inset: 0; z-index: 10; background: var(--dim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.popup { width: min(900px, 100%); max-height: 100%; display: flex; flex-direction: column; }
.popup header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: var(--line) solid var(--ink); }
.popup h2 { margin: 0; font-size: var(--font-m); font-weight: normal; }
.popup .body { padding: 16px; overflow: auto; display: grid; gap: 14px; }
.popup .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; padding: 0 16px 16px; }
.popup .actions .button { min-width: var(--button-w); height: calc(var(--button-h) * 0.8); }
.popup p { margin: 0; }
.close { width: 2em; height: 2em; font-size: var(--font-s); }
.muted { opacity: 0.65; font-size: var(--font-xs); }

#world-list { display: grid; gap: 12px; }
.world { text-align: left; padding: 0.6em 0.9em; cursor: pointer; }
.world.teaser { opacity: 0.55; }
.world.selected { box-shadow: inset 0 0 0 3px var(--ink); }
.world .title { font-size: var(--font-m); }
.world .premise { font-size: var(--font-xs); opacity: 0.75; }

textarea { width: 100%; min-height: 6em; padding: 0.5em; border: var(--line) solid var(--ink); background: var(--box); resize: vertical; }
input[type=text] { width: 100%; padding: 0.4em 0.6em; border: var(--line) solid var(--ink); background: var(--box); }
#invite-form { display: flex; gap: 8px; align-items: stretch; }
#invite-form .button { white-space: nowrap; }
pre { margin: 0; padding: 10px; max-height: 40vh; overflow: auto; border: var(--line) solid var(--ink); font: 13px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
.error { color: #a3261b; }
.admin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.admin-list li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 0.4em 0.8em; }
.admin-list pre { flex-basis: 100%; }
.proposal-text { white-space: pre-wrap; }
.admin-list .controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.popup .pinned { padding: 16px 16px 0; display: grid; }
.bar { height: 1.2em; padding: 0; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--night); }

/* the king peeks over the first menu button, whichever it is, at a size set by the buttons */
#menu { position: relative; margin-top: calc(var(--button-w) * 0.62); }
#menu > .button { position: relative; z-index: 1; }
#king { position: absolute; z-index: 0; left: 50%; width: calc(var(--button-w) * 0.8); transform: translateX(-50%); bottom: 100%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
