/* ==========================================================================
   Landing (.ld-), home hub (.home-) and duel setup (.duel-).
   Built on the shared components of css/system.css (.card, .btn, .chip, ...);
   only layout and the few one-off decorations live here.
   ========================================================================== */

/* ── Landing ── */
.ld {
  position: relative;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  overflow-x: clip;
}

.ld-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
}

/* The library photograph under three scrims: dark on the text side (left), dark
   at the bottom (it melts into the page), and a light veil under the header. */
.ld-hero-bg {
  /* Declared here (not as a token in styles.css): a url() inside a custom
     property resolves against the stylesheet that USES it, so the path is
     written relative to css/. JPEG for browsers without image-set() / WebP. */
  --ld-photo: url("../assets/landing/maestro.jpg");
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(4, 8, 14, 0.95) 0%, rgba(4, 8, 14, 0.87) 34%, rgba(4, 8, 14, 0.5) 62%, rgba(4, 8, 14, 0.14) 100%),
    linear-gradient(0deg, var(--color-bg) 0%, rgba(4, 8, 14, 0) 32%),
    linear-gradient(180deg, rgba(4, 8, 14, 0.62) 0%, rgba(4, 8, 14, 0) 24%),
    var(--ld-photo) 80% 58% / cover no-repeat,
    #0b1118;
  /* Short on purpose: the photograph is the largest paint of the page, a long fade delays it. */
  animation: ld-bg-in 0.8s var(--ease-out) both;
}
/* WebP in three sizes, picked by screen density (image-set resolution descriptors) and, through the media query,
   by layout: a phone shows the picture at 72% of its height, a desktop covers the whole hero. The 2816 px original
   is only for 2x/3x screens (it decodes to ~17 MB). js/boot.js preloads exactly these candidates (same media
   queries, same descriptors) for first-time visitors, so keep the two lists in step. */
@supports (background-image: image-set(url("../assets/landing/maestro.webp") type("image/webp"))) {
  .ld-hero-bg {
    --ld-photo: image-set(
      url("../assets/landing/maestro-2000.webp") type("image/webp") 1x,
      url("../assets/landing/maestro.webp") type("image/webp") 2x,
      url("../assets/landing/maestro.jpg") type("image/jpeg") 1x
    );
  }
}
@media (max-width: 899px) {
  @supports (background-image: image-set(url("../assets/landing/maestro.webp") type("image/webp"))) {
    .ld-hero-bg {
      --ld-photo: image-set(
        url("../assets/landing/maestro-1280.webp") type("image/webp") 1x,
        url("../assets/landing/maestro-2000.webp") type("image/webp") 2x,
        url("../assets/landing/maestro.webp") type("image/webp") 3x,
        url("../assets/landing/maestro.jpg") type("image/jpeg") 1x
      );
    }
  }
}

.ld-hero-inner {
  display: grid;
  gap: var(--space-4);
  width: min(var(--page-max), calc(100% - 2 * var(--page-gutter)));
  margin-inline: auto;
  padding: calc(var(--header-h) + var(--space-9)) 0 clamp(40px, 11vh, 120px);
}
.ld-hero-inner > * { max-width: 40rem; margin: 0; }

