/* Hub + how-to layout. Colors and type come from design-system/tokens.css. */
@import url("./design-system/tokens.css");

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
}

body {
  background-image:
    radial-gradient(1100px 520px at 8% -12%, var(--paper-wash) 0%, transparent 52%),
    radial-gradient(800px 380px at 108% 8%, var(--paper-shade) 0%, transparent 48%);
  overflow-x: hidden;
}

.page {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  font-size: 1rem;
}

.nav a:hover,
.nav a[aria-current="page"] { color: var(--ink); }

.site-header a.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.site-header img.mark {
  width: 36px;
  height: 36px;
  display: block;
  flex: 0 0 36px;
}

.site-header h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  line-height: 1.1;
}

.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.games > .card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}

.card .glyph {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--mark-stroke);
  background: var(--gold-wash);
  margin-bottom: 12px;
}

.card .glyph.sudoku {
  background:
    linear-gradient(var(--gold), var(--gold)) 50% 33% / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 66% / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 33% 50% / 2px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 66% 50% / 2px 18px no-repeat,
    var(--gold-wash);
}

.card .glyph.stars {
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 3px, transparent 3.5px),
    radial-gradient(circle at 50% 18%, var(--gold) 0 2px, transparent 2.4px),
    radial-gradient(circle at 50% 82%, var(--gold) 0 2px, transparent 2.4px),
    radial-gradient(circle at 18% 50%, var(--gold) 0 2px, transparent 2.4px),
    radial-gradient(circle at 82% 50%, var(--gold) 0 2px, transparent 2.4px),
    var(--gold-wash);
}


.card .glyph.killer {
  background:
    linear-gradient(var(--gold), var(--gold)) 50% 33% / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 66% / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 33% 50% / 2px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 66% 50% / 2px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 22% 22% / 9px 1.5px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 22% 28% / 1.5px 9px no-repeat,
    var(--gold-wash);
}
.card .glyph.binary {
  background:
    linear-gradient(var(--gold), var(--gold)) 50% 22% / 20px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 36% / 20px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 50% / 20px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 64% / 20px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 78% / 20px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 22% 50% / 1px 20px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 36% 50% / 1px 20px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 50% 50% / 1px 20px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 64% 50% / 1px 20px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 78% 50% / 1px 20px no-repeat,
    var(--gold-wash);
}

.card h2 {
  margin: 0 0 6px;
  letter-spacing: 0.04em;
  font-size: 1.25rem;
  font-weight: 600;
}

.card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.98rem;
}

.card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
}

.btn:hover { border-color: var(--btn-hover-line); background: var(--btn-hover); }

.btn.primary {
  background: var(--gold-fill);
  color: var(--ink-button);
  border-color: var(--gold-border);
  font-weight: 600;
}

.btn.primary:hover { background: var(--gold-hover); }

.foot {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.continue { margin: 0 0 20px; }

.continue-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 4px 0;
  text-decoration: none;
  color: inherit;
}

.continue-label { font-weight: 600; }
.continue-sub { color: var(--muted); font-size: 0.95rem; }

.recent { margin-top: 32px; }

.recent-head,
.solved-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 16px;
}

.recent-head h2,
.page-title {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.page-title {
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: 0.08em;
}

.recent-all {
  color: var(--muted);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.recent-all:hover { color: var(--ink); }

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.recent-list a:hover { color: var(--gold); }

.article, .howto { max-width: 40rem; }
.article h1, .howto h1 { font-size: 1.8rem; letter-spacing: 0.03em; margin: 0 0 16px; }
.article h2, .howto h2 { font-size: 1.15rem; letter-spacing: 0.04em; margin: 28px 0 10px; }
.article p, .article li, .howto p, .howto li { font-size: 1.05rem; line-height: 1.55; color: var(--ink); }
.article ul, .howto ul { padding-left: 1.2em; }
.article .err, .howto .err { color: var(--bad); }

.history { margin-top: 28px; }
.history h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  font-weight: 600;
}

@media (max-width: 760px) {
  .page { padding: 20px 16px 40px; }
  .games {
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
  }
}
.foot a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }

.locale-switch {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}
.locale-switch label { display: flex; margin: 0; }
.locale-switch select {
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  max-width: 12.5rem;
  padding: 8px 10px;
  cursor: pointer;
}
@media (max-width: 760px) {
  .locale-switch { margin-left: 0; }
  .locale-switch select { max-width: 11rem; }
}

.nav-games { position: relative; }
.nav-games > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-size: 1rem;
}
.nav-games > summary::-webkit-details-marker { display: none; }
.nav-games.is-current > summary,
.nav-games[open] > summary,
.nav-games > summary:hover { color: var(--ink); }
.nav-games-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: absolute;
  z-index: 8;
  top: 100%;
  left: 0;
  min-width: 12rem;
  padding: 6px 0;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.site-header .nav .nav-games-list a,
.site-header .nav .nav-games-list [aria-current="page"] {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
}
.nav-games-list [aria-current="page"] {
  color: var(--ink);
  cursor: default;
}
@media (max-width: 760px) {
  .nav-games { width: 100%; }
  .nav-games-list {
    position: static;
    min-width: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 0 8px;
  }
}

/* Local account — this machine only. Not a cloud signup. */
.lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}
#names {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
#names button,
#names a {
  font: inherit;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-bright);
  color: var(--ink);
  cursor: pointer;
}
#names [aria-current="true"],
#names .active {
  border-color: var(--gold-border);
  background: var(--gold-fill);
}
.name-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
  margin: 0 0 28px;
}
.name-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.name-form input[type="text"] {
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  min-width: min(16rem, 100%);
  padding: 8px 12px;
}
#boards { margin-top: 28px; }
#boards h2,
#solved h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.who {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1rem;
}
.who a { color: inherit; text-underline-offset: 3px; }

.name-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}
.name-actions button,
.name-actions .btn {
  background: transparent;
  color: var(--muted);
}
.name-actions button:hover { color: var(--ink); }

.confirm-pop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(246, 241, 232, 0.45);
  z-index: 20;
  padding: 24px 16px;
}
.confirm-pop[hidden] { display: none !important; }
.confirm-pop .rules-pop-card,
.confirm-card {
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  max-width: 22rem;
  width: min(22rem, 100%);
  box-shadow: var(--shadow);
}
.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.confirm-actions .danger {
  color: var(--bad);
  border-color: var(--bad);
  background: transparent;
}

.board-list { list-style: none; margin: 0; padding: 0; }
.board-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}
.board-row .band,
.board-row .count { color: var(--muted); }