/* LOGIRIS — palette and geometry follow the app (GameColors.swift / GameLayout). */
:root {
  --paper: #f3f3f5;
  --white: #ffffff;
  --ink: #1e1e23;
  --ink-2: #3a3a41;
  --rim: #28282d;
  --panel-rim: #3b3b40;
  --muted: #6c6c72;
  --line: #d1d1d4;
  --groove: #e7e7e9;
  --cell: #f9f9fa;
  --block: #3b79e1;
  --block-light: #5690ee;
  --cross: #ee7522;
  --clear: #1f9e5e;
  --bust: #d63c3c;
  --clear-text: #157a46;        /* darker for small text contrast */
  --bust-text: #b52f2f;
  --night: #1b1b20;

  --font: "M PLUS 1", "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  --font-code: "M PLUS 1 Code", ui-monospace, "SF Mono", monospace;
  --gutter: 16px;
  --max: 1160px;
  --header-h: 64px;
  --ease-out: cubic-bezier(.2, .8, .25, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.9;
  overflow-x: clip;
  /* Japanese: wrap only at phrase boundaries (<wbr>) and punctuation. */
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-break: strict;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
p { text-wrap: pretty; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--block);
  outline-offset: 3px;
  border-radius: 4px;
}

.nowrap { white-space: nowrap; }

/* One sentence per line: every sentence in body copy starts on a new line. */
.s { display: block; text-wrap: pretty; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--rim);
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
}