.ld-eyebrow { letter-spacing: 0.18em; }
.ld-title {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
  text-wrap: balance;
}
.ld-lead {
  max-width: 34rem;
  font-size: clamp(1.05rem, 0.95rem + 0.55vw, 1.35rem);
  line-height: 1.55;
  color: rgba(229, 232, 236, 0.92);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.6);
  text-wrap: pretty;
}
.ld-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2) !important;
}
.ld-cta { min-width: 15rem; }
.ld-how-link { color: var(--color-text); background: rgba(9, 16, 25, 0.5); border-color: var(--color-hairline-strong); }
.ld-assure {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

@keyframes ld-bg-in {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 899px) {
  /* Portrait and small tablets: the photograph fills the top of the screen (so the
     pieces sit above the text, not behind it) and dissolves into the page colour.
     The bottom scrim is measured from the bottom edge in rem, where the text is
     anchored, so it follows the text however tall the screen is or big the type. */
  .ld-hero-bg {
    background:
      linear-gradient(0deg, var(--color-bg) 0, rgba(4, 8, 14, 0.97) 24rem, rgba(4, 8, 14, 0.6) 27rem, rgba(4, 8, 14, 0.14) 33rem, rgba(4, 8, 14, 0) 42rem),
      linear-gradient(180deg, rgba(4, 8, 14, 0.5) 0, rgba(4, 8, 14, 0) 8rem),
      var(--ld-photo) 56% 0 / auto 72% no-repeat,
      var(--color-bg);
  }
}
@media (min-width: 720px) and (max-width: 899px) {
  /* Tablets have a taller bottom margin and shorter text block: the opaque part of the scrim moves up. */
  .ld-hero-bg {
    background:
      linear-gradient(0deg, var(--color-bg) 0, rgba(4, 8, 14, 0.97) 28rem, rgba(4, 8, 14, 0.6) 31rem, rgba(4, 8, 14, 0.14) 37rem, rgba(4, 8, 14, 0) 46rem),
      linear-gradient(180deg, rgba(4, 8, 14, 0.5) 0, rgba(4, 8, 14, 0) 8rem),
      var(--ld-photo) 56% 0 / auto 72% no-repeat,
      var(--color-bg);
  }
}
@media (max-width: 719px) {
  .ld-hero-inner { gap: var(--space-3); padding-top: calc(var(--header-h) + var(--space-7)); padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); }
  .ld-actions { flex-direction: column; align-items: stretch; }
  .ld-cta { min-width: 0; width: 100%; }
  .ld-how-link { width: 100%; }
}
/* Short viewports (landscape phones): keep the CTA on screen. */
@media (max-height: 560px) and (min-width: 720px) {
  .ld-hero-inner { padding-top: calc(var(--header-h) + var(--space-5)); padding-bottom: var(--space-6); gap: var(--space-2); }
  .ld-title { font-size: clamp(2.2rem, 6vw, 3.4rem); }
}

.ld-body { position: relative; background: var(--color-bg); }

.ld-section {
  width: min(1120px, calc(100% - 2 * var(--page-gutter)));
  margin-inline: auto;
  padding-top: clamp(56px, 9vw, 112px);
}
.ld-section-head { display: grid; gap: 10px; max-width: 46rem; margin-bottom: var(--space-7); }
.ld-h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* Steps */
.ld-step-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ld-step {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  align-content: start;
  gap: var(--space-2);
  overflow: hidden;
}
.ld-step-visual {
  display: grid;
  place-items: center;
  min-height: 208px;
  margin: calc(var(--card-pad) * -1) calc(var(--card-pad) * -1) var(--space-4);
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-hairline);
  background:
    radial-gradient(240px 140px at 50% 0, rgba(221, 167, 52, 0.09), transparent 70%),
    var(--color-surface-2);
}
.ld-step-num {
  margin: 0;
  color: var(--color-gold);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.ld-step-title { margin: 0; font-size: var(--text-xl); font-weight: 650; line-height: 1.2; text-wrap: balance; }
.ld-step-body { margin: 0; color: var(--color-text-muted); line-height: 1.55; }

.ld-step2-visual { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-4); }
.ld-step2-legend { display: grid; justify-items: center; gap: var(--space-2); }
.ld-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 600;
}
.ld-swatch::before { content: ""; width: 20px; height: 5px; border-radius: 3px; background: var(--sw, var(--color-gold)); }
.ld-swatch-user { --sw: var(--color-good); }
.ld-swatch-best { --sw: var(--color-perfect); }

.ld-step3-visual { display: grid; gap: var(--space-4); width: 100%; max-width: 300px; }
.ld-step3-label { margin: 0; text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 600; }
.ld-intervals {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ld-intervals::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--color-surface-4);
}
.ld-interval { position: relative; display: grid; flex: 1 1 0; justify-items: center; gap: 8px; }
.ld-interval-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-on-gold);
}
.ld-interval.is-now .ld-interval-dot { border-color: var(--gold-500); background: var(--color-gold); }
.ld-interval-text { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-interval.is-now .ld-interval-text { color: var(--color-gold); }

/* Two sources */
.ld-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: var(--space-5);
}
.ld-feature { --card-pad: clamp(24px, 3vw, 36px); display: grid; align-content: start; gap: var(--space-3); }
.ld-feature-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--color-gold-dim);
  border-radius: 16px;
  background: var(--color-gold-bg);
  color: var(--color-gold);
}
.ld-feature-title { margin: var(--space-2) 0 0; font-family: var(--font-display); font-size: 1.9rem; font-weight: 650; line-height: 1.1; }
.ld-feature-body { margin: 0; color: var(--color-text-muted); font-size: var(--text-md); line-height: 1.6; max-width: 46ch; }

