:root {
  --bg: #15122b;
  --panel: #221d42;
  --panel-edge: #3a3270;
  --text: #f4f1ff;
  --muted: #b3acd9;
  --accent: #ffc83d;
  --accent-text: #2a1d00;
  --danger: #ff7a7a;
  --ok: #7be0a5;
  --radius: 14px;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #2d2560 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 16px;
}

.logo {
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }

nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-weight: 700; }
nav a:hover { color: var(--text); }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.hero { text-align: center; padding: 56px 0 32px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 12px; font-weight: 900; }
.hero p { color: var(--muted); font-size: 1.15rem; margin: 0 auto 28px; max-width: 34em; }

.button {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 12px 26px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-text);
}
.button.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--panel-edge); }
.button:disabled { opacity: 0.6; cursor: wait; }
.buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 28px;
}
.panel.narrow { max-width: 420px; margin: 32px auto; }
.panel h1 { margin-top: 0; font-size: 1.6rem; }

form { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input {
  font: inherit;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: #171334;
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.error { color: var(--danger); min-height: 1.5em; margin: 0; }
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { font-size: 1.6rem; font-weight: 900; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #1b1739;
}
.badge { font-size: 0.85rem; color: var(--ok); }
.badge.off { color: var(--muted); }

section + section { margin-top: 20px; }

/* ---- admin page ---- */
.tabs { display: flex; gap: 8px; margin: 0 0 20px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 800; cursor: pointer;
  padding: 10px 20px; border-radius: 999px; border: 0;
  background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px var(--panel-edge);
}
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.panel h2 { margin: 0 0 14px; font-size: 1.15rem; }
.field-error { color: var(--danger); font-weight: 400; font-size: 0.9rem; min-height: 1.2em; }
.ok { color: var(--ok); min-height: 1.5em; margin: 0; }
input.bad { border-color: var(--danger); }
input[type="checkbox"] { width: 20px; height: 20px; padding: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 240px; min-width: 0; }
.small-button {
  font: inherit; font-weight: 800; cursor: pointer; border: 0; border-radius: 10px;
  padding: 9px 14px; background: #171334; color: var(--text); box-shadow: inset 0 0 0 1px var(--panel-edge);
}
.small-button:hover { box-shadow: inset 0 0 0 1px var(--accent); }

.suggest { position: relative; }
.suggest ul, .picker-panel {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 6px; list-style: none;
  background: #171334; border: 1px solid var(--panel-edge); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li:hover, .suggest li.active { background: var(--panel-edge); }

.gift-list { display: grid; gap: 10px; margin-bottom: 12px; }
.row.recipient { justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: #1b1739; }
.gift-list:empty { display: none; }
.picker { position: relative; }
.picker-button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; cursor: pointer; padding: 6px 10px; min-height: 52px;
  border-radius: 10px; border: 1px solid var(--panel-edge); background: #171334; color: var(--text);
}
.picker-panel { max-height: 380px; display: flex; flex-direction: column; gap: 6px; }
.picker-panel input { width: 100%; }
.picker-results { overflow-y: auto; display: grid; gap: 2px; }
.picker-results h3 {
  margin: 8px 0 2px; padding: 4px 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  border-left: 4px solid var(--grade); color: var(--grade);
}
.picker-option {
  display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; cursor: pointer;
  border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; width: 100%;
}
.picker-option:hover { background: var(--panel-edge); }
.icon {
  width: 40px; height: 40px; flex: none; border-radius: 6px; border: 3px solid var(--grade);
  background: #0f0c24 center / cover no-repeat; display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 800; color: var(--grade);
}
.grade-0 { --grade: #8d88ad; } .grade-1 { --grade: #5fd36a; } .grade-2 { --grade: #5aa9ff; }
.grade-3 { --grade: #ff6b6b; } .grade-4 { --grade: #c07bff; } .grade-5 { --grade: #ffa13d; }
.qty { width: 90px; }

.settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.table-wrap { overflow-x: auto; }
table.levels { border-collapse: collapse; width: 100%; min-width: 620px; }
table.levels th, table.levels td { padding: 6px 8px; text-align: left; vertical-align: top; }
table.levels th { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
table.levels input { width: 100%; min-width: 80px; padding: 8px 10px; }
.changed { color: var(--accent); font-size: 0.8rem; font-weight: 700; }
table.users td { border-top: 1px solid var(--panel-edge); vertical-align: middle; }
table.users label.check { font-weight: 400; }
table.users input[type="checkbox"] { width: 20px; min-width: 0; padding: 0; }
table.users label.check { display: inline-flex; }
th button.sort { all: unset; cursor: pointer; font: inherit; color: inherit; }
th button.sort:hover, th button.sort.on { color: var(--accent); }
th button.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th button.sort::after { content: " " attr(data-arrow); font-size: 0.75em; }
.badge.playing { color: var(--accent); }
.badge.playing::before { content: "\25CF "; }
.verified { color: var(--ok); }
.unverified { color: var(--danger); }
.small-button.danger { color: var(--danger); }
.small-button.danger:hover { box-shadow: inset 0 0 0 1px var(--danger); }
.small-button:disabled { opacity: 0.4; cursor: default; box-shadow: inset 0 0 0 1px var(--panel-edge); }

/* ---- character list on the account page ---- */
.list li.character { align-items: center; justify-content: flex-start; }
.list li.character img, .character-noimage { width: 56px; height: 56px; flex: none; object-fit: contain; }
.character-text { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }

/* ---- the game on the account page ---- */
/* The game panel sits in the page column like every other panel; the frame keeps the game's
   own 3:2 shape. */
.game-frame {
  position: relative; margin-top: 14px; width: 100%; aspect-ratio: 1152 / 768;
  background: #231f20; border-radius: 10px; overflow: hidden;
}
#unityContainer { position: absolute; inset: 0; }
#unityContainer canvas { display: block; width: 100% !important; height: 100% !important; }
.game-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; background: #231f20; padding: 16px; text-align: center;
}
.game-cover[hidden] { display: none; }
.game-bar { width: min(320px, 70%); height: 10px; border-radius: 999px; background: #3a3270; overflow: hidden; }
.game-bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  /* Always along the bottom edge of the window, whatever the page length or scroll position */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: 44px;
  padding: 0 16px;
  background: var(--bg);
  border-top: 1px solid var(--panel-edge);
}
/* Room so the last of the page is never hidden behind the footer */
body { padding-bottom: 44px; }
.site-footer a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-weight: 700; }
.site-footer a:hover { color: var(--accent); }
.site-footer img { width: 24px; height: 24px; }