.section-title {
  font-weight: 900;
  font-size: clamp(30px, 5.2vw, 54px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.section-title--light { color: #fff; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 0.25s, box-shadow 0.25s;
}
.site-header.is-scrolled {
  background: rgb(243 243 245 / 0.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  box-shadow: 0 1px 0 rgb(40 40 45 / 0.12);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand__icon { width: 32px; height: 32px; }
.brand__name {
  font-family: var(--font-code);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2em;
}

.brand__name,
.site-nav a { white-space: nowrap; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

@media (max-width: 379px) {
  .brand__name { display: none; }
  .site-nav { gap: 14px; }
}
.site-nav__link {
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  padding-block: 6px;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 100% 2px;
}
.site-nav__link[aria-current="page"] { background-image: linear-gradient(var(--block), var(--block)); }
.site-nav__cta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding-inline: 16px;
  border-radius: 999px;
  background: var(--rim);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.2s;
}
.site-nav__cta:hover { background: #000; }

/* ---------- App Store badge ---------- */

.badge-link {
  display: inline-block;
  flex: none;
  border-radius: 12px;
  transition: transform 0.2s var(--ease-out);
}
.badge-link:hover { transform: translateY(-2px); }
.badge-link img { height: 60px; width: auto; }
.badge-link--large img { height: 64px; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: clip;
  margin-top: calc(var(--header-h) * -1);
  padding-top: var(--header-h);
  border-bottom: 2px solid var(--rim);
}

.hero__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgb(40 40 45 / 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(40 40 45 / 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 30%, transparent 75%);
}

.hero__inner {
  position: relative;
  display: grid;
  gap: 56px;
  padding-top: 40px;
}

.hero__title { display: grid; gap: 28px; }

.app-id {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
}
.app-id__icon {
  flex: none;
  width: clamp(96px, 20vw, 152px);
  height: auto;
  filter: drop-shadow(0 14px 22px rgb(30 30 38 / 0.18)) drop-shadow(0 2px 4px rgb(30 30 38 / 0.12));
}
.app-id__name {
  display: grid;
  gap: 6px;
  font-family: var(--font-code);
  font-weight: 700;
  font-size: clamp(26px, 4.6vw, 44px);
  line-height: 1;
  letter-spacing: 0.2em;
}
.app-id__name small {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(12px, 1.6vw, 15px);
  letter-spacing: 0.3em;
  color: var(--muted);
}

.hero__sub {
  display: block;
  font-weight: 900;
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero__lead {
  margin-top: 20px;
  max-width: 31em;
  font-size: 17px;
  color: var(--ink-2);
}

.hero__actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}
.hero__note {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

/* stage: phone rises from the bottom edge of the hero */
.hero__stage {
  --w: min(300px, 80vw);
  display: flex;
  justify-content: center;
  perspective: 1600px;
  margin-bottom: calc(var(--w) * -0.42);
}

@media (min-width: 960px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr) 420px;
    align-items: start;
    column-gap: 56px;
    padding-top: 72px;
  }
  .hero__copy { padding-bottom: 120px; }
  .hero__stage { --w: 360px; margin-bottom: -150px; }
}

/* ---------- phone ---------- */

.phone {
  --rx: 6deg;
  --ry: -14deg;
  flex: none;
  width: var(--w);
  padding: calc(var(--w) * 0.032);
  border-radius: calc(var(--w) * 0.165);
  background: linear-gradient(150deg, #4a4a51 0%, #1d1d21 32%, #2a2a2f 70%, #43434a 100%);
  box-shadow:
    inset 0 0 0 1.5px rgb(255 255 255 / 0.14),
    inset 0 0 0 calc(var(--w) * 0.012) #141417,
    0 60px 90px -40px rgb(30 30 38 / 0.55),
    0 24px 36px -18px rgb(30 30 38 / 0.35);
  transform: rotateX(var(--rx)) rotateY(var(--ry)) rotateZ(1.5deg);
  transition: transform 0.7s var(--ease-out);
}
.phone.is-flat { --rx: 0deg; --ry: 0deg; }

.phone__screen {
  --pt: calc(100cqi / 402);
  position: relative;
  container-type: inline-size;
  aspect-ratio: 402 / 874;
  overflow: hidden;
  border-radius: calc(var(--w) * 0.135);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-code);
  word-break: normal;
}
.phone__fallback { width: 100%; height: 100%; object-fit: cover; }

.ph-island {
  position: absolute;
  top: calc(11 * var(--pt));
  left: 50%;
  width: calc(124 * var(--pt));
  height: calc(36 * var(--pt));
  transform: translateX(-50%);
  border-radius: 99px;
  background: #000;
}
.ph-status {
  position: absolute;
  inset: 0 0 auto;
  height: calc(56 * var(--pt));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(4 * var(--pt)) calc(36 * var(--pt)) 0 calc(46 * var(--pt));
  font-family: var(--font);
  font-weight: 700;
  font-size: calc(17 * var(--pt));
}
.ph-status__icons { display: flex; align-items: center; gap: calc(6 * var(--pt)); }
.ph-status__icons svg { display: block; height: calc(12 * var(--pt)); width: auto; }

.ph-board {
  position: absolute;
  left: calc(7 * var(--pt));
  top: calc(160 * var(--pt));
  width: calc(310 * var(--pt));
}
.ph-side {
  position: absolute;
  left: calc(324 * var(--pt));
  top: calc(160 * var(--pt));
  width: calc(69 * var(--pt));
  display: grid;
  gap: calc(5 * var(--pt));
}
.ph-panel {
  border: calc(2.5 * var(--pt)) solid var(--panel-rim);
  border-radius: calc(6 * var(--pt));
  background: var(--cell);
  padding: calc(5 * var(--pt)) calc(4 * var(--pt)) calc(4 * var(--pt));
  display: grid;
  gap: calc(3 * var(--pt));
}
.ph-label {
  font-weight: 700;
  font-size: calc(9.5 * var(--pt));
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: #7a7a80;
  padding-left: calc(3 * var(--pt));
}
.ph-divider { height: 1px; background: var(--line); margin-block: calc(3 * var(--pt)); }
.ph-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(3 * var(--pt));
  border: calc(1.5 * var(--pt)) solid #7a7a80;
  border-radius: calc(4 * var(--pt));
  background: var(--cell);
  font-weight: 700;
  font-size: calc(8.5 * var(--pt));
  letter-spacing: 0.1em;
  color: #7a7a80;
}
.ph-button--pause { height: calc(30 * var(--pt)); }
.ph-button--memo { height: calc(174 * var(--pt)); }

.ph-hud {
  position: absolute;
  left: calc(10 * var(--pt));
  top: calc(672 * var(--pt));
  width: calc(382 * var(--pt));
  height: calc(40 * var(--pt));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  border: calc(2.5 * var(--pt)) solid var(--panel-rim);
  border-radius: calc(5 * var(--pt));
  background: var(--cell);
}
.ph-hud > div {
  display: grid;
  justify-items: center;
  line-height: 1.15;
  border-left: 1px solid var(--line);
}
.ph-hud > div:first-child { border-left: 0; }
.ph-hud small {
  font-weight: 700;
  font-size: calc(7 * var(--pt));
  letter-spacing: 0.1em;
  color: #7a7a80;
}
.ph-hud strong {
  font-weight: 700;
  font-size: calc(13 * var(--pt));
  font-variant-numeric: tabular-nums;
}
.ph-home {
  position: absolute;
  left: 50%;
  bottom: calc(9 * var(--pt));
  width: calc(140 * var(--pt));
  height: calc(5 * var(--pt));
  transform: translateX(-50%);
  border-radius: 99px;
  background: #111;
}

/* mini piece (NEXT / KEEP windows) */
.piece-window {
  display: grid;
  place-items: center;
  height: var(--win-h, calc(34 * var(--pt)));
  border-radius: calc(3 * var(--pt));
  background: var(--groove);
}
.piece {
  --c: var(--piece-cell, calc(9 * var(--pt)));
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--c));
  grid-auto-rows: var(--c);
  gap: 1px;
}
.piece i {
  display: block;
  position: relative;
  border-radius: 1px;
  background: var(--block);
}
.piece i.is-x { background: var(--cross); }
.piece i.is-x::before,
.piece i.is-x::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 50%;
  height: 12%;
  margin-top: -6%;
  background: #fff;
  transform: rotate(45deg);
}
.piece i.is-x::after { transform: rotate(-45deg); }
.piece i.is-empty { background: none; }

