/*
 * The look of every page: colours, type and the few shared components.
 * "Playful minimalism": a deep navy studio, honey yellow as the brand colour,
 * chunky type, flat light tiles with dark text, thick "arcade button" edges.
 * Pages link /shared/fonts.css first, then this file, then their own sheet.
 */

:root {
  /* studio */
  --ink: #0c1230;
  --ink-2: #141c46;
  --ink-3: #1e2960;
  --ink-4: #2b3878;
  --cream: #fff5dc;
  --mist: #b7c0e6;

  /* brand and signals */
  --honey: #ffc83d;
  --honey-deep: #d99a00;
  --coral: #ff6b5e;
  --coral-deep: #c9463b;
  --good: #63e08f;
  --good-deep: #2fa35c;

  /* the four answer colours: light fields, always with dark text */
  --a: #7fd4ff;
  --a-deep: #3a9bd0;
  --b: #ffb26b;
  --b-deep: #d97f2e;
  --c: #8fe6a2;
  --c-deep: #49b364;
  --d: #f7a8d8;
  --d-deep: #cc6aa6;

  /* the eight player colours (index = player.color) */
  --p0: #ffc83d;
  --p1: #6fcfff;
  --p2: #ff7a85;
  --p3: #7fe3a0;
  --p4: #ff9d4d;
  --p5: #a3b5ff;
  --p6: #4fd8c8;
  --p7: #f59ad6;

  --display: "Paytone One", "Arial Black", "Segoe UI", system-ui, sans-serif;
  --text: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 1.1em;
  --edge: 0.32em; /* height of the pressed-button edge */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--text);
  font-weight: 400;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

:focus-visible {
  outline: 0.2em solid var(--cream);
  outline-offset: 0.15em;
}

[hidden] {
  display: none !important;
}

/* The studio backdrop: a dotted floor and two soft spotlights. */
.studio {
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 18% -10%, rgba(255, 200, 61, 0.16), transparent 42%),
    radial-gradient(circle at 96% 108%, rgba(111, 207, 255, 0.14), transparent 46%),
    radial-gradient(rgba(255, 255, 255, 0.055) 1.5px, transparent 1.6px);
  background-size: auto, auto, 26px 26px;
  background-attachment: fixed;
}

.display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.muted {
  color: var(--mist);
}

/* The wordmark. */
.brand {
  font-family: var(--display);
  color: var(--honey);
  letter-spacing: 0.01em;
  line-height: 1;
  text-shadow: 0 0.08em 0 var(--honey-deep), 0 0.16em 0 rgba(0, 0, 0, 0.35);
}

