/* justout template kit — components
   header.site + .tabs, .hero, .shelf (3x3 bento), .tool-card / .game-card,
   .season-strip, footer, .start-card / .end-card, plus tool / article / dash shells.
*/

/* Viewport-fitting shells: the page itself does not scroll.
   Long text and logs may scroll inside .tool-scroll, .article-scroll, .log-scroll. */
html:has(body.kit),
body.kit {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.kit {
  display: flex;
  flex-direction: column;
}

.skip {
  position: absolute;
  left: var(--s-2);
  top: -40px;
  z-index: 20;
  padding: var(--s-2) var(--s-3);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  text-decoration: none;
}
.skip:focus { top: var(--s-2); }

/* Season strip */
.season-strip {
  flex: 0 0 auto;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-1) var(--s-3) 0;
}
.season-strip *,
.season-strip *::before,
.season-strip *::after { box-sizing: border-box; }
.ss-rotor {
  position: relative;
  width: 100%;
  height: 44px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}
.ss-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-1) var(--s-3);
  text-decoration: none;
  color: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms var(--ease);
}
.ss-panel.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}
.ss-emoji {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 16%, transparent);
}
.ss-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.ss-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-xs);
  line-height: var(--lh-tight);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bg);
}
.ss-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 var(--s-2);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}
.ss-dots {
  position: absolute;
  right: var(--s-2);
  bottom: 2px;
  z-index: 2;
  display: flex;
  gap: 4px;
}
.ss-dots button {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  cursor: pointer;
  min-width: 24px;
  min-height: 24px;
  background-clip: content-box;
  padding: 6px;
}
.ss-dots button[aria-current="true"] { background-color: var(--bg); }

.shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-2) var(--s-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.tool-page .shell,
body.article-page .shell { max-width: 720px; }

.shell > main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

/* Header with tabs */
header.site {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s-2) var(--s-4);
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  margin: 0 0 var(--s-2);
  padding: 0 0 var(--s-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
header.site a.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}
header.site nav,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  align-items: center;
  margin: 0;
}
header.site nav a,
header.site nav button,
.tabs button,
.tabs a {
  color: var(--soft);
  text-decoration: none;
  background: transparent;
  border: 0;
  font: 700 15px/1 var(--font-ui);
  min-height: var(--tap);
  min-width: var(--tap);
  padding: var(--s-2) var(--s-3);
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
header.site nav a:hover,
header.site nav a[aria-current="page"],
.tabs button[aria-selected="true"],
.tabs a[aria-current="page"],
.tabs a[aria-selected="true"] {
  color: var(--on-accent);
  background: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero,
.hub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  flex: 0 0 auto;
}
.hero h1,
.hub-head h1 { margin: 0; font-size: var(--fs-lg); }
.lede {
  color: var(--soft);
  margin: 0;
  font-size: var(--fs-body);
}

/* 3x3 bento shelf */
.panels { flex: 1 1 auto; min-height: 0; position: relative; }
.panel-tab { height: 100%; min-height: 0; }
.panel-tab[hidden] { display: none; }

.shelf,
.game-grid,
.tool-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
}

a.game-card,
a.tool-card,
button.tool-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: var(--tap);
  padding: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
a.game-card:hover,
a.tool-card:hover,
button.tool-card:hover { filter: brightness(1.03); text-decoration: none; }
button.tool-card[aria-current="true"] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.thumb {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: var(--accent);
  overflow: hidden;
}
.thumb img,
.thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-copy {
  flex: 0 0 auto;
  padding: var(--s-1) var(--s-2) var(--s-2);
  min-height: 0;
}
.card-copy h2 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.15;
  color: var(--ink);
}
.card-copy p,
.card-copy .badge {
  display: none;
  margin: 2px 0 0;
  color: var(--soft);
  font-size: 0.75rem;
  font-family: var(--font-ui);
  font-weight: 600;
}
@media (min-width: 900px) and (min-height: 820px) {
  .card-copy p,
  .card-copy .badge { display: block; }
  .card-copy h2 { font-size: var(--fs-md); }
  .card-copy { padding: var(--s-2) 10px 10px; }
}