/* ---------- board (shared by phone, story, try, howto) ---------- */

.board {
  --gap: 2px;
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
  background: var(--groove);
  border: 3px solid var(--rim);
  border-radius: 8px;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 3fr) repeat(10, minmax(0, 1fr));
  gap: var(--gap);
  transition: opacity 0.3s;
}

.hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5em;
  padding-right: 0.5em;
  background: var(--cell);
  border-radius: 2px;
  font-family: var(--font-code);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.2s;
}

.cell {
  position: relative;
  aspect-ratio: 1;
  background: var(--cell);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.2s;
}
.cell.is-block { background: var(--block); box-shadow: none; }
.cell.is-falling { background: var(--block-light); box-shadow: none; }
.cell.is-x { background: var(--cross); box-shadow: none; }
.cell.is-x::before,
.cell.is-x::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 9%;
  margin-top: -4.5%;
  background: #fff;
  border-radius: 1px;
  transform: rotate(45deg);
}
.cell.is-x::after { transform: rotate(-45deg); }
.cell.is-falling.is-x { background: #f58d3b; }
.cell.is-ghost { box-shadow: inset 0 0 0 2px var(--block); background: var(--cell); }
.cell.is-ghost-x { box-shadow: inset 0 0 0 2px var(--cross); background: var(--cell); }

/* row overlays */
.row::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}
.row.is-clear-preview::after,
.row.is-clear::after {
  opacity: 1;
  background: rgb(26 158 84 / 0.16);
}
.row.is-bust-preview::after {
  opacity: 1;
  background:
    repeating-linear-gradient(-45deg, rgb(214 60 60 / 0.22) 0 2px, transparent 2px 7px),
    rgb(214 60 60 / 0.1);
}
.row.is-clearing::after {
  opacity: 1;
  background: rgb(46 189 107 / 0.45);
  transition: none;
}
.row.is-clear-preview .hint,
.row.is-clearing .hint,
.row.is-clear .hint { color: var(--clear); }
.row.is-bust-preview .hint { color: var(--bust); }

