:root {
  --bg: #041a34;
  --theme: #1d55c3;
  --fg: #f2f6ff;
  --muted: #9fb2d0;
  --card: rgba(255, 255, 255, 0.08);
  --card-hover: rgba(255, 255, 255, 0.16);
  --radius: 18px;
}

* { box-sizing: border-box; }

/* Class rules below set `display`, which would otherwise beat the UA style for [hidden]
   and leave full-screen overlays swallowing clicks. This has to stay authoritative. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

body { background-image: radial-gradient(circle at 50% 0%, var(--theme), var(--bg)); }

#app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px 8px;
}

.topbar h1 { margin: 0; font-size: 40px; font-weight: 600; }
.topbar-actions { display: flex; gap: 12px; }

/* Quest controller pointing is imprecise: every target is deliberately large. */
button {
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 26px;
  min-height: 60px;
  cursor: pointer;
}

button:hover, button:focus-visible { background: var(--card-hover); border-color: var(--fg); outline: none; }
button.ghost { background: transparent; border-color: rgba(255, 255, 255, 0.35); }
button[disabled] { opacity: 0.45; cursor: default; }

.levels {
  flex: 1;
  display: grid;
  /* Fixed track width, not 1fr: a single level must not stretch across the whole screen. */
  grid-template-columns: repeat(auto-fit, minmax(300px, 340px));
  justify-content: center;
  gap: 28px;
  align-content: start;
  padding: 24px 40px 40px;
  overflow-y: auto;
}

.level {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  font-size: 34px;
  font-weight: 600;
  text-align: center;
}

.level small { display: block; font-size: 17px; font-weight: 400; color: var(--muted); }

.empty { text-align: center; color: var(--muted); font-size: 22px; padding: 0 40px 40px; }

.player { position: fixed; inset: 0; background: #000; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

.back {
  position: absolute;
  inset-inline-start: 20px;
  top: 20px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.65);
  border-color: rgba(255, 255, 255, 0.45);
}

dialog {
  width: min(760px, 92vw);
  border: 0;
  border-radius: var(--radius);
  background: #10203c;
  color: var(--fg);
  padding: 28px;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.admin-head { display: flex; align-items: center; justify-content: space-between; }
.admin-head h2 { margin: 0; font-size: 30px; }
.hint { color: var(--muted); line-height: 1.6; }
.hint code { background: rgba(255, 255, 255, 0.12); padding: 2px 8px; border-radius: 6px; }

input[type="file"] {
  width: 100%;
  padding: 22px;
  margin: 8px 0 18px;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  background: transparent;
  color: var(--fg);
  font: inherit;
}

.storage { color: var(--muted); font-size: 16px; margin-bottom: 14px; }
.admin-list { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow-y: auto; }

.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-list .meta { color: var(--muted); font-size: 15px; }

.progress { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.82); z-index: 10; }
.progress-box { width: min(620px, 92vw); text-align: center; }
.progress-box h2 { font-size: 30px; margin: 0 0 20px; }
.bar { height: 20px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--fg); transition: width 0.2s; }
#progress-detail { color: var(--muted); min-height: 1.6em; margin: 16px 0 20px; }

.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 20; }
.splash-inner { font-size: 44px; font-weight: 600; opacity: 0.9; }
.splash.hidden { display: none; }

.error { color: #ffb4b4; }
