/* DIGIGMA global shell — lot 4.
   Imports isolated DS tokens + components. Scoped to body.ds-shell.
   Play pages (sudoku / killer / binary) must not link this file. */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700;800&family=Sora:wght@500;600;700&display=swap");
@import url("/ds/tokens.css?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");
@import url("/ds/components.css?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");
@import url("/shared/site-chrome.css?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");

/* Digits motif: one fixed paint layer on body.ds-shell::before (align with play
   and home). Single surface — no html+body double SVG (#113). Motif visible on
   desktop and mobile; keep desktop tile size on phones (no denser compact).
   Play boards do not load this file. */
html.ds-root:has(body.ds-shell),
html[data-ds-theme]:has(body.ds-shell),
html.ds-root[data-ds-theme="dark"]:has(body.ds-shell),
html[data-ds-theme="dark"]:has(body.ds-shell),
body.ds-shell.ds-root,
html.ds-root body.ds-shell,
html:not(.is-play) body.ds-shell {
  background-image: none;
  background-color: var(--paper);
}

html:not(.is-play) body.ds-shell,
body.ds-shell {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-sans);
  isolation: isolate;
}

body.ds-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--paper);
  background-image: url("/brand/digits.svg?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00"), url("/brand/seigaiha.svg?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");
  background-repeat: repeat, repeat;
  background-size: var(--motif-digits-size, 900px 640px), 168px 84px;
}

html[data-ds-theme="dark"] body.ds-shell::before,
body.ds-shell[data-ds-theme="dark"]::before {
  background-image: url("/brand/digits-dark.svg?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00"), url("/brand/seigaiha.svg?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");
}

html.ds-root body.ds-shell .page,
body.ds-shell .page {
  --page-gutter: 0px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

body.ds-shell :where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

body.ds-shell .band {
  width: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding: clamp(20px, 4vw, 40px) 0 8px;
}

body.ds-shell .band-inner,
body.ds-shell .auth-shell,
body.ds-shell .games,
body.ds-shell .times-table,
body.ds-shell .board-panel,
body.ds-shell .read-page,
body.ds-shell .article,
body.ds-shell .howto,
body.ds-shell .settings-panel,
body.ds-shell #cloud,
body.ds-shell .section {
  width: min(1120px, calc(100% - 32px));
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 767px) {
  body.ds-shell .band-inner,
  body.ds-shell .auth-shell,
  body.ds-shell .games,
  body.ds-shell .times-table,
  body.ds-shell .board-panel,
  body.ds-shell .read-page,
  body.ds-shell .article,
  body.ds-shell .howto,
  body.ds-shell .settings-panel,
  body.ds-shell #cloud,
  body.ds-shell .section {
    width: var(--mobile-content-width, 95%);
  }
}

body.ds-shell .section-kicker,
body.ds-shell .page-title + .lede-tight {
  color: var(--muted);
}

body.ds-shell .section-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body.ds-shell .page-title,
body.ds-shell h1,
body.ds-shell h2 {
  font-family: var(--font-display);
  color: var(--ink);
}

body.ds-shell .page-title {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

body.ds-shell .lede-tight {
  color: var(--muted);
}

body.ds-shell .card,
body.ds-shell .games > .card,
body.ds-shell .auth-card,
body.ds-shell .offer-letter,
body.ds-shell .article,
body.ds-shell .howto,
body.ds-shell .settings-panel,
body.ds-shell .lib-row,
body.ds-shell .lib-item,
body.ds-shell .stat-card,
body.ds-shell .dash-profile,
body.ds-shell .podium-card,
body.ds-shell .achv-card {
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  color: var(--ink);
}

body.ds-shell .games {
  display: grid;
  gap: 14px;
  padding: 16px 0 48px;
}

body.ds-shell .card h2 { margin: 0 0 8px; }

body.ds-shell .card-sudoku,
body.ds-shell .games > .card-sudoku {
  border-top: 2px solid var(--indigo);
  background: color-mix(in srgb, var(--indigo) 6%, var(--paper-bright));
}

body.ds-shell .card-killer-sudoku,
body.ds-shell .games > .card-killer-sudoku {
  border-top: 2px solid var(--vermillon);
  background: color-mix(in srgb, var(--vermillon) 6%, var(--paper-bright));
}

body.ds-shell .card-binary-puzzle,
body.ds-shell .games > .card-binary-puzzle {
  border-top: 2px solid var(--matcha);
  background: color-mix(in srgb, var(--matcha) 6%, var(--paper-bright));
}

body.ds-shell .lib-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
}

body.ds-shell .lib-list {
  gap: 10px;
}

body.ds-shell .dash-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 20px;
  align-items: center;
  margin: 24px 0;
}

body.ds-shell .dash-profile .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

body.ds-shell .section-kicker {
  overflow: visible;
  white-space: normal;
  max-width: 100%;
}

