/* o1a2h.fun — shared styles
   Aesthetic: editorial/brutalist, cream paper + ink + hot potato orange.
   Typography: DM Serif Display (display) + JetBrains Mono (body/UI). */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=JetBrains+Mono:wght@400;500;700;800&display=swap');

:root {
  --paper: #f4ede0;
  --paper-deep: #eadfc9;
  --ink: #151310;
  --ink-soft: #2a251f;
  --mute: #6e6659;
  --line: #151310;
  --hot: #ff5a1f;            /* hot potato */
  --hot-deep: #c63e0c;
  --ok: #1a7a3c;
  --warn: #d38b00;
  --danger: #b4281f;
  --radius: 0;
  --shadow-hard: 6px 6px 0 0 var(--ink);
  --shadow-soft: 3px 3px 0 0 var(--ink);
  --serif: 'DM Serif Display', 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* subtle paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image:
    radial-gradient(rgba(21,19,16,0.06) 1px, transparent 1px),
    radial-gradient(rgba(21,19,16,0.04) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1.5px 1.5px;
  mix-blend-mode: multiply;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  flex: 1;
}

/* Header with wordmark */
.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 36px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
}
.brand__logo {
  font-family: var(--serif);
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-style: italic;
}
.brand__logo .hot { color: var(--hot); }
.brand__tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  margin-left: auto;
}

/* Cards */
.card {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard);
  padding: 28px;
  margin-bottom: 28px;
}
.card--snug { padding: 18px; box-shadow: var(--shadow-soft); }
.card__title {
  font-family: var(--serif);
  font-size: 28px;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.card__subtitle {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin: -12px 0 20px;
}

/* Form controls */
label.field {
  display: block;
  margin-bottom: 16px;
}
label.field > span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--mute);
  margin-bottom: 6px;
}
input[type="text"], input[type="search"] {
  width: 100%;
  background: var(--paper-deep);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  padding: 14px 16px;
  outline: none;
  transition: box-shadow 0.1s;
}
input[type="text"]:focus, input[type="search"]:focus {
  box-shadow: var(--shadow-soft);
  background: var(--paper);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid var(--ink);
  padding: 12px 22px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  box-shadow: var(--shadow-soft);
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 0 var(--ink); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn--primary { background: var(--hot); color: var(--paper); }
.btn--primary:hover:not(:disabled) { background: var(--hot-deep); }
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: var(--ink); color: var(--paper); box-shadow: none; transform: none; }
.btn--block { width: 100%; }
.btn--lg { padding: 18px 28px; font-size: 16px; }
.btn--sm { padding: 6px 10px; font-size: 11px; }
.btn--icon { padding: 8px 10px; }

/* Chip-style toggles for multi-select */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 8px 14px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background 0.08s;
}
.chip:hover { background: var(--paper-deep); }
.chip--on { background: var(--ink); color: var(--paper); }
.chip--on:hover { background: var(--ink-soft); }
.chip--disabled { opacity: 0.4; cursor: not-allowed; }

/* Status text */
.muted { color: var(--mute); font-size: 12px; letter-spacing: 0.05em; }
.hr { border: 0; border-top: 1px dashed var(--ink); margin: 20px 0; opacity: 0.4; }

/* Player row */
.playerRow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(21,19,16,0.2);
}
.playerRow:last-child { border-bottom: 0; }
.playerRow__dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  flex: 0 0 28px;
}
.playerRow__name {
  font-weight: 700;
  flex: 1;
}
.playerRow__badge {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1.5px solid var(--ink);
}
.playerRow__badge--ready { background: var(--ok); color: var(--paper); border-color: var(--ok); }
.playerRow__badge--host { background: var(--ink); color: var(--paper); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 100;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--danger); border-color: var(--danger); }
.toast--ok { background: var(--ok); border-color: var(--ok); }

/* Footer */
footer.foot {
  margin-top: auto;
  padding: 24px;
  text-align: center;
  border-top: 2px solid var(--ink);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}