/* Private by design */
.ld-private-panel {
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid var(--color-hairline-strong);
  border-radius: 28px;
  background:
    radial-gradient(640px 260px at 8% 0, rgba(221, 167, 52, 0.09), transparent 70%),
    var(--color-surface);
  box-shadow: var(--shadow-2);
}
.ld-private-panel .ld-section-head { margin-bottom: var(--space-6); }
.ld-private-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ld-private-item { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: start; }
.ld-private-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-hairline-strong);
  border-radius: 12px;
  background: var(--color-surface-3);
  color: var(--color-gold);
}
.ld-private-title { margin: 0 0 4px; font-size: var(--text-lg); font-weight: 650; }
.ld-private-body { margin: 0; color: var(--color-text-muted); line-height: 1.55; }

/* Closing call to action */
.ld-final { display: grid; justify-items: center; gap: var(--space-4); text-align: center; }
.ld-final-body { margin: 0; max-width: 40ch; color: var(--color-text-muted); font-size: var(--text-lg); line-height: 1.5; }

/* Footer */
.ld-footer {
  margin-top: clamp(64px, 9vw, 120px);
  padding: var(--space-8) 0 calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-hairline);
  background: var(--color-surface);
}
.ld-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: var(--space-7);
  align-items: start;
  width: min(1120px, calc(100% - 2 * var(--page-gutter)));
  margin-inline: auto;
}
.ld-footer-brand { display: flex; align-items: center; gap: var(--space-3); }
.ld-footer-mark { border-radius: 11px; }
.ld-footer-name { margin: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 650; line-height: 1.1; }
.ld-footer-tag { margin: 2px 0 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.ld-footer-links { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; color: var(--color-text-muted); font-size: var(--text-sm); }
.ld-footer-links a { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0; color: var(--color-text); text-underline-offset: 3px; }
.ld-footer-lang { display: grid; gap: var(--space-2); justify-items: start; }
.ld-footer-lang-label { color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.ld-lang {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  overflow: hidden;
}
.ld-lang-btn {
  min-width: 56px;
  min-height: var(--hit);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.ld-lang-btn:hover { background: var(--color-surface-3); color: var(--color-text); }
.ld-lang-btn[aria-checked="true"] { background: var(--color-gold-bg); color: var(--color-gold); box-shadow: inset 0 0 0 1px var(--color-gold-dim); }
/* Inside the clipping pill: the ring goes inward (a custom property, see the note above the global ring in styles.css). */
.ld-lang-btn { --focus-ring-offset: -3px; }
.ld-lang-btn:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.ld-lang-btn:last-child { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }

@media (max-width: 899px) {
  .ld-footer-inner { grid-template-columns: 1fr; gap: var(--space-6); }
}

/* ── Home hub ── */
.home { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }

.home-hero {
  --card-pad: clamp(20px, 3vw, 36px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-6) var(--space-8);
  align-items: center;
  background-image:
    radial-gradient(560px 260px at 100% 0, rgba(221, 167, 52, 0.11), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0) 46%);
}
.home-greeting {
  margin: 4px 0 var(--space-2);
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.3rem + 2.8vw, 3.4rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
/* A long name (20 wide letters, no spaces) is broken inside the card instead of widening the page: a grid item's
   min-width is auto, so the unbreakable word used to push the hero, the page and the tab bar to 643px. */
.home-hero-main { min-width: 0; }
.home-greeting { overflow-wrap: anywhere; }
.home-greeting:focus { outline: none; }
.home-sub { max-width: 54ch; margin: 0 0 var(--space-5); color: var(--color-text-muted); font-size: var(--text-lg); line-height: 1.5; text-wrap: pretty; }
/* First run: the greeting and the one action fit the first screen of a phone. */
.home-hero-first { grid-template-columns: minmax(0, 1fr); }
.home-hero-first .home-sub { margin-bottom: var(--space-5); }
.home-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
@media (max-width: 719px) {
  .home-hero-actions { flex-direction: column; align-items: stretch; }
}
.home-level { display: grid; gap: var(--space-2); max-width: 26rem; }
.home-level-head { display: flex; align-items: center; gap: var(--space-2); }
.home-level-text { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.4; }
.home-stats { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4) var(--space-7); }
.home-stats .stat { min-width: 6.5rem; }
.home-stats .stat-value { font-size: var(--text-4xl); }

.home-main {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-6);
  align-items: stretch;
}
.home-slot-daily, .home-slot-modes { min-width: 0; display: grid; }
.home-slot-modes > .home-section { grid-template-rows: auto minmax(0, 1fr); }
.home-slot-daily > .card { height: 100%; }
.home-slot-daily .home-daily { align-content: space-between; }
.home-section { display: grid; gap: var(--space-4); align-content: start; }
.home-h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 650; line-height: 1.1; }