body.ds-shell .identity-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--indigo);
  background: var(--indigo-soft);
  color: var(--indigo);
  font-family: var(--font-display);
}

body.ds-shell .achv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body.ds-shell .achv-card {
  text-align: center;
  padding: 16px 12px;
}

body.ds-shell .podium {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 24px;
}

body.ds-shell .podium-card .rank,
body.ds-shell .medal {
  color: var(--indigo);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.ds-shell .name-form {
  display: grid;
  gap: 14px;
}

body.ds-shell .auth-lead,
body.ds-shell .later-note,
body.ds-shell .price-meta {
  color: var(--muted);
}

body.ds-shell .offer-benefits {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

body.ds-shell .offer-benefits li {
  padding-left: 1.1em;
  position: relative;
}

body.ds-shell .offer-benefits li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--indigo);
}

body.ds-shell .history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

body.ds-shell .history-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

body.ds-shell .btn,
body.ds-shell .text-cta,
body.ds-shell button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-bright);
  color: var(--ink);
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
}

body.ds-shell .btn,
body.ds-shell button.btn,
body.ds-shell .games > .card .actions .btn:not(.primary) {
  background: var(--paper-shade);
  border: 1px solid var(--line-strong);
  color: var(--ink-strong);
  padding: 10px 18px;
  min-height: 44px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.95rem;
}

body.ds-shell .btn:hover,
body.ds-shell button.btn:hover,
body.ds-shell .games > .card .actions .btn:not(.primary):hover {
  background: color-mix(in srgb, var(--cta) 18%, var(--paper-shade));
  border-color: var(--cta);
  color: var(--ink-strong);
}

body.ds-shell .btn.primary,
body.ds-shell .text-cta,
body.ds-shell button.btn.primary,
body.ds-shell .games > .card .actions .btn.primary,
body.ds-shell .hero-actions .btn.primary,
body.ds-shell .offer-side .btn.primary {
  background: var(--cta);
  border: 1px solid var(--cta);
  color: var(--cta-ink);
  padding: 10px 18px;
  min-height: 44px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.95rem;
}

body.ds-shell .btn.primary:hover,
body.ds-shell .text-cta:hover {
  background: var(--cta-hover);
  border-color: var(--cta-hover);
  color: var(--cta-ink);
}

body.ds-shell .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

body.ds-shell .field,
body.ds-shell .name-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

body.ds-shell input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body.ds-shell select,
body.ds-shell textarea {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-bright);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
}

body.ds-shell .lib-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0 20px;
}

body.ds-shell .seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.ds-shell .seg button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper-bright);
  color: var(--ink);
  cursor: pointer;
}

body.ds-shell .seg button.is-on {
  background: var(--indigo);
  border-color: var(--indigo);
  color: var(--ivory);
}