footer.foot .foot__line { display: inline-flex; gap: 18px; flex-wrap: wrap; justify-content: center; }

/* Color swatch grid */
.swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.swatch {
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  cursor: pointer;
  position: relative;
  transition: transform 0.08s;
}
.swatch:hover { transform: scale(1.08); }
.swatch--on::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 2px solid var(--paper);
  outline: 2px solid var(--ink);
}
.swatch--taken { opacity: 0.25; cursor: not-allowed; pointer-events: none; }
.swatch--taken::before {
  content: '×';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
}

/* Code reveal */
.codeReveal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--serif);
  font-size: clamp(20px, 6vw, 32px);
  letter-spacing: 0.05em;
  min-width: 0;
  max-width: 100%;
}
.codeReveal > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  flex: 0 1 auto;
}
.codeReveal__code {
  background: var(--paper-deep);
  padding: 4px 12px;
  border: 2px solid var(--ink);
  min-width: 90px;
  text-align: center;
  flex: 0 0 auto;
}
.codeReveal .btn--icon {
  padding: 6px 8px;
  flex: 0 0 auto;
}
.codeReveal .btn--icon svg { display: block; }

/* NEW: two-row invite layout — URL on top, buttons below.
   This replaces codeReveal but we keep both so cached CSS can't break anything. */
.inviteBox {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}
.inviteBox__url {
  font-family: var(--serif);
  font-size: clamp(22px, 7vw, 34px);
  letter-spacing: 0.02em;
  line-height: 1.15;
  /* Allow URL to wrap if needed */
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  padding: 10px 14px;
  background: var(--paper-deep);
  border: 2px solid var(--ink);
  min-width: 0;
  max-width: 100%;
  /* Make container honor its parent width on narrow screens */
  box-sizing: border-box;
}
.inviteBox__code {
  /* Highlight the code portion of the URL */
  font-weight: 400;
  color: var(--hot);
  letter-spacing: 0.08em;
}
.inviteBox__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.inviteBox__actions .btn--icon {
  padding: 8px 12px;
}
.inviteBox__actions .btn--icon svg { display: block; }

/* Responsive */
@media (max-width: 640px) {
  .wrap { padding: 20px 16px 32px; }
  .brand__logo { font-size: 36px; }
  .card { padding: 20px; }
  .swatches { grid-template-columns: repeat(8, 1fr); }
  .card__title { font-size: 22px; }
}

/* Language switcher (top strip) */
.langSwitcher {
  display: flex;
  gap: 0;
  justify-content: flex-end;
  margin: 0 auto 12px;
  max-width: 820px;
  padding: 0 24px;
}
.langSwitcher button {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 5px 11px;
  cursor: pointer;
  margin-left: -2px; /* overlap borders */
  transition: background 0.08s;
}
.langSwitcher button:first-child { margin-left: 0; }
.langSwitcher button:hover { background: var(--paper-deep); }
.langSwitcher button.on {
  background: var(--ink);
  color: var(--paper);
}
@media (max-width: 640px) {
  .langSwitcher { padding: 0 16px; }
}

/* Host note */
.hostNote {
  padding: 14px 16px;
  border: 2px dashed var(--ink);
  background: rgba(255, 90, 31, 0.08);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* QR code block shown on host page */
.qrHolder {
  display: flex;
  justify-content: center;
  margin: 16px 0 4px;
}
.qrHolder__inner {
  display: inline-block;
  padding: 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  line-height: 0;
}
.qrHolder svg {
  display: block;
  width: 200px;
  height: 200px;
}
@media (max-width: 640px) {
  .qrHolder svg { width: 160px; height: 160px; }
}

/* Kick button in player row (host view) */
.playerRow__kick {
  min-width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--danger);
  border-color: var(--danger);
  margin-left: 8px;
}
.playerRow__kick:hover { background: var(--danger); color: var(--paper); }
