:root {
  --tree-black: #081018;
  --tree-panel: #101820;
  --tree-metal: #293744;
  --tree-off: #20272d;
  --tree-off-ring: #3a4650;
  --tree-white: #f8fafc;
  --tree-amber: #ffb000;
  --tree-green: #20d66b;
  --tree-red: #ff3b30;
}

.lights-page {
  min-height: calc(100vh - 64px);
  background:
    radial-gradient(circle at 50% 0%, rgba(15, 107, 153, .24), transparent 34rem),
    linear-gradient(180deg, #07111b 0%, #0b1722 45%, #101a24 100%);
  color: #fff;
  padding: 22px 0 38px;
}

.lights-intro {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.lights-intro .kicker { color: #9fe8ed; }
.lights-intro h1 {
  margin: 0;
  font-family: "Arial Black", "Segoe UI", Arial, sans-serif;
  font-size: clamp(2.4rem, 11vw, 4.8rem);
  line-height: .94;
  letter-spacing: -.045em;
  text-transform: uppercase;
}
.lights-intro p {
  margin: 0;
  max-width: 760px;
  color: #cad7e2;
  font-weight: 650;
}

.trainer-shell {
  display: grid;
  gap: 16px;
}

.tree-card,
.practice-card {
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 24px;
  background: rgba(11, 24, 35, .92);
  box-shadow: 0 24px 65px rgba(0,0,0,.30);
}

.tree-card { padding: 16px; }
.tree-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.tree-title {
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #b7c9d8;
}
.tree-badge {
  border: 1px solid rgba(159,232,237,.28);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(159,232,237,.08);
  color: #bdf6f8;
  font-size: .72rem;
  font-weight: 900;
}

.tree-rig {
  position: relative;
  width: min(100%, 330px);
  margin: 0 auto;
  border: 1px solid #35424d;
  border-radius: 24px;
  background: linear-gradient(90deg, #0a0f13, #17212a 50%, #0a0f13);
  padding: 20px 18px 22px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.02), 0 18px 40px rgba(0,0,0,.34);
}
.tree-rig::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 10px;
  width: 12px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #16212a, #4a5964 50%, #16212a);
  opacity: .32;
}

.tree-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  align-items: center;
  min-height: 64px;
}
.tree-row.stage-row { min-height: 48px; }
.tree-label {
  color: #8fa1af;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: right;
  padding-right: 9px;
}
.tree-code {
  color: #596875;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .08em;
  padding-left: 9px;
}

.bulb {
  justify-self: center;
  width: 54px;
  height: 54px;
  border: 6px solid #0b0f12;
  border-radius: 50%;
  background: var(--tree-off);
  box-shadow: 0 0 0 2px var(--tree-off-ring), inset 0 6px 10px rgba(255,255,255,.04), inset 0 -8px 12px rgba(0,0,0,.5);
  transition: background .025s linear, box-shadow .025s linear, transform .04s linear;
}
.stage-row .bulb {
  width: 36px;
  height: 36px;
  border-width: 5px;
}
.bulb.on.white {
  background: var(--tree-white);
  box-shadow: 0 0 0 2px #fff, 0 0 22px rgba(255,255,255,.85), 0 0 44px rgba(255,255,255,.38);
}
.bulb.on.amber {
  background: var(--tree-amber);
  box-shadow: 0 0 0 2px #ffc54b, 0 0 28px rgba(255,176,0,.95), 0 0 58px rgba(255,176,0,.45);
  transform: scale(1.04);
}
.bulb.on.green {
  background: var(--tree-green);
  box-shadow: 0 0 0 2px #75f0a5, 0 0 30px rgba(32,214,107,.95), 0 0 60px rgba(32,214,107,.45);
}
.bulb.on.red {
  background: var(--tree-red);
  box-shadow: 0 0 0 2px #ff7c75, 0 0 30px rgba(255,59,48,.95), 0 0 60px rgba(255,59,48,.45);
}

.practice-card { overflow: hidden; }
.practice-status {
  border-bottom: 1px solid rgba(255,255,255,.10);
  padding: 18px;
  background: rgba(255,255,255,.03);
}
.status-label {
  color: #94a7b6;
  font-size: .69rem;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.status-main {
  margin-top: 3px;
  font-family: "Arial Black", "Segoe UI", Arial, sans-serif;
  font-size: clamp(2rem, 10vw, 4.2rem);
  line-height: 1;
  letter-spacing: -.04em;
}
.status-main.good { color: #71f2a5; }
.status-main.red { color: #ff776e; }
.status-main.wait { color: #ffd36b; }
.status-sub {
  margin-top: 7px;
  color: #b7c7d3;
  font-weight: 700;
}

.practice-body { padding: 16px; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.result-box {
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  padding: 12px;
}
.result-box strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}
.result-box span {
  display: block;
  margin-top: 5px;
  color: #8fa1af;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.launch-button,
.stage-button,
.clear-button {
  width: 100%;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 950;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.stage-button {
  min-height: 58px;
  margin-top: 14px;
  background: #d9fbfd;
  color: #082031;
  font-size: 1.02rem;
}
.stage-button:disabled { opacity: .48; cursor: default; }
.launch-button {
  min-height: 112px;
  margin-top: 10px;
  border: 2px solid #ff7770;
  background: linear-gradient(180deg, #dc3028, #a3130d);
  color: #fff;
  font-family: "Arial Black", "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.8rem, 8vw, 2.8rem);
  letter-spacing: -.025em;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 12px 30px rgba(172,25,18,.28);
}
.launch-button:active { transform: translateY(1px) scale(.995); }
.launch-button[disabled] { opacity: .42; cursor: default; transform: none; }

.key-hint {
  margin-top: 8px;
  text-align: center;
  color: #718492;
  font-size: .76rem;
  font-weight: 700;
}

.settings {
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,.09);
  padding-top: 14px;
}
.settings summary {
  cursor: pointer;
  color: #dbe8f1;
  font-weight: 900;
}
.settings-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.setting label {
  display: block;
  color: #a9bac7;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.setting input[type="number"] {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  border: 1px solid #40505d;
  border-radius: 12px;
  background: #0c151d;
  color: #fff;
  padding: 9px 11px;
  font-weight: 850;
}
.setting small {
  display: block;
  margin-top: 5px;
  color: #758896;
  line-height: 1.4;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c4d1db;
  font-size: .87rem;
  font-weight: 750;
}
.checkline input { width: 20px; height: 20px; }
.clear-button {
  min-height: 46px;
  border: 1px solid #40505d;
  background: transparent;
  color: #c6d4de;
}

.session-card {
  margin-top: 16px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 22px;
  background: rgba(11,24,35,.88);
  overflow: hidden;
}
.session-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.session-head h2 {
  font-size: 1.25rem;
  color: #fff;
  letter-spacing: 0;
}
.session-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255,255,255,.08);
}
.session-stat {
  background: #0f1b25;
  padding: 13px 10px;
  text-align: center;
}
.session-stat strong { display: block; font-size: 1.3rem; }
.session-stat span {
  display: block;
  margin-top: 3px;
  color: #8295a4;
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.history-list {
  display: grid;
  gap: 7px;
  padding: 12px;
  max-height: 280px;
  overflow: auto;
}
.history-empty {
  color: #7e909e;
  text-align: center;
  padding: 18px 8px;
  font-weight: 700;
}
.history-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 13px;
  background: rgba(255,255,255,.035);
  padding: 9px 10px;
}
.history-n {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #172733;
  color: #9eb0bd;
  font-size: .76rem;
  font-weight: 900;
}
.history-row b { font-size: 1rem; }
.history-row small { display: block; margin-top: 2px; color: #718492; }
.history-rt { font-size: 1.05rem; font-weight: 950; color: #70efa2; }
.history-row.red .history-rt { color: #ff7168; }

.practice-note {
  margin: 16px 0 0;
  border-left: 4px solid #26a8d7;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  padding: 12px 14px;
  color: #b9c8d3;
  font-size: .84rem;
  line-height: 1.55;
}
.practice-note strong { color: #fff; }

@media (min-width: 800px) {
  .lights-page { padding-top: 34px; }
  .trainer-shell { grid-template-columns: minmax(330px, .82fr) minmax(390px, 1.18fr); align-items: start; }
  .tree-card { padding: 20px; }
  .practice-status, .practice-body { padding: 22px; }
  .settings-grid { grid-template-columns: 1fr 1fr; align-items: end; }
}

@media (max-width: 699px) {
  body { padding-bottom: calc(78px + var(--safe-bottom)); }
  .lights-page .wrap { width: min(100% - 20px, var(--max)); }
  .tree-card { padding: 11px; }
  .tree-rig { width: min(100%, 290px); padding-top: 14px; padding-bottom: 16px; }
  .tree-row { min-height: 56px; grid-template-columns: 52px 1fr 52px; }
  .tree-row.stage-row { min-height: 42px; }
  .bulb { width: 47px; height: 47px; border-width: 5px; }
  .stage-row .bulb { width: 31px; height: 31px; border-width: 4px; }
  .launch-button { min-height: 104px; }
}

/* Phone-first practice layout. Keep the tree and launch controls visible together. */
@media (max-width: 520px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  body {
    padding-bottom: calc(66px + var(--safe-bottom));
  }

  .site-top .wrap,
  .lights-page .wrap,
  .footer .wrap {
    width: calc(100% - 12px);
    max-width: 100%;
  }

  .topbar {
    min-height: 54px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand img {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .brand span {
    min-width: 0;
    font-size: .86rem;
    white-space: nowrap;
  }

  .lights-page {
    min-height: auto;
    padding: 8px 0 18px;
  }

  .lights-intro {
    gap: 3px;
    margin-bottom: 8px;
  }

  .lights-intro .kicker {
    display: none;
  }

  .lights-intro h1 {
    font-size: clamp(1.9rem, 9.5vw, 2.45rem);
    line-height: .95;
  }

  .lights-intro p {
    max-width: none;
    font-size: .72rem;
    line-height: 1.28;
    font-weight: 650;
  }

  .trainer-shell {
    grid-template-columns: minmax(106px, 40%) minmax(0, 60%);
    gap: 6px;
    align-items: start;
  }

  .trainer-shell > *,
  .tree-card,
  .practice-card,
  .practice-body,
  .practice-status,
  .result-grid,
  .result-box {
    min-width: 0;
  }

  .tree-card,
  .practice-card {
    border-radius: 14px;
  }

  .tree-card {
    padding: 6px 4px 7px;
  }

  .tree-topline {
    justify-content: center;
    margin-bottom: 5px;
  }

  .tree-title {
    display: none;
  }

  .tree-badge {
    max-width: 100%;
    padding: 3px 5px;
    font-size: .52rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .tree-rig {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 6px 2px 8px;
    border-radius: 14px;
  }

  .tree-rig::before {
    width: 8px;
    top: 6px;
    bottom: 6px;
  }

  .tree-row,
  .tree-row.stage-row {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-template-columns: none;
  }

  .tree-row {
    min-height: 43px;
  }

  .tree-row.stage-row {
    min-height: 31px;
  }

  .tree-label,
  .tree-code {
    display: none;
  }

  .bulb {
    width: 37px;
    height: 37px;
    border-width: 4px;
    box-shadow: 0 0 0 1px var(--tree-off-ring), inset 0 4px 7px rgba(255,255,255,.04), inset 0 -6px 8px rgba(0,0,0,.5);
  }

  .stage-row .bulb {
    width: 24px;
    height: 24px;
    border-width: 3px;
  }

  .bulb.on.white {
    box-shadow: 0 0 0 1px #fff, 0 0 14px rgba(255,255,255,.82), 0 0 26px rgba(255,255,255,.3);
  }

  .bulb.on.amber {
    box-shadow: 0 0 0 1px #ffc54b, 0 0 17px rgba(255,176,0,.95), 0 0 30px rgba(255,176,0,.38);
  }

  .bulb.on.green {
    box-shadow: 0 0 0 1px #75f0a5, 0 0 18px rgba(32,214,107,.95), 0 0 32px rgba(32,214,107,.38);
  }

  .bulb.on.red {
    box-shadow: 0 0 0 1px #ff7c75, 0 0 18px rgba(255,59,48,.95), 0 0 32px rgba(255,59,48,.38);
  }

  .practice-status {
    padding: 8px 8px 7px;
  }

  .status-label {
    font-size: .53rem;
    letter-spacing: .09em;
  }

  .status-main {
    margin-top: 2px;
    font-size: clamp(1.32rem, 7vw, 1.85rem);
    overflow-wrap: anywhere;
  }

  .status-sub {
    margin-top: 4px;
    font-size: .62rem;
    line-height: 1.25;
    font-weight: 650;
  }

  .practice-body {
    padding: 7px;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .result-box {
    border-radius: 9px;
    padding: 6px 5px;
  }

  .result-box strong {
    font-size: clamp(.88rem, 4.3vw, 1.08rem);
    white-space: nowrap;
  }

  .result-box span {
    margin-top: 3px;
    font-size: .46rem;
    line-height: 1.13;
    letter-spacing: .035em;
    overflow-wrap: anywhere;
  }

  .stage-button,
  .launch-button,
  .clear-button {
    border-radius: 11px;
  }

  .stage-button {
    min-height: 43px;
    margin-top: 7px;
    padding: 5px;
    font-size: .72rem;
    line-height: 1.05;
  }

  .launch-button {
    min-height: 94px;
    margin-top: 6px;
    padding: 8px 4px;
    border-width: 1px;
    font-size: clamp(1.05rem, 5.6vw, 1.48rem);
    line-height: .95;
    letter-spacing: -.035em;
  }

  .key-hint {
    display: none;
  }

  .settings {
    margin-top: 7px;
    padding-top: 7px;
  }

  .settings summary {
    font-size: .69rem;
    line-height: 1.2;
  }

  .settings-grid {
    gap: 8px;
    margin-top: 8px;
  }

  .setting label {
    font-size: .61rem;
  }

  .setting input[type="number"] {
    min-height: 42px;
    margin-top: 4px;
    padding: 6px 8px;
  }

  .setting small,
  .checkline {
    font-size: .63rem;
    line-height: 1.25;
  }

  .checkline {
    align-items: flex-start;
  }

  .checkline input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
  }

  .clear-button {
    min-height: 40px;
    font-size: .72rem;
  }

  .session-card {
    margin-top: 9px;
    border-radius: 14px;
  }

  .session-head {
    padding: 9px 10px;
  }

  .session-head h2 {
    font-size: 1rem;
  }

  .session-stat {
    min-width: 0;
    padding: 8px 3px;
  }

  .session-stat strong {
    font-size: .98rem;
    white-space: nowrap;
  }

  .session-stat span {
    font-size: .49rem;
    letter-spacing: .035em;
  }

  .history-list {
    padding: 7px;
    max-height: 220px;
  }

  .history-row {
    grid-template-columns: 27px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 7px;
    border-radius: 10px;
  }

  .history-n {
    width: 25px;
    height: 25px;
    font-size: .65rem;
  }

  .history-row b {
    display: block;
    font-size: .78rem;
    line-height: 1.1;
  }

  .history-row small {
    font-size: .61rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .history-rt {
    font-size: .82rem;
    white-space: nowrap;
  }

  .practice-note {
    margin-top: 9px;
    padding: 9px 10px;
    border-left-width: 3px;
    border-radius: 9px;
    font-size: .69rem;
    line-height: 1.38;
  }

  .footer {
    padding: 16px 0 82px;
  }

  .footer-grid {
    gap: 9px;
  }

  .footer p,
  .footer-links a {
    font-size: .7rem;
  }

  .mobile-bar {
    padding: 5px 5px var(--safe-bottom);
  }

  .mobile-bar-inner {
    gap: 2px;
  }

  .mobile-bar a {
    min-width: 0;
    min-height: 44px;
    padding: 2px;
    border-radius: 9px;
    font-size: .52rem;
    letter-spacing: .015em;
    overflow: hidden;
  }

  .mobile-bar a b {
    font-size: .9rem;
  }

  .mobile-bar a span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 340px) {
  .site-top .wrap,
  .lights-page .wrap,
  .footer .wrap {
    width: calc(100% - 8px);
  }

  .brand span {
    font-size: .78rem;
  }

  .trainer-shell {
    grid-template-columns: minmax(98px, 38%) minmax(0, 62%);
    gap: 4px;
  }

  .tree-row {
    min-height: 40px;
  }

  .tree-row.stage-row {
    min-height: 29px;
  }

  .bulb {
    width: 34px;
    height: 34px;
  }

  .stage-row .bulb {
    width: 22px;
    height: 22px;
  }

  .practice-status,
  .practice-body {
    padding-left: 5px;
    padding-right: 5px;
  }

  .result-box {
    padding-left: 3px;
    padding-right: 3px;
  }

  .result-box span {
    font-size: .42rem;
  }

  .stage-button {
    font-size: .66rem;
  }

  .launch-button {
    min-height: 88px;
    font-size: 1rem;
  }
}

/* Flea fixed launch-delay baseline */
.setting-label{display:block;font-weight:800;margin-bottom:7px}
.fixed-delay{display:flex;align-items:baseline;justify-content:space-between;gap:10px;border:1px solid var(--line,#26364a);border-radius:12px;padding:11px 12px;background:#0d1620}
.fixed-delay strong{font-size:1.2rem;color:#fff}
.fixed-delay span{font-size:.76rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#91a4b8}
