/* ─────────────────────────────────────────────────────────────────────────────
   style.css — shared across all platform pages
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Google Fonts ────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,ital,wght@9..144,0,300;9..144,0,400;9..144,0,700;9..144,1,300;9..144,1,400&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── Design tokens ───────────────────────────────────────────────────────────── */
:root {
  --bg:   #F4F0E8;
  --ink:  #1A1A14;
  --mid:  #8A8478;
  --faint:#D0C9B8;
  --rust: #B03020;

  --fw: "Fraunces", serif;
  --fu: "DM Sans", sans-serif;

  --nav-h: 54px;
  --page-w: 480px;      /* max content width for game pages */
  --hub-w:  880px;      /* max content width for the hub */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:   #1A1A14;
    --ink:  #F4F0E8;
    --mid:  #8A8478;
    --faint:#383630;
    --rust: #C84030;
  }
}

:root[data-theme="dark"] {
  --bg:   #1A1A14;
  --ink:  #F4F0E8;
  --mid:  #8A8478;
  --faint:#383630;
  --rust: #C84030;
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ────────────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  font-family: var(--fu);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Navigation ──────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 20px;
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  transition: background .2s, border-color .2s;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo {
  font-family: var(--fw);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}

/* Small game tag shown in the nav when on a game page — e.g. "Inkling" */
.nav-game-title {
  font-family: var(--fw);
  font-size: 15px;
  font-weight: 400;
  font-style: italic;
  color: var(--mid);
  margin-left: 2px;
}

.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--faint);
  margin: 0 4px;
}

/* ── Icon buttons (nav) ──────────────────────────────────────────────────────── */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mid);
  font-size: 16px;
  padding: 6px 7px;
  line-height: 1;
  font-family: var(--fu);
  transition: color .12s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn:hover { color: var(--ink); }

.icon-btn .label {
  font-size: 11px;
  letter-spacing: .04em;
  font-weight: 500;
}

/* ── Page layout ─────────────────────────────────────────────────────────────── */
.page {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hub-page {
  max-width: var(--hub-w);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── Typography ──────────────────────────────────────────────────────────────── */
.display {
  font-family: var(--fw);
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: .01em;
}

.display-italic {
  font-family: var(--fw);
  font-size: 48px;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
}

h1 {
  font-family: var(--fw);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
}

h2 {
  font-family: var(--fw);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
}

.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  color: var(--mid);
  text-transform: uppercase;
}

.caption {
  font-size: 11px;
  color: var(--mid);
  letter-spacing: .05em;
}

.body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

/* Primary — filled */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--ink);
  color: var(--bg);
  border: 1.5px solid var(--ink);
  font-family: var(--fu);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .15s, background .2s, color .2s, border-color .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: .85; }
.btn:disabled { opacity: .4; cursor: default; }

/* Ghost — outline only */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  background: none;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-family: var(--fu);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all .12s, border-color .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-ghost:disabled { opacity: .4; cursor: default; }

/* Rust / destructive */
.btn-rust {
  background: var(--rust);
  border-color: var(--rust);
  color: #fff;
}

/* Full-width variant */
.btn-full, .btn-ghost-full {
  width: 100%;
}

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.field label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--mid);
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: 1.5px solid var(--faint);
  font-family: var(--fu);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
}

.field-error {
  font-size: 11px;
  color: var(--rust);
  letter-spacing: .02em;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* ── Divider ─────────────────────────────────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--faint);
  transition: background .2s;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: var(--mid);
  letter-spacing: .07em;
  white-space: nowrap;
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--faint);
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 20, .5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--bg);
  border: 2px solid var(--ink);
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  transition: background .2s, border-color .2s;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.modal h2 {
  font-family: var(--fw);
  font-size: 18px;
  font-weight: 400;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mid);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color .12s;
}

.modal-close:hover { color: var(--ink); }

.modal p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 12px;
}

.modal p:last-child { margin-bottom: 0; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 20px;
  font-size: 12px;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, background .2s, color .2s;
  white-space: nowrap;
  z-index: 200;
}