/* Footer */
.shell > footer,
body.kit footer.site-foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  align-items: center;
  justify-content: space-between;
  margin: var(--s-1) 0 0;
  padding-top: var(--s-1);
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: var(--fs-xs);
}
.tip-link,
a.btn,
button.primary,
button.ghost,
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: var(--s-2) var(--s-3);
  text-decoration: none;
  font: 700 var(--fs-body)/1 var(--font-ui);
  border-radius: 999px;
  border: 2px solid var(--accent);
  cursor: pointer;
  color: var(--ink);
  background: var(--card);
}
button.primary,
.tip-link,
a.btn.primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
button.ghost { background: transparent; }
button.primary:hover,
.tip-link:hover,
a.btn:hover { filter: brightness(1.08); text-decoration: none; }

/* Tool / form controls */
.panel {
  background: var(--card);
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-3);
  margin: 0 0 var(--s-2);
}
.field { margin: 0 0 var(--s-2); }
label, .fine { display: block; font-size: var(--fs-xs); color: var(--soft); margin: 0 0 var(--s-1); }
input[type="number"],
input[type="date"],
input[type="text"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px var(--s-3);
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 0; resize: none; line-height: 1.4; }
input[type="color"] {
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  flex: 0 0 var(--tap);
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
.row { display: grid; gap: var(--s-2); }
@media (min-width: 520px) {
  .row.cols-2 { grid-template-columns: 1fr 1fr; }
  .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.seg { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.result {
  border-left: 3px solid var(--accent);
  background: var(--card);
  padding: 10px var(--s-3);
  margin: var(--s-2) 0;
  border-radius: 0 10px 10px 0;
}
.result strong { color: var(--ok); }
.muted { color: var(--soft); }
.tool-scroll,
.article-scroll,
.log-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Start / end cards (game shell overlays) */
.stage-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage[hidden] { display: none; }
.start-card,
.end-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: color-mix(in srgb, var(--bg) 88%, var(--accent));
  z-index: 2;
}
.start-card[hidden],
.end-card[hidden] { display: none; }
.start-card h2,
.end-card h2 {
  font-size: var(--fs-xl);
  color: var(--ink);
  margin: 0;
}
.start-card p,
.end-card p { margin: 0; color: var(--soft); max-width: 28ch; }
.start-pict,
.end-pict {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}
.start-pict svg,
.end-pict svg { width: 64px; height: 64px; }

/* Article / newsletter */
.mast { flex: 0 0 auto; margin: 0 0 var(--s-3); }
.mast__kicker {
  margin: 0 0 var(--s-1);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.mast__title { font-size: var(--fs-xl); margin: 0 0 var(--s-1); }
.mast__date { margin: 0; color: var(--soft); font-size: var(--fs-xs); }
.article-scroll .section { margin: 0 0 var(--s-4); }
.section__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--soft);
  margin: 0 0 var(--s-2);
}
figure.theme {
  margin: 0 0 var(--s-4);
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--accent);
  background: var(--accent);
}
figure.theme svg,
figure.theme img { display: block; width: 100%; height: auto; }
figcaption { padding: var(--s-2) var(--s-3); background: var(--card); color: var(--soft); font-size: var(--fs-xs); }
.article-scroll p { max-width: 62ch; }

/* Dashboard */
body.dash-page .shell { max-width: var(--max); }
.dash {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--s-2);
}
.dash-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}
.dash-nav a,
.dash-nav button {
  min-height: var(--tap);
  padding: var(--s-2) var(--s-3);
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font: 700 var(--fs-xs)/1 var(--font-ui);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.dash-nav a[aria-current="page"],
.dash-nav button[aria-current="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.dash-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
}
.stat-card {
  background: var(--card);
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow);
}
.stat-card h2 { margin: 0; font-size: var(--fs-xs); color: var(--soft); font-family: var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-card .figure {
  font-family: var(--font);
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: var(--s-1) 0 0;
  color: var(--ink);
}
.stat-card .note { margin: auto 0 0; color: var(--soft); font-size: var(--fs-xs); }
@media (min-width: 900px) {
  .dash {
    grid-template-columns: 200px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .dash-nav { flex-direction: column; align-items: stretch; }
  .dash-grid { grid-template-columns: 1fr 1fr 1.2fr; grid-template-rows: 1fr 1fr; }
  .stat-card.log { grid-column: 3; grid-row: 1 / -1; }
}

@media (max-width: 640px) {
  .hub-head { flex-wrap: wrap; gap: 0 var(--s-2); }
  .hub-head h1,
  .hero h1 { font-size: var(--fs-md); }
  header.site a.brand { font-size: 0.95rem; }
  .card-copy { padding: 4px var(--s-1) var(--s-1); }
  .card-copy h2 { font-size: 0.82rem; }
}