/* ---- arcade button: a flat face on a darker edge; pressing sinks the face */
.btn {
  --face: var(--ink-3);
  --rim: #0a0f2a;
  --label: var(--cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 3em;
  padding: 0.6em 1.2em;
  border-radius: var(--radius);
  background: var(--face);
  color: var(--label);
  font-family: var(--display);
  font-size: 1.05em;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 var(--edge) 0 var(--rim);
  transform: translateY(0);
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.15s ease;
  user-select: none;
}

.btn:active:not(:disabled),
.btn.is-pressed {
  transform: translateY(var(--edge));
  box-shadow: 0 0 0 var(--rim);
}

.btn:disabled {
  cursor: default;
  filter: saturate(0.4) brightness(0.75);
}

.btn--honey {
  --face: var(--honey);
  --rim: var(--honey-deep);
  --label: var(--ink);
}

.btn--coral {
  --face: var(--coral);
  --rim: var(--coral-deep);
  --label: var(--ink);
}

.btn--good {
  --face: var(--good);
  --rim: var(--good-deep);
  --label: var(--ink);
}

.btn--quiet {
  --face: transparent;
  --rim: transparent;
  --label: var(--mist);
  min-height: 2.6em;
  font-family: var(--text);
  font-weight: 500;
  font-size: 0.95em;
  box-shadow: inset 0 0 0 0.12em var(--ink-4);
}

.btn--quiet:active:not(:disabled) {
  transform: none;
  box-shadow: inset 0 0 0 0.12em var(--mist);
}

.btn--xl {
  min-height: 3.8em;
  font-size: 1.3em;
  width: 100%;
}

.btn--wide {
  width: 100%;
}

/* ---- panels and form fields */
.card {
  background: var(--ink-2);
  border-radius: calc(var(--radius) * 1.2);
  padding: 1.1em;
  box-shadow: inset 0 0 0 0.1em rgba(255, 255, 255, 0.06);
}

.field {
  display: block;
  width: 100%;
  min-height: 3em;
  padding: 0.55em 0.9em;
  border-radius: var(--radius);
  border: 0.14em solid var(--ink-4);
  background: var(--ink);
  color: var(--cream);
  font-size: 1.1em;
  font-weight: 500;
}

.field::placeholder {
  color: #8a94c2;
  font-weight: 400;
}

.field:focus {
  outline: none;
  border-color: var(--honey);
}

.label {
  display: block;
  margin-bottom: 0.35em;
  color: var(--mist);
  font-size: 0.9em;
  font-weight: 500;
}

/* A row of exclusive choices. */
.seg {
  display: flex;
  gap: 0.3em;
  padding: 0.3em;
  border-radius: var(--radius);
  background: var(--ink);
}

.seg > button {
  flex: 1 1 0;
  min-height: 2.7em;
  padding: 0.3em 0.4em;
  border-radius: calc(var(--radius) * 0.75);
  color: var(--mist);
  font-weight: 600;
  font-size: 0.95em;
}

.seg > button[aria-pressed="true"] {
  background: var(--honey);
  color: var(--ink);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 2.4em;
  padding: 0.3em 0.85em;
  border-radius: 99em;
  background: var(--ink-3);
  color: var(--cream);
  font-weight: 500;
  font-size: 0.92em;
}

button.chip[aria-pressed="false"] {
  background: transparent;
  color: #8a94c2;
  box-shadow: inset 0 0 0 0.12em var(--ink-4);
  text-decoration: line-through;
}

.note {
  padding: 0.7em 0.9em;
  border-radius: var(--radius);
  background: rgba(255, 107, 94, 0.14);
  color: #ffd2cd;
  font-weight: 500;
}

.note--ok {
  background: rgba(99, 224, 143, 0.14);
  color: #c9f7d8;
}

/* ---- a player's avatar: an svg from /shared/avatar.js inside a square box */
.avatar {
  display: inline-block;
  flex: none;
  width: 2.6em;
  height: 2.6em;
}

.avatar > svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* A character guest: its portrait in a round frame of the player's colour. */
.avatar--cast > img {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border-radius: 50%;
  object-fit: cover;
  border: 0.16em solid var(--p0);
  background: var(--ink-2, #1a2350);
}

.avatar--cast[data-color="1"] > img { border-color: var(--p1); }
.avatar--cast[data-color="2"] > img { border-color: var(--p2); }
.avatar--cast[data-color="3"] > img { border-color: var(--p3); }
.avatar--cast[data-color="4"] > img { border-color: var(--p4); }
.avatar--cast[data-color="5"] > img { border-color: var(--p5); }
.avatar--cast[data-color="6"] > img { border-color: var(--p6); }
.avatar--cast[data-color="7"] > img { border-color: var(--p7); }

/* ---- simple centred page (landing, account, invitation, pairing, 404) */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(1.2rem, env(safe-area-inset-top)) 1.1rem max(1.6rem, env(safe-area-inset-bottom));
  font-size: 1rem;
}

.page > main {
  width: 100%;
  max-width: 27rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: auto 0;
}

.page__brand {
  font-size: 2.6rem;
  text-align: center;
  margin: 0.4rem 0 0.2rem;
}

.spinner {
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  border: 0.3em solid var(--ink-4);
  border-top-color: var(--honey);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(0.8em);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