.toast.show { opacity: 1; }

/* ── Hub page — game cards ───────────────────────────────────────────────────── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
  margin-top: 32px;
}

.game-card {
  border: 1.5px solid var(--faint);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, background .15s;
  position: relative;
}

.game-card:hover {
  border-color: var(--ink);
  background: rgba(26,26,20,.03);
}

.game-card.coming-soon {
  opacity: .5;
  pointer-events: none;
}

.game-card-name {
  font-family: var(--fw);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.game-card-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--mid);
  flex: 1;
}

.game-card-status {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  color: var(--mid);
}

.game-card-status.live {
  color: var(--rust);
}

/* ── Progress bar (used in Inkling timer) ────────────────────────────────────── */
.progress-track {
  width: 100%;
  height: 2px;
  background: var(--faint);
  transition: background .2s;
}

.progress-fill {
  height: 100%;
  background: var(--ink);
  transition: width 1s linear, background .3s;
}

.progress-fill.urgent { background: var(--rust); }

/* ── Pill / tag ──────────────────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  color: var(--mid);
  white-space: nowrap;
}

/* ── Result / share card ─────────────────────────────────────────────────────── */
.share-card {
  border: 2px solid var(--ink);
  padding: 24px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: border-color .2s;
}

.share-card-game {
  font-family: var(--fw);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.share-card-date {
  font-size: 11px;
  color: var(--mid);
  letter-spacing: .05em;
}

.share-card-emoji {
  font-size: 32px;
  line-height: 1;
}

.share-card-result {
  font-family: var(--fw);
  font-size: 28px;
  font-weight: 300;
  font-style: italic;
}

.share-card-grid {
  font-size: 20px;
  letter-spacing: 2px;
  line-height: 1.5;
}

.share-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

/* ── Archive ─────────────────────────────────────────────────────────────────── */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: 100%;
}

.archive-day {
  aspect-ratio: 1;
  border: 1px solid var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--mid);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.archive-day:hover { border-color: var(--ink); }

.archive-day.completed {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.archive-day.today {
  border-color: var(--rust);
  color: var(--rust);
  font-weight: 700;
}

/* ── Paywall ─────────────────────────────────────────────────────────────────── */
.paywall {
  border: 2px solid var(--ink);
  padding: 32px 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.paywall h2 {
  font-family: var(--fw);
  font-size: 22px;
  font-weight: 300;
  font-style: italic;
}

.paywall p {
  font-size: 13px;
  color: var(--mid);
  line-height: 1.65;
}

/* ── Account page ────────────────────────────────────────────────────────────── */
.account-section {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.account-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  color: var(--mid);
  text-transform: uppercase;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--faint);
  margin-bottom: 4px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--faint);
  font-size: 14px;
  gap: 12px;
}

.account-row:last-child { border-bottom: none; }

.account-row-label { color: var(--mid); font-size: 13px; }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.visually-hidden { /* alias */ 
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.mt-sm  { margin-top: 8px; }
.mt-md  { margin-top: 16px; }
.mt-lg  { margin-top: 24px; }
.mt-xl  { margin-top: 40px; }
.mb-sm  { margin-bottom: 8px; }
.mb-md  { margin-bottom: 16px; }
.mb-lg  { margin-bottom: 24px; }

.text-mid  { color: var(--mid); }
.text-rust { color: var(--rust); }
.text-center { text-align: center; }

.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm  { gap: 8px; }
.gap-md  { gap: 16px; }
.gap-lg  { gap: 24px; }
.w-full  { width: 100%; }

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--faint);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--mid);
  font-size: 13px;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .nav { padding: 0 14px; }
  .page { padding: 24px 16px 64px; }
  .hub-page { padding: 28px 16px 64px; }
  .display { font-size: 38px; }
  .modal { padding: 22px 18px; }
  .hub-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 340px) {
  .hub-grid { grid-template-columns: 1fr; }
}