/* Daily challenge */
.home-daily {
  --card-pad: clamp(20px, 2.4vw, 28px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  align-content: start;
}
.home-daily-skel { display: grid; gap: var(--space-3); grid-column: 1 / -1; }
.home-daily.is-done { border-color: var(--color-perfect-bd); }
.home-daily-visual { display: grid; place-items: center; padding-top: var(--space-2); }
.home-daily-visual .mini-board { width: 100%; max-width: 264px; height: auto; box-shadow: var(--shadow-2); }
.home-daily.is-done .home-daily-visual .mini-board { filter: saturate(0.7) brightness(0.9); }
.home-daily-main { display: grid; gap: var(--space-3); min-width: 0; align-content: center; }
.home-daily-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.home-daily-title { margin: 0; font-family: var(--font-display); font-size: 1.85rem; font-weight: 650; line-height: 1.08; text-wrap: balance; }
.home-daily-body { margin: 0; color: var(--color-text-muted); line-height: 1.5; text-wrap: pretty; }
.home-daily-notes { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.home-daily-note { display: flex; align-items: center; gap: 8px; color: var(--color-text); font-size: var(--text-sm); font-weight: 600; }
.home-daily-note .ui-icon { flex: none; color: var(--color-gold); }
.home-daily-note.is-risk { color: var(--color-dubious); }
.home-daily-note.is-risk .ui-icon { color: var(--color-dubious); }
.home-daily-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
.home-daily > .home-daily-head,
.home-daily > .home-daily-title,
.home-daily > .home-daily-body,
.home-daily > .home-daily-actions { grid-column: 1 / -1; }

/* Mode cards */
.home-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: var(--space-4); }
/* An odd number of ways to train: the last one takes the whole row instead of leaving a hole. */
.home-modes > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.home-mode {
  --card-pad: var(--space-5);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 188px;
}
.home-mode-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--color-gold-dim);
  border-radius: 14px;
  background: var(--color-gold-bg);
  color: var(--color-gold);
  transition: transform var(--dur-2) var(--ease-out);
}
.home-mode:hover .home-mode-icon { transform: scale(1.06) rotate(-3deg); }
.home-mode-text { display: grid; gap: 6px; min-width: 0; }
.home-mode-title { font-size: var(--text-lg); font-weight: 650; line-height: 1.2; }
.home-mode-body { color: var(--color-text-muted); font-size: var(--text-base); line-height: 1.45; }
.home-mode-go {
  display: inline-grid;
  flex: none;
  place-items: center;
  align-self: flex-end;
  margin-top: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface-3);
  color: var(--color-text);
  transition: transform var(--dur-2) var(--ease-out), background-color var(--dur-2) ease, color var(--dur-2) ease;
}
.home-mode:hover .home-mode-go { background: var(--color-gold); color: var(--color-on-gold); transform: translateX(3px); }
.home-mode-count { position: absolute; top: var(--space-4); right: var(--space-4); }
.home-mode-due { border-color: var(--color-gold-dim); }
.home-mode.is-disabled {
  border-style: dashed;
  border-color: var(--color-hairline-strong);
  cursor: default;
}
.home-mode.is-disabled .home-mode-icon { background: var(--color-surface-3); border-color: var(--color-border); color: var(--color-text-muted); }

/* Secondary tiles */
.home-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.home-tile {
  --card-pad: var(--space-4) var(--space-5);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon title" "icon body";
  column-gap: var(--space-4);
  row-gap: 2px;
  align-items: center;
}
.home-tile-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-surface-3);
  color: var(--color-gold);
}
.home-tile-title { grid-area: title; font-size: var(--text-md); font-weight: 650; }
.home-tile-body { grid-area: body; color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.4; }