/* standing BUST rows (app: desaturated cells, hatch while HP = 2) */
.row.is-bust .cell.is-block { background: #b3acbc; }
.row.is-bust .cell.is-x { background: #c2a69e; }
.row.is-bust .cell:not(.is-block):not(.is-x) { background: #eeeaea; }
.row.is-bust .hint { color: #948985; }
.row.is-bust::after {
  opacity: 1;
  background:
    repeating-linear-gradient(-45deg, rgb(92 92 97 / 0.3) 0 2px, transparent 2px 7px),
    rgb(123 123 128 / 0.12);
}
.row.is-bust.is-hp1::after { background: rgb(123 123 128 / 0.14); }

/* BUST rows next to a clearing row (app: yellow = HP drops, blue = swept away) */
.row.is-damage-preview::after { opacity: 1; background: rgb(245 222 51 / 0.24); }
.row.is-sweep-preview::after { opacity: 1; background: rgb(51 133 230 / 0.22); }
.row.is-damage::after { opacity: 1; background: rgb(224 178 15 / 0.34); transition: none; }
.row.is-sweep::after { opacity: 1; background: rgb(222 110 26 / 0.3); transition: none; }
.row.is-damage-preview .hint,
.row.is-damage .hint { color: #a07a0a; }
.row.is-sweep-preview .hint { color: #2e6bd1; }

.row.is-dim { opacity: 0.35; }

/* run outlines (story: reading a hint) */
.run {
  grid-row: 1;
  position: relative;
  z-index: 2;
  border: 3px solid var(--ink);
  border-radius: 6px;
  margin: -4px;
  pointer-events: none;
  animation: run-in 0.35s var(--ease-out) both;
}
.run b {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  min-width: 1.7em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-code);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}
@keyframes run-in {
  from { opacity: 0; transform: scale(1.08); }
}

.board--phone {
  --gap: 1px;
  padding: 1px;
  border-width: calc(2.5 * var(--pt));
  border-radius: calc(5 * var(--pt));
}
.board--phone .row { grid-template-columns: minmax(0, 2.12fr) repeat(10, minmax(0, 1fr)); }
.board--phone .hint {
  font-size: calc(10.5 * var(--pt));
  gap: calc(4 * var(--pt));
  padding-right: calc(5 * var(--pt));
}
.board--phone .cell.is-ghost { box-shadow: inset 0 0 0 1px var(--block); }
.board--phone .cell.is-ghost-x { box-shadow: inset 0 0 0 1px var(--cross); }

.board--story .hint { font-size: clamp(13px, 3.6vw, 18px); }
.board--row .hint { font-size: clamp(12px, 3.4vw, 16px); }

/* ---------- rules: sticky story board ---------- */

.rules { padding-block: 120px 40px; }

.rules__layout {
  display: grid;
  margin-top: 32px;
}

.rules__stage {
  position: sticky;
  top: var(--header-h);
  z-index: 3;
  align-self: start;
  padding-block: 12px 16px;
  background: var(--paper);
}

.story-progress {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.story-progress li {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--cell);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.3s, box-shadow 0.3s;
}
.story-progress li.is-on { background: var(--block); box-shadow: none; }

.story-step {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 32px;
  opacity: 0.28;
  transition: opacity 0.35s;
}
.story-step.is-active { opacity: 1; }
.story-step h3 {
  font-weight: 900;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.4;
  text-wrap: balance;
}
.story-step p {
  margin-top: 16px;
  max-width: 30em;
  font-size: 17px;
  color: var(--ink-2);
}

@media (min-width: 960px) {
  .rules { padding-block: 160px 80px; }
  .rules__layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    column-gap: 80px;
    margin-top: 0;
  }
  .rules__stage {
    grid-column: 2;
    grid-row: 1;
    top: calc(50vh - 170px);
    padding: 0;
    background: none;
  }
  .story-steps { grid-column: 1; grid-row: 1; }
  .story-step { min-height: 78vh; }
}

/* ---------- try it ---------- */

.try-section { padding-block: 64px 120px; }

.try {
  display: grid;
  gap: 28px;
  padding: 28px 20px 24px;
  border: 2px solid var(--rim);
  border-radius: 24px;
  background: var(--white);
}

.try__title {
  font-weight: 900;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.35;
  text-wrap: balance;
}
.try__desc { margin-top: 10px; max-width: 30em; color: var(--ink-2); }

/* same proportions as the in-game row: hint plate on the left, then 10 cells */
.board--try { --gap: 2px; }
.board--try .row { grid-template-columns: minmax(0, 2.12fr) repeat(10, minmax(0, 1fr)); }
.board--try .hint { font-size: clamp(13px, 3.6vw, 22px); }
.board--try .cell {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 3px;
}
.board--try .cell:hover:not(.is-block) { background: #e9f0fc; }
.board--try .cell:active { transform: scale(0.92); }
.board--try .cell:focus-visible { outline-offset: 2px; z-index: 3; }

.try__foot {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 34px;
}
.try__status { font-size: 15px; line-height: 1.6; }
.try__status.is-clear { color: var(--clear-text); font-weight: 700; }
.try__status.is-bust { color: var(--bust-text); font-weight: 700; }

.text-button {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  cursor: pointer;
}

/* phones: let the card run edge to edge so the cells stay large enough to tap */
@media (max-width: 519px) {
  .try {
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: 12px;
    border-inline: 0;
    border-radius: 0;
  }
  .try__head { padding-inline: 8px; }
  .try__foot { padding-inline: 4px; }
}
@media (max-width: 359px) {
  .try { padding-inline: 6px; }
  .try__head { padding-inline: 10px; }
  .try__foot { padding-inline: 10px; }
  .board--try .row { grid-template-columns: minmax(0, 1.5fr) repeat(10, minmax(0, 1fr)); }
  .board--try .hint { font-size: 11px; gap: 0.35em; padding-right: 0.35em; }
}
@media (min-width: 720px) {
  .try { padding: 40px; }
  .board--try { --gap: 3px; }
}
@media (min-width: 960px) {
  .try {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
    align-items: center;
    column-gap: 64px;
    padding: 56px;
  }
}

/* ---------- score (night panel) ---------- */

.score {
  background: var(--night);
  color: #c9c9cf;
  padding-block: 96px;
  overflow: clip;
}
.score__inner {
  display: grid;
  gap: 56px;
  align-items: end;
}
.score__copy p { margin-top: 20px; max-width: 28em; font-size: 17px; }
.score__copy p + p { margin-top: 10px; }

.bars {
  --c: clamp(10px, 2.9vw, 17px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #4a4a51;
}
.bar {
  display: grid;
  justify-items: center;
  gap: 10px;
}
.bar__rate {
  font-family: var(--font-code);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar:nth-child(1) .bar__rate { font-size: clamp(14px, 3.4vw, 18px); }
.bar:nth-child(2) .bar__rate { font-size: clamp(15px, 3.8vw, 22px); }
.bar:nth-child(3) .bar__rate { font-size: clamp(17px, 4.6vw, 28px); }
.bar:nth-child(4) .bar__rate { font-size: clamp(19px, 5.4vw, 36px); }
.bar:nth-child(5) .bar__rate { font-size: clamp(22px, 6.6vw, 46px); color: #5bd48f; }
.bar__stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
}
.bar__stack i {
  display: block;
  width: var(--c);
  height: var(--c);
  border-radius: 2px;
  background: var(--block);
}
.bar--top .bar__stack i { background: #2ebd6b; }
.bar__rows {
  font-size: 13px;
  color: #9a9aa2;
  white-space: nowrap;
}

.bars.is-ready .bar__stack i {
  opacity: 0;
  transform: translateY(-24px);
}
.bars.is-in .bar__stack i {
  opacity: 1;
  transform: none;
  transition: opacity 0.2s, transform 0.35s var(--ease-out);
  transition-delay: calc(var(--i) * 35ms + var(--b) * 90ms);
}

@media (min-width: 960px) {
  .score { padding-block: 140px; }
  .score__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    column-gap: 80px;
  }
  .bars { gap: 16px; }
}

/* ---------- features (bento) ---------- */

.features { padding-block: 120px 40px; }

.bento {
  margin-top: 48px;
  display: grid;
  gap: 16px;
}

.tile-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  padding: 28px 24px;
  border: 2px solid var(--rim);
  border-radius: 24px;
  background: var(--white);
  overflow: hidden;
}
.tile-card h3 {
  font-weight: 900;
  font-size: clamp(21px, 2.3vw, 26px);
  line-height: 1.45;
  text-wrap: balance;
}
.tile-card p {
  margin-top: 10px;
  color: var(--ink-2);
}
.tile-card p + p { margin-top: 8px; }

/* Everything under the text fills the rest of the tile, so equal-height
   tiles never leave a gap between the description and the visual. */
.tile-card__media {
  flex: 1;
  display: grid;
  place-items: center;
}
.tile-card__panel {
  flex: 1;
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 132px;
  padding: 24px;
  border-radius: 16px;
  background: var(--paper);
}

.tile-card__shot {
  width: 100%;
  border: 2px solid var(--rim);
  border-radius: 14px;
}
.tile-card__shot--result {
  width: min(100%, 320px);
  aspect-ratio: 640 / 450;
  object-fit: cover;
  object-position: top;
}

.mini-queue {
  /* five NEXT windows always fit on one line */
  --win: min(46px, calc((100cqi - 24px) / 5));
  container-type: inline-size;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
}
.mini-queue__group { display: grid; gap: 6px; }
.mini-queue__label {
  font-family: var(--font-code);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.mini-queue__row {
  display: flex;
  gap: 6px;
}
.mini-queue .piece-window {
  --win-h: var(--win);
  --piece-cell: calc(var(--win) * 0.17);
  width: var(--win);
  border-radius: 8px;
  background: var(--white);
}
.mini-queue__group--keep .piece-window { box-shadow: inset 0 0 0 2px var(--rim); }

/* the in-app main menu row */
.menu-replica {
  padding-block: 14px 12px;
  border-block: 2px solid var(--rim);
  font-family: var(--font-code);
  font-weight: 700;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: 0.04em;
}
.menu-replica small {
  display: block;
  margin-top: 4px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
}

.share-sample__post {
  font-size: 17px;
  line-height: 1.7;
}
.share-sample__tag { margin-top: 4px; color: var(--block); }
.share-sample figcaption {
  font-size: 13px;
  color: var(--muted);
}

@media (min-width: 640px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-card--memo { grid-column: span 2; }
}
@media (min-width: 900px) {
  /* wide memo tile: description left, screenshot right */
  .tile-card--memo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    column-gap: 36px;
  }
}
@media (min-width: 960px) {
  .features { padding-block: 160px 56px; }
  .bento { gap: 20px; }
  .tile-card { padding: 36px 32px; }
}
@media (min-width: 1100px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tile-card--memo { grid-column: span 4; }
  .tile-card--next,
  .tile-card--resume,
  .tile-card--record,
  .tile-card--share { grid-column: span 2; }
}

/* ---------- modes (echoes the in-app menu) ---------- */

.modes { padding-block: 80px 120px; }
@media (min-width: 960px) { .modes { padding-block: 104px 160px; } }

.mode-list {
  margin-top: 40px;
  border-bottom: 2px solid var(--rim);
}
.mode {
  display: grid;
  gap: 8px;
  padding-block: 26px 28px;
  border-top: 2px solid var(--rim);
}
.mode__name {
  font-family: var(--font-code);
  font-weight: 700;
  font-size: clamp(32px, 7.6vw, 60px);
  line-height: 1.1;
  letter-spacing: 0.06em;
}
.mode__body { max-width: 32em; color: var(--ink-2); }

@media (min-width: 960px) {
  .mode {
    grid-template-columns: 500px minmax(0, 1fr);
    column-gap: 48px;
    align-items: center;
    padding-block: 32px;
  }
}

/* ---------- closing ---------- */

.closing {
  padding-block: 88px 96px;
  background: var(--white);
  border-top: 2px solid var(--rim);
}
.closing__inner { container-type: inline-size; }

.closing__icon {
  width: clamp(88px, 14vw, 128px);
  height: auto;
  margin-bottom: 28px;
  filter: drop-shadow(0 12px 20px rgb(30 30 38 / 0.16)) drop-shadow(0 2px 4px rgb(30 30 38 / 0.1));
}

.closing__wordmark {
  font-family: var(--font-code);
  font-weight: 700;
  font-size: clamp(48px, 15vw, 210px);
  font-size: clamp(48px, 18cqi, 214px);
  line-height: 1;
  letter-spacing: 0.2em;
}

.closing__row {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px 48px;
}
.closing__text {
  font-weight: 800;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.55;
}

.closing__spec {
  margin-top: 40px;
  display: grid;
  border-top: 1px solid var(--line);
}
.closing__spec > div {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 16px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.closing__spec dt { color: var(--muted); }
.closing__spec a { font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 4px; }

@media (min-width: 960px) {
  .closing { padding-block: 120px; }
  .closing__spec {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    column-gap: 32px;
  }
  /* wide screens: label above value, so every value stays on one line */
  .closing__spec > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding-block: 14px 16px;
  }
  .closing__spec dt { font-size: 13px; }
  .closing__spec dd { white-space: nowrap; }
}

.closing--compact .closing__wordmark { font-size: clamp(40px, 11cqi, 112px); }
@media (min-width: 960px) {
  .closing--compact { padding-block: 96px; }
}

/* ---------- howto page ---------- */

.page-head { padding-block: 40px 72px; }
.page-title {
  font-weight: 900;
  font-size: clamp(44px, 10vw, 96px);
  line-height: 1.15;
}
.page-lead {
  margin-top: 20px;
  max-width: 32em;
  font-size: 17px;
  color: var(--ink-2);
}

.section { padding-block: 72px; border-top: 2px solid var(--rim); }
@media (min-width: 960px) { .section { padding-block: 104px; } }

.section__lead {
  margin-top: 16px;
  max-width: 34em;
  color: var(--ink-2);
}

.rule-list {
  margin-top: 48px;
  display: grid;
  gap: 40px;
}
.rule { display: grid; gap: 16px; }
.rule__visual {
  display: grid;
  gap: 8px;
  max-width: 520px;
}
.rule__text h3 {
  font-weight: 800;
  font-size: 20px;
  line-height: 1.5;
}
.rule__text p {
  margin-top: 6px;
  max-width: 32em;
  color: var(--ink-2);
}

.result-tag {
  font-family: var(--font-code);
  color: var(--bust-text);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
}
.result-tag.is-clear { color: var(--clear-text); }

@media (min-width: 960px) {
  .rule-list { gap: 48px; }
  .rule {
    grid-template-columns: 520px minmax(0, 1fr);
    column-gap: 56px;
    align-items: center;
  }
}

.feature-list {
  margin-top: 40px;
  display: grid;
  gap: 28px 56px;
}
@media (min-width: 720px) {
  .feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.feature dt {
  font-weight: 800;
  font-size: 18px;
}
.feature dd {
  margin-top: 4px;
  max-width: 30em;
  color: var(--ink-2);
}

/* ---------- footer ---------- */

.site-footer {
  background: var(--rim);
  color: #d9d9dd;
  font-size: 14px;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 32px;
  padding-block: 32px 40px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.footer-links a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: #77777e;
}
.footer-links a:hover { color: #fff; text-decoration-color: currentColor; }
.copyright { color: #9a9aa0; }
.site-footer :focus-visible,
.score :focus-visible { outline-color: #8fb4f5; }

/* ---------- entrance (hero only) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .app-id__icon { animation: tile-drop 0.7s var(--ease-out) 0.1s both; }
  .js .app-id__name { animation: rise 0.6s var(--ease-out) 0.3s both; }
  .js .hero__sub,
  .js .hero__lead,
  .js .hero__actions {
    animation: rise 0.7s var(--ease-out) both;
    animation-delay: 0.5s;
  }
  .js .hero__lead { animation-delay: 0.58s; }
  .js .hero__actions { animation-delay: 0.66s; }
  .js .hero__stage { animation: stage-in 1s var(--ease-out) 0.25s both; }
}

@keyframes tile-drop {
  0% { opacity: 0; transform: translateY(-70%); }
  55% { opacity: 1; transform: translateY(5%); }
  100% { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}
@keyframes stage-in {
  from { opacity: 0; transform: translateY(80px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
}