body.ds-shell .board-panel {
  margin-bottom: 48px;
  padding: 20px 20px 8px;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

body.ds-shell .board-dailies,
body.ds-shell .board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

body.ds-shell .board-daily {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
}

body.ds-shell .board-daily.is-on,
body.ds-shell .board-daily[aria-selected="true"] {
  border-color: #C88708;
  color: #201A12;
  background: color-mix(in srgb, #C88708 14%, var(--paper-bright));
}

body.ds-shell .board-daily:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 3px color-mix(in srgb, #C88708 45%, transparent));
}

body.ds-shell .lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

body.ds-shell .lb-row {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  grid-template-areas:
    "rank who time"
    ". xp xp";
  column-gap: 10px;
  row-gap: 2px;
  align-items: baseline;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
}

body.ds-shell .lb-row.is-you {
  background: color-mix(in srgb, #C88708 8%, var(--paper-bright));
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
}

body.ds-shell .lb-rank {
  grid-area: rank;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.92rem;
}

body.ds-shell .lb-row.is-first .lb-rank,
body.ds-shell .lb-row.is-second .lb-rank,
body.ds-shell .lb-row.is-third .lb-rank {
  color: var(--ink);
}

body.ds-shell .lb-who {
  grid-area: who;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

body.ds-shell .lb-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}

body.ds-shell .lb-time {
  grid-area: time;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

body.ds-shell .lb-xp {
  grid-area: xp;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

body.ds-shell .lb-more {
  margin: 12px 0 16px;
}

body.ds-shell .player-flag {
  display: inline-flex;
  width: 20px;
  height: 14px;
  flex: 0 0 20px;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent);
}

body.ds-shell .player-flag svg {
  display: block;
  width: 20px;
  height: 14px;
}

body.ds-shell .board-tabs button {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
}

body.ds-shell .board-tabs button[aria-selected="true"] {
  border-color: #C88708;
  color: #C88708;
  background: color-mix(in srgb, #C88708 12%, var(--paper-bright));
}

body.ds-shell .board-panel .lib-toolbar {
  width: 100%;
  padding: 0 0 16px;
}

body.ds-shell .board-panel .times-table {
  width: 100%;
  margin: 0 0 12px;
}

body.ds-shell .board-empty {
  padding: 8px 0 20px;
}

body.ds-shell .board-empty .empty-state {
  margin: 0;
}

body.ds-shell .times-table {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 48px;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

body.ds-shell .times-table tbody tr {
  border-bottom: 1px solid var(--line);
}

body.ds-shell .times-table th,
body.ds-shell .times-table td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  border: 0;
}

body.ds-shell .times-table th {
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.ds-shell .offer-letter {
  display: grid;
  gap: 20px;
}

body.ds-shell .price,
body.ds-shell .ds-price {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

body.ds-shell .badge,
body.ds-shell .badge-gold {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--indigo) 35%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--indigo-soft);
  color: var(--indigo);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.ds-shell .progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--gris);
  overflow: hidden;
}

body.ds-shell .progress > i {
  display: block;
  height: 100%;
  background: var(--indigo);
}

body.ds-shell .err {
  color: var(--vermillon);
  border: 1px solid var(--vermillon);
  border-radius: var(--radius-sm);
  background: var(--vermillon-soft);
  padding: 8px 12px;
}

body.ds-shell .err[hidden] {
  display: none;
}

body.ds-shell .auth-shell {
  display: grid;
  place-items: center;
  padding: 28px 0 64px;
}

body.ds-shell .auth-card {
  width: min(400px, calc(100% - 8px));
  padding: 28px 28px 24px;
}

body.ds-shell .auth-alt {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

body.ds-shell .auth-alt a {
  color: var(--ink);
}

body.ds-shell .auth-google {
  width: 100%;
  margin-top: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}

@media (max-width: 390px) {
  body.ds-shell .auth-card {
    padding: 20px 16px 18px;
  }
}

body.ds-shell .article,
body.ds-shell .howto {
  margin: 16px auto 64px;
  max-width: 44rem;
  width: min(44rem, calc(100% - 32px));
}

@media (max-width: 767px) {
  body.ds-shell .article,
  body.ds-shell .howto,
  body.ds-shell .article.howto,
  body.ds-shell article.article,
  body.ds-shell .howto-rich {
    width: var(--mobile-content-width, 95%);
    max-width: none;
  }
}

body.ds-shell .article.howto,
body.ds-shell article.article {
  width: min(720px, calc(100% - 32px));
}

body.ds-shell .howto-rich {
  width: min(720px, calc(100% - 32px));
}

body.ds-shell .article ol,
body.ds-shell .howto ol {
  padding-left: 1.2em;
}

body.ds-shell .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

body.ds-shell .section-head h2 { margin: 0; }

body.ds-shell .article a,
body.ds-shell .howto a {
  color: var(--indigo);
}

body.ds-shell .article a.btn,
body.ds-shell .howto a.btn {
  color: var(--ink-strong);
}

body.ds-shell .article a.btn.primary,
body.ds-shell .howto a.btn.primary {
  color: var(--cta-ink);
}

body.ds-shell .lib-list {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: none;
  margin: 0 0 48px;
}

body.ds-shell .stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body.ds-shell .mini-board {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 2px;
  opacity: 0.4;
  background:
    linear-gradient(var(--ink) 1px, transparent 1px) 0 0 / 33.33% 33.33%,
    linear-gradient(90deg, var(--ink) 1px, transparent 1px) 0 0 / 33.33% 33.33%,
    var(--paper-wash);
}

body.ds-shell .shell-foot-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  body.ds-shell .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.ds-shell .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.ds-shell .offer-letter { grid-template-columns: 1fr auto; align-items: center; }
  body.ds-shell .shell-foot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.ds-shell .achv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.ds-shell .podium { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.ds-shell .dash-profile {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

@media (min-width: 960px) {
  body.ds-shell .dash-profile {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  body.ds-shell .dash-profile .hero-actions { width: auto; }
}

@media (min-width: 768px) {
  body.ds-shell .band-inner,
  body.ds-shell .games,
  body.ds-shell .section,
  body.ds-shell .times-table { width: min(1120px, calc(100% - 48px)); }
}

@media (min-width: 1024px) {
  body.ds-shell .band-inner,
  body.ds-shell .games,
  body.ds-shell .section,
  body.ds-shell .times-table { width: min(1120px, calc(100% - 64px)); }
}

@media (min-width: 1440px) {
  body.ds-shell .band-inner,
  body.ds-shell .games,
  body.ds-shell .section,
  body.ds-shell .times-table { width: min(1180px, calc(100% - 80px)); }
}

@media (max-height: 500px) and (orientation: landscape) {
  body.ds-shell .page-title { font-size: 1.6rem; }
}

