/* The launcher's pages: the storefront, a game's entry, the account, the dashboard and profiles. Every color, face and
   corner comes from the theme roles in tokens.css, which /themes/active.css replaces under the player's theme, so the
   whole site takes their look. With no theme it is Swoggler's own: night blue, neon teal and violet. */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--sw-surface); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--sw-on-surface); font: 1.0625rem/1.45 var(--sw-body);
  --glow: color-mix(in srgb, var(--sw-accent) 55%, transparent);
  --shadow: 0 1px 2px color-mix(in srgb, var(--sw-surface) 40%, black), 0 14px 30px color-mix(in srgb, var(--sw-surface) 55%, black);
  --gap: clamp(.9rem, 2.2vw, 1.6rem);
  /* Two soft lights in the theme's own colors, fixed behind everything. */
  background:
    radial-gradient(60rem 36rem at 92% -10%, color-mix(in srgb, var(--sw-accent) 22%, transparent), transparent 70%),
    radial-gradient(50rem 30rem at -10% 110%, color-mix(in srgb, var(--sw-action) 16%, transparent), transparent 70%),
    var(--sw-surface);
  background-attachment: fixed;
}
h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--sw-focus); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top, main, .foot { width: 100%; max-width: 88rem; margin-inline: auto;
  padding-inline: max(clamp(1rem, 4vw, 3.5rem), env(safe-area-inset-left)) max(clamp(1rem, 4vw, 3.5rem), env(safe-area-inset-right)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.1rem 1rem; }
/* The wordmark: heavy capitals in the theme's two bright colors. */
.wordmark {
  font: 900 clamp(1.6rem, 3.6vw, 2.2rem)/1 var(--sw-display); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  background: linear-gradient(100deg, var(--sw-action), var(--sw-accent)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (forced-colors: active) { .wordmark { color: CanvasText; background: none; } }

/* Your name, in the menu that opens from the bar. */
.name-panel { position: fixed; inset: 4.8rem max(clamp(1rem, 4vw, 3.5rem), calc((100vw - 88rem) / 2 + 3.5rem)) auto auto; margin: 0;
  width: min(21rem, calc(100vw - 2rem)); padding: 1.2rem; border: 1px solid var(--sw-border); border-radius: var(--sw-radius);
  background: var(--sw-raised); color: var(--sw-on-raised); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--sw-accent) 20%, transparent); }
.name-panel label { display: block; font: 800 1.15rem/1.2 var(--sw-display); text-transform: uppercase; letter-spacing: .05em; }
.name-panel small { display: block; margin-block: .15rem .8rem; font-size: .98rem; color: var(--sw-muted); }
.name-panel input { width: 100%; min-height: 2.9rem; padding: .3rem .8rem; border: 2px solid var(--sw-border); border-radius: calc(var(--sw-radius) * .6);
  background: var(--sw-surface); color: var(--sw-on-surface); }
.name-panel input:focus { border-color: var(--sw-action); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw-action) 35%, transparent); }
.name-panel .play { margin-top: .8rem; width: 100%; }
.name-panel p { margin-top: .6rem; }

/* The main button: the theme's action color, heavy capitals, a glow under the pointer. */
.play { display: inline-flex; align-items: center; justify-content: center; min-height: 3.1rem; padding: .5rem 1.7rem; border: 0;
  border-radius: calc(var(--sw-radius) * .75); background: var(--sw-action); color: var(--sw-on-action);
  font: 800 1.05rem/1.2 var(--sw-display); letter-spacing: .05em; text-transform: uppercase; text-align: center; cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--sw-action) 30%, transparent); transition: transform var(--sw-quick), box-shadow var(--sw-quick); }
.play:hover { transform: translateY(-1px); box-shadow: 0 8px 26px color-mix(in srgb, var(--sw-action) 50%, transparent); }
.play:disabled { opacity: .6; cursor: progress; transform: none; }

/* Printing shows how finished a game is: full color, one ink, or the line drawing. */
.poster { display: block; isolation: isolate; overflow: hidden; background: var(--sw-raised); aspect-ratio: 3 / 4; }
.poster svg { display: block; width: calc(100% + 1px); height: calc(100% + 1px); }
.poster:empty { background: var(--sw-muted); }
/* A painted cover keeps its own colors at every status. */
.poster .painted { display: block; width: 100%; height: 100%; object-fit: cover; }
.playable .poster:has(.painted) { background: var(--sw-raised); }
.playable .poster { background: var(--sw-accent); }
.playable .poster svg { filter: grayscale(1) contrast(1.15); mix-blend-mode: screen; }
.early .poster .ground { fill: var(--sw-raised); }
.early .poster :not(.ground, g, svg) { fill: none; stroke: var(--sw-on-raised); stroke-width: 1.3; }

/* A game card: its poster bleeds to the card's edge, and the card lifts and lights up under the pointer. */
.games { display: grid; gap: var(--gap); }
.game { position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 0 0 .95rem;
  border: 1px solid var(--sw-border); border-radius: var(--sw-radius); background: var(--sw-raised); color: var(--sw-on-raised); box-shadow: var(--shadow);
  transition: translate var(--sw-quick), box-shadow var(--sw-quick), border-color var(--sw-quick); }