/* Did you know? */
.home-fact { --card-pad: clamp(20px, 3vw, 32px); display: grid; gap: var(--space-3); }
.home-fact-head { display: flex; align-items: center; gap: var(--space-3); }
.home-fact-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-gold-bg);
  color: var(--color-gold);
}
.home-fact-title { margin: 0; font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 650; }
.home-fact-body { display: grid; gap: var(--space-2); }
.home-fact-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.home-fact-year { color: var(--color-text-muted); font-family: var(--font-display); font-size: var(--text-lg); font-weight: 650; font-variant-numeric: lining-nums; }
.home-fact-text { max-width: 68ch; margin: 0; font-size: var(--text-lg); line-height: 1.62; text-wrap: pretty; }
.home-fact-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }

/* ── Width steps ── */
@media (max-width: 1023px) {
  .home-main { grid-template-columns: minmax(0, 1fr); }
  .home-daily { grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); align-items: center; }
  .home-daily-visual { padding-top: 0; }
}
@media (max-width: 819px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); }
  .home-stats { justify-content: space-between; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-hairline); }
  .home-stats .stat { min-width: 0; }
  .home-stats .stat-value { font-size: var(--text-3xl); }
}
@media (max-width: 719px) {
  .home { gap: var(--space-5); }
  .home-modes { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .home-mode { flex-direction: row; align-items: center; min-height: 0; gap: var(--space-4); }
  .home-mode-go { align-self: center; margin-top: 0; margin-left: auto; }
  .home-mode-count { position: static; margin-left: auto; }
  .home-tiles { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .home-daily { grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: var(--space-4); }
  .home-daily-title { font-size: 1.55rem; }
  .home-fact-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 479px) {
  .home-daily { grid-template-columns: minmax(0, 1fr); }
  .home-daily-visual .mini-board { max-width: 180px; }
  .home-daily-actions .btn { width: 100%; }
}

/* ── Duel setup dialog ── */
.duel-form { display: grid; gap: var(--space-5); }
.duel-form > .modal-text { margin: 0; }
/* The fairness note of the duel (who looks away, what is hidden): a quiet callout, not body text. */
.duel-fair {
  display: flex;
  gap: var(--space-2);
  margin: calc(var(--space-2) * -1) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-normal);
}
.duel-fair .ui-icon { flex: none; margin-top: 2px; color: var(--color-info); }
.duel-fieldset { display: grid; gap: var(--space-3); min-width: 0; margin: 0; padding: 0; border: 0; }
.duel-legend {
  float: left;
  width: 100%;
  margin: 0 0 var(--space-2);
  padding: 0;
  color: var(--color-gold);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.duel-legend + * { clear: both; }
.duel-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: var(--space-4); }
.duel-player { align-content: start; }
.duel-guest { margin-top: var(--space-1); }
.duel-sources { display: grid; gap: var(--space-2); }
.duel-source-option {
  align-items: flex-start;
  padding: 12px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.duel-source-option:hover { border-color: var(--color-border-mid); }
.duel-source-option:has(input:checked) { border-color: var(--color-gold-dim); background: var(--color-gold-bg); }
.duel-source-option .check-box { margin-top: 2px; }
.duel-source-title { font-weight: 650; }
.duel-source-hint { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 400; line-height: 1.4; }
.duel-game { margin-top: var(--space-1); }
.duel-counts { width: 100%; }
.duel-count { position: relative; display: grid; place-items: center; flex: 1 1 0; min-height: var(--hit); padding: 0 var(--space-3); cursor: pointer; }
.duel-count + .duel-count { border-left: 1px solid var(--color-hairline-strong); }
.duel-count-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.duel-count:has(.duel-count-input:focus-visible) { outline: var(--focus-ring); outline-offset: -3px; }
@media (max-width: 479px) {
  .duel-count { padding: 0 var(--space-1); font-size: var(--text-sm); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .ld-hero-bg { animation: none; }
  .home-mode:hover .home-mode-icon,
  .home-mode:hover .home-mode-go { transform: none; }
}
html[data-motion="reduce"] .ld-hero-bg { animation: none !important; }
html[data-motion="reduce"] .home-mode:hover .home-mode-icon,
html[data-motion="reduce"] .home-mode:hover .home-mode-go { transform: none !important; }