.game:hover { translate: 0 -5px; border-color: var(--sw-accent); box-shadow: var(--shadow), 0 0 0 1px var(--sw-accent), 0 12px 34px var(--glow); }
.game > :not(.poster) { margin-inline: clamp(.7rem, 1.2vw, 1rem); }
.game h3 { margin-top: .75rem; font: 800 clamp(1.2rem, 2vw, 1.65rem)/1.1 var(--sw-display); letter-spacing: .01em; }
.game h3 a { text-decoration: none; }
.game h3 a::after { content: ""; position: absolute; inset: 0; }
.game h3 a:focus-visible { outline: none; }
.game h3 a:focus-visible::after { outline: 3px solid var(--sw-focus); outline-offset: -3px; border-radius: var(--sw-radius); }
.game .summary { margin-top: .2rem; }
.game .players { color: var(--sw-muted); font-size: .98rem; }
.game .state { margin-top: .55rem; align-self: flex-start; padding: .1rem .6rem; border: 1.5px solid var(--sw-accent); border-radius: 999px;
  color: var(--sw-accent); font-size: .85rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.ready .games { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr)); }
.ready .game { max-width: 34rem; }
.ready .poster { aspect-ratio: 1 / 1.12; }

/* The unfinished groups share a row when they are small. */
.unfinished { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 var(--gap); }
.unfinished .shelf { flex: 1 1 100%; min-width: 0; }
.unfinished .n1 { flex: 1 1 14rem; }
.unfinished .n2 { flex: 2 1 28rem; }
.unfinished .n3 { flex: 3 1 42rem; }
.unfinished .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); }
.unfinished .n1 .game { max-width: 22rem; }
.unfinished .n2 .games { grid-template-columns: repeat(2, minmax(0, 22rem)); }
.unfinished .n3 .games { grid-template-columns: repeat(3, minmax(0, 22rem)); }
/* Section headings: small capitals behind an accent bar. */
.unfinished h2, .section-title { display: flex; align-items: center; gap: .6rem; margin-top: 2.2rem;
  font: 800 1.15rem/1.2 var(--sw-display); letter-spacing: .12em; text-transform: uppercase; }
.unfinished h2::before, .section-title::before { content: ""; width: .35rem; height: 1.15em; border-radius: 2px; background: var(--sw-accent);
  box-shadow: 0 0 12px var(--glow); }
.unfinished header p { margin-block: .3rem 1rem; color: var(--sw-muted); font-size: 1.05rem; }

.notice { margin-bottom: 1.2rem; padding: .7rem 1rem; border-radius: var(--sw-radius); background: var(--sw-caution); color: var(--sw-on-caution); font-weight: 600; }
.foot { margin-top: auto; padding-block: 2.2rem max(2rem, env(safe-area-inset-bottom)); color: var(--sw-muted); }
.foot ul { display: flex; flex-wrap: wrap; gap: .2rem 1.6rem; }
.foot a { display: inline-block; padding-block: .55rem; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.foot a:hover { color: var(--sw-on-surface); text-decoration-thickness: 2px; }
output { display: block; min-height: 1.4em; }

/* One game's entry page */
.entry { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: clamp(1.4rem, 5vw, 4.5rem); align-items: center; }
.entry .poster { margin: clamp(.55rem, 1.1vw, .95rem); border: 1px solid var(--sw-border); border-radius: var(--sw-radius);
  box-shadow: var(--shadow), 0 18px 50px var(--glow); }
.entry h1 { font: 900 clamp(2.4rem, 6vw, 4.4rem)/1 var(--sw-display); letter-spacing: -.01em; text-transform: uppercase; overflow-wrap: anywhere; }
.entry .words { display: flex; flex-direction: column; align-items: flex-start; gap: .9rem; font-size: 1.15rem; max-width: 34rem; }
.entry .players, .entry .controls { color: var(--sw-muted); }
.entry .status-note { padding: .35rem .8rem; border: 1.5px solid var(--sw-accent); border-radius: var(--sw-radius); color: var(--sw-accent); }
.entry form { margin: 0; }
.zones { display: flex; flex-wrap: wrap; gap: .7rem; }
.zones h2 { flex-basis: 100%; font: 800 1.1rem/1.2 var(--sw-display); letter-spacing: .08em; text-transform: uppercase; }
.modes { display: flex; flex-wrap: wrap; gap: .2rem 1.3rem; }
.modes a { padding-block: .5rem; text-underline-offset: 4px; }
.modes a[aria-current="true"] { font-weight: 800; color: var(--sw-action); text-decoration: none; }

@media (max-width: 46rem) {
  .ready .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ready .game:first-child { grid-column: 1 / -1; max-width: none; }
  .unfinished .shelf { flex-basis: 100%; }
  .unfinished .games, .unfinished .n2 .games, .unfinished .n3 .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry { grid-template-columns: minmax(0, 1fr); }
  .entry .poster { max-height: 56dvh; aspect-ratio: auto; }
}
@media (prefers-reduced-motion: reduce) { .game, .play { transition: none; } .game:hover { translate: none; } .play:hover { transform: none; } }
@media (forced-colors: active) { .play, .game { border: 2px solid ButtonText; } }
