:root {
  --canvas: #eef1ed;
  --canvas-deep: #e7ebe6;
  --surface: #fbfcf9;
  --surface-raised: #ffffff;
  --surface-soft: #f4f6f2;
  --surface-sage: #e8eee9;
  --ink: #203031;
  --ink-deep: #172728;
  --ink-soft: #526563;
  --muted: #7a8a87;
  --line: #d8dfd9;
  --line-strong: #bcc8c0;
  --forest: #2d4b4c;
  --forest-deep: #1e3839;
  --sage: #6d9183;
  --sage-soft: #dce8e1;
  --clay: #c56f50;
  --clay-deep: #a85539;
  --clay-soft: #f5e4dc;
  --gold: #ad8343;
  --blue: #5f7895;
  --original-red: #cc0000;
  --original-blue: #0066cc;
  --original-amber: #de9234;
  --original-purple: #640064;
  --original-orange: #f99000;
  --original-gray: #686868;
  --original-warm: #ffffe1;
  --original-cool: #ecf6ff;
  --original-sand: #fff1d9;
  --danger: #b6534d;
  --danger-soft: #f7e6e3;
  --success: #4e806d;
  --shadow-xs: 0 1px 2px rgba(29, 47, 45, 0.04);
  --shadow-sm: 0 8px 24px rgba(29, 47, 45, 0.07);
  --shadow-md: 0 18px 52px rgba(29, 47, 45, 0.12);
  --shadow-lg: 0 32px 90px rgba(25, 42, 40, 0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  color-scheme: light;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 92% -5%, rgba(197, 111, 80, 0.08), transparent 58%),
    radial-gradient(800px 520px at -5% 22%, rgba(109, 145, 131, 0.1), transparent 58%),
    linear-gradient(180deg, #f4f5f1 0, var(--canvas) 280px, #ebefea 100%);
  font: 13px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(197, 111, 80, 0.2);
  outline-offset: 2px;
}

svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
}

.ambient-a {
  top: 120px;
  right: -180px;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(109, 145, 131, 0.12);
  box-shadow: 0 0 0 70px rgba(109, 145, 131, 0.025);
}

.ambient-b {
  bottom: -230px;
  left: -190px;
  width: 480px;
  height: 480px;
  border: 1px solid rgba(197, 111, 80, 0.1);
  box-shadow: 0 0 0 80px rgba(197, 111, 80, 0.02);
}

.app-header {
  position: sticky;
  z-index: 80;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(16px, 3.5vw, 48px);
  border-bottom: 1px solid rgba(188, 200, 192, 0.68);
  background: rgba(249, 250, 247, 0.9);
  box-shadow: 0 3px 18px rgba(31, 51, 49, 0.045);
  backdrop-filter: blur(18px) saturate(120%);
  transition:
    transform 190ms ease,
    opacity 150ms ease,
    box-shadow 150ms ease;
}

.app-header.is-chart-header-hidden {
  pointer-events: none;
  opacity: 0;
  box-shadow: none;
  transform: translateY(calc(-100% - 2px));
}

.app-header.is-guide-visible {
  z-index: 318;
  pointer-events: auto;
  opacity: 1;
  box-shadow: 0 3px 18px rgba(31, 51, 49, 0.12);
  transform: none;
}

.chart-sticky-header {
  position: fixed;
  z-index: 115;
  top: 0;
  overflow: hidden;
  pointer-events: none;
  border-bottom: 1px solid var(--line-strong);
  background: #edf1ed;
  box-shadow: 0 5px 14px rgba(28, 49, 47, 0.12);
}

.chart-sticky-header-scroll {
  width: 100%;
  overflow: hidden;
}

.chart-sticky-table {
  min-width: 0;
  margin: 0;
}

.chart-sticky-table th {
  position: static;
  top: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--forest), var(--forest-deep));
  box-shadow: 0 7px 17px rgba(30, 56, 57, 0.2);
  font: 700 17px/1 var(--font-serif);
  letter-spacing: 0;
}

.brand-mark::before {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  content: "";
}

.brand-mark::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e6b28f;
  content: "";
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  color: var(--ink-deep);
  font: 700 16px/1.15 var(--font-serif);
  letter-spacing: 0.08em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.header-status > span:last-child {
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-status small {
  color: var(--muted);
  font: 700 8px var(--font-mono);
  letter-spacing: 0.06em;
}

.header-status b {
  color: var(--success);
  font: 700 9px var(--font-sans);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(78, 128, 109, 0.11);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.smart-entry-button {
  position: relative;
  display: inline-flex;
  height: 44px;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 0 15px 0 9px;
  border: 1px solid rgba(220, 179, 145, 0.4);
  border-radius: 12px;
  color: #fff;
  background:
    radial-gradient(90px 50px at 100% 0, rgba(231, 159, 112, 0.25), transparent 74%),
    linear-gradient(135deg, #315354 0%, #1d393b 62%, #192f31 100%);
  box-shadow:
    0 9px 22px rgba(24, 49, 49, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.smart-entry-button::before {
  position: absolute;
  top: -22px;
  right: -12px;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  content: "";
}

.smart-entry-button:hover {
  border-color: rgba(240, 192, 154, 0.72);
  box-shadow:
    0 12px 26px rgba(24, 49, 49, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

.smart-entry-icon {
  position: relative;
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #f3c7a8;
  background: rgba(255, 255, 255, 0.09);
}

.smart-entry-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.2;
}

.smart-entry-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.smart-entry-copy strong {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.smart-entry-copy small {
  color: rgba(243, 199, 168, 0.66);
  font: 700 6px/1.2 var(--font-mono);
  letter-spacing: 0.12em;
}

.smart-entry-pulse {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  margin-left: 2px;
  border-radius: 50%;
  background: #f0b68f;
  box-shadow: 0 0 0 0 rgba(240, 182, 143, 0.4);
  animation: smart-entry-pulse 2.2s ease-out infinite;
}

@keyframes smart-entry-pulse {
  0%,
  55% {
    box-shadow: 0 0 0 0 rgba(240, 182, 143, 0.38);
  }
  85%,
  100% {
    box-shadow: 0 0 0 7px rgba(240, 182, 143, 0);
  }
}

.mobile-smart-launch {
  display: none;
}

.icon-button,
.square-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-xs);
  transition: 160ms ease;
}

.icon-button:hover,
.square-button:hover {
  color: var(--forest);
  border-color: var(--line-strong);
  background: var(--surface-raised);
  transform: translateY(-1px);
}

.icon-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
  transform: none;
}

.square-button:disabled {
  cursor: not-allowed;
  color: #a8b1ad;
  border-color: var(--line);
  background: #f3f5f2;
  opacity: 0.72;
  transform: none;
}

.delete-lottery-button:hover {
  color: var(--danger);
  border-color: rgba(182, 83, 77, 0.32);
  background: var(--danger-soft);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  cursor: pointer;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 650;
  transition: 160ms ease;
}

.primary-button {
  color: #fff;
  border: 1px solid var(--clay);
  background: var(--clay);
  box-shadow: 0 6px 16px rgba(197, 111, 80, 0.2);
}

.primary-button:hover {
  border-color: var(--clay-deep);
  background: var(--clay-deep);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.danger-button {
  color: var(--danger);
  border: 1px solid rgba(182, 83, 77, 0.22);
  background: var(--danger-soft);
}

.danger-button:hover {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.danger-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-soft);
  opacity: 0.7;
}

.text-button {
  min-height: 29px;
  padding: 0 2px;
  color: var(--clay-deep);
  border: 0;
  background: transparent;
}

.text-button:hover {
  color: var(--clay);
}

.count-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  color: var(--clay-deep);
  background: var(--clay-soft);
  font: 700 10px/1 var(--font-mono);
}

.app-main {
  display: grid;
  width: min(1580px, calc(100% - 36px));
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin: 0 auto;
  padding: 20px 0 42px;
}

.lottery-deck {
  position: relative;
  z-index: 5;
  top: auto;
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(360px, 0.9fr) minmax(310px, 0.86fr);
  align-items: center;
  gap: 24px;
  overflow: visible;
  padding: 17px 20px;
  border-radius: var(--radius-lg);
  color: #f6f7f3;
  background:
    radial-gradient(230px 180px at 100% 0, rgba(197, 111, 80, 0.2), transparent 68%),
    linear-gradient(155deg, #315050 0, #203b3c 58%, #192f31 100%);
  box-shadow: var(--shadow-md);
}

.lottery-deck::before {
  display: none;
  position: absolute;
  top: -54px;
  right: -42px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.018);
  content: "";
}

.deck-lead {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.deck-overline {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.47);
  font: 600 7px/1.4 var(--font-mono);
  letter-spacing: 0.11em;
}

.deck-lead h1 {
  margin: 0;
  color: #fff;
  font: 700 25px/1.15 var(--font-serif);
  letter-spacing: 0.07em;
}

.deck-lead p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  line-height: 1.7;
  white-space: nowrap;
}

.deck-flow {
  display: none;
}

.lottery-control {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 40px 40px;
  gap: 7px;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.control-label {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 1px;
}

.control-label span {
  color: rgba(255, 255, 255, 0.45);
  font: 600 8px var(--font-mono);
  letter-spacing: 0.09em;
}

.control-label small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
}

.select-wrap {
  position: relative;
}

.lottery-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.lottery-picker-trigger {
  display: flex;
  width: 100%;
  height: 40px;
  padding: 0 11px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  text-align: left;
  font-size: 12px;
  font-weight: 650;
}

.lottery-picker-trigger:hover,
.lottery-picker-trigger[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
}

.lottery-picker-trigger > svg {
  flex: 0 0 auto;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.7);
  transition: transform 160ms ease;
}

.lottery-picker-trigger[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.lottery-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: none;
  max-height: min(280px, 50vh);
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(25, 42, 40, 0.18);
}

.lottery-menu.is-open {
  display: block;
}

.lottery-option {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-size: 11px;
  font-weight: 550;
}

.lottery-option:hover {
  background: var(--surface-soft);
}

.lottery-option.is-selected {
  color: var(--forest);
  background: var(--sage-soft);
  font-weight: 650;
}

.lottery-option-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--option-color, var(--clay));
}

.lottery-option-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lottery-option-check {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--forest);
  opacity: 0;
}

.lottery-option.is-selected .lottery-option-check {
  opacity: 1;
}

.lottery-deck .square-button {
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.76);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.lottery-deck .square-button:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.13);
}

.lottery-deck .delete-lottery-button:hover {
  color: #ffd1cc;
  border-color: rgba(255, 152, 144, 0.38);
  background: rgba(182, 83, 77, 0.24);
}

.lottery-deck .square-button:disabled {
  color: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.deck-status-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
}

.deck-status-list > div {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 11px;
  background: rgba(21, 43, 44, 0.56);
}

.deck-status-list span {
  color: rgba(255, 255, 255, 0.39);
  font: 600 7px var(--font-mono);
  letter-spacing: 0.08em;
}

.deck-status-list b {
  color: rgba(255, 255, 255, 0.78);
  font-size: 9px;
  font-weight: 550;
}

.deck-status-list b.is-warning {
  color: #ffd1cc;
}

.workspace {
  min-width: 0;
  margin: 0;
}

.workspace-top {
  padding: 17px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-kicker {
  color: var(--clay);
  font: 700 8px/1.4 var(--font-mono);
  letter-spacing: 0.12em;
}

.section-heading h2 {
  margin: 3px 0 2px;
  color: var(--ink-deep);
  font: 700 23px/1.18 var(--font-serif);
  letter-spacing: 0.05em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.array-readout {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 108px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.array-readout span {
  color: var(--muted);
  font: 600 7px var(--font-mono);
  letter-spacing: 0.07em;
}

.array-readout b {
  grid-row: span 2;
  color: var(--forest);
  font: 700 21px/1 var(--font-mono);
}

.array-readout small {
  color: var(--muted);
  font: 7px var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.chart-library-bar {
  display: grid;
  grid-template-columns: auto minmax(230px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 11px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(109, 145, 131, 0.075), rgba(255, 255, 255, 0.72) 48%),
    var(--surface-raised);
}

.chart-library-copy {
  display: flex;
  min-width: 118px;
  flex-direction: column;
  gap: 2px;
}

.chart-library-copy span {
  color: var(--muted);
  font: 700 7px var(--font-mono);
  letter-spacing: 0.08em;
}

.chart-library-copy strong {
  color: var(--forest);
  font-size: 11px;
  font-weight: 700;
}

.chart-library-select {
  position: relative;
  min-width: 0;
}

.chart-library-select .custom-select-trigger {
  height: 38px;
  border: 1px solid #cfdad2;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.chart-library-select .custom-select-menu {
  width: 100%;
  max-height: min(70vh, 620px);
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select > select.custom-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select-trigger {
  display: flex;
  width: 100%;
  height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  border: 1px solid #d7dfd9;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(27, 48, 46, 0.025);
  text-align: left;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.custom-select-trigger:hover {
  border-color: #bdcbc3;
  background: #fcfdfb;
}

.custom-select-trigger:focus-visible,
.custom-select.is-open .custom-select-trigger {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(109, 145, 131, 0.12);
}

.custom-select-trigger:disabled {
  cursor: not-allowed;
  color: #8a9994;
  border-color: #dde4df;
  background: #f3f6f3;
  box-shadow: none;
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--ink-soft);
  pointer-events: none;
  transition: transform 160ms ease;
}

.custom-select.is-open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 150;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: min(390px, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  visibility: hidden;
  border: 1px solid #cdd9d2;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(25, 47, 45, 0.18);
  opacity: 0;
  transform: translateY(-5px);
  scrollbar-color: #bac9c1 transparent;
  scrollbar-width: thin;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.custom-select.is-open .custom-select-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.custom-select-group {
  position: sticky;
  z-index: 1;
  top: -6px;
  padding: 8px 9px 5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.97);
  font: 700 9px var(--font-mono);
  letter-spacing: 0.06em;
}

.custom-select-option {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.custom-select-option-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.custom-select-option-title {
  color: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.custom-select-option-description {
  display: -webkit-box;
  height: 2.9em;
  overflow: hidden;
  color: #7d8c88;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  text-overflow: ellipsis;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.custom-select-option.has-description {
  min-height: 72px;
  align-items: flex-start;
  padding-top: 9px;
  padding-bottom: 9px;
}

.custom-select-option.has-description > svg {
  align-self: center;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  color: var(--ink-deep);
  background: #f0f5f1;
  outline: none;
}

.custom-select-option.is-selected {
  color: var(--forest);
  background: #e9f1eb;
  font-weight: 700;
}

.custom-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.custom-select-option svg {
  display: none;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
}

.custom-select-option.is-selected svg {
  display: block;
}

.custom-select-empty {
  padding: 20px 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.chart-step-actions {
  display: flex;
  gap: 5px;
}

.chart-step-actions .icon-button {
  width: 36px;
  height: 36px;
}

.chart-favorite-button {
  display: inline-flex;
  height: 38px;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  cursor: pointer;
  border: 1px solid #cfdad2;
  border-radius: 8px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.9);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  transition: 150ms ease;
}

.chart-favorite-button:hover {
  border-color: #d7b29f;
  color: var(--clay-deep);
  background: #fff8f4;
}

.chart-favorite-button svg {
  width: 14px;
  height: 14px;
  transition: 150ms ease;
}

.chart-favorite-button.is-favorite {
  border-color: #e1b9a5;
  color: var(--clay-deep);
  background: var(--clay-soft);
}

.chart-favorite-button.is-favorite svg {
  fill: currentColor;
}

.chart-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  scrollbar-color: #c2cec6 transparent;
  scrollbar-width: thin;
}

.chart-tabs::-webkit-scrollbar {
  height: 5px;
}

.chart-tabs::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: #c2cec6;
}

.chart-tabs-empty {
  display: flex;
  min-height: 60px;
  flex: 1 0 100%;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.chart-tab {
  position: relative;
  display: flex;
  flex: 1 0 138px;
  min-width: 0;
  min-height: 60px;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  transition: 170ms ease;
}

.chart-tab:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.chart-tab.is-active {
  color: #fff;
  border-color: var(--forest);
  background: linear-gradient(145deg, var(--forest), var(--forest-deep));
  box-shadow: 0 7px 16px rgba(30, 56, 57, 0.17);
}

.tab-index {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--clay);
  background: var(--surface-raised);
  font: 700 9px var(--font-mono);
}

.chart-tab.is-active .tab-index {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
}

.chart-tab > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.chart-tab strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tab small {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tab.is-active small {
  color: rgba(255, 255, 255, 0.55);
}

.chart-panel {
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.chart-fullscreen-close {
  display: none;
}

.chart-fullscreen-button {
  margin-left: 0 !important;
}

.chart-fullscreen-button svg {
  width: 14px;
  height: 14px;
}

body.has-chart-fullscreen {
  overflow: hidden;
}

.chart-panel.is-chart-fullscreen {
  position: fixed;
  z-index: 180;
  inset: 0;
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--canvas);
}

.chart-panel.is-chart-fullscreen .chart-info {
  flex: 0 0 auto;
  padding-right: 64px;
}

.chart-panel.is-chart-fullscreen .bar-chart-panel {
  display: none;
}

.chart-panel.is-chart-fullscreen .chart-legend {
  flex: 0 0 auto;
}

.chart-panel.is-chart-fullscreen .chart-shell {
  height: auto !important;
  min-height: 0;
  flex: 1 1 auto;
  margin: 0 14px;
}

.chart-panel.is-chart-fullscreen .chart-footer {
  flex: 0 0 auto;
}

.chart-panel.is-chart-fullscreen .chart-fullscreen-close {
  position: fixed;
  z-index: 210;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.chart-panel.is-chart-fullscreen .chart-fullscreen-close svg {
  width: 17px;
  height: 17px;
}

.chart-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(110deg, rgba(109, 145, 131, 0.065), rgba(197, 111, 80, 0.035)),
    var(--surface-raised);
}

.chart-title-block {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 13px;
}

.chart-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-meta-row > span:first-child {
  color: var(--muted);
  font: 700 8px var(--font-mono);
  letter-spacing: 0.1em;
}

.formula-pill {
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--forest);
  background: var(--sage-soft);
  font-size: 8px;
  font-weight: 650;
}

#chartTitle {
  margin: 4px 0 3px;
  color: var(--ink-deep);
  font: 700 24px/1.2 var(--font-serif);
  letter-spacing: 0.04em;
}

#chartDescription {
  max-width: 690px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.segmented {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.segmented button {
  min-height: 31px;
  padding: 0 10px;
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 9px;
  font-weight: 650;
  transition: 150ms ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  color: #fff;
  background: var(--forest);
  box-shadow: 0 3px 9px rgba(45, 75, 76, 0.15);
}

.toggle-chip {
  display: inline-flex;
  height: 39px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--surface-raised);
  font-size: 9px;
  transition: 150ms ease;
}

.toggle-chip:hover {
  border-color: var(--line-strong);
}

.switch {
  position: relative;
  width: 23px;
  height: 13px;
  border-radius: 999px;
  background: #d6ddd7;
  transition: 160ms ease;
}

.switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 51, 49, 0.18);
  content: "";
  transition: 160ms ease;
}

.toggle-chip.is-active {
  color: var(--forest);
  border-color: rgba(109, 145, 131, 0.32);
  background: rgba(220, 232, 225, 0.62);
}

.toggle-chip.is-active .switch {
  background: var(--sage);
}

.toggle-chip.is-active .switch::after {
  left: 12px;
}

.toggle-chip:disabled,
.toggle-chip.is-unavailable {
  cursor: not-allowed;
  opacity: 0.48;
}

.meta-columns-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  transition: transform 180ms ease;
}

.meta-columns-toggle.is-collapsed .meta-columns-icon {
  transform: rotate(180deg);
}

.drawing-shortcut svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 22px 0;
}

.stat-card {
  display: flex;
  min-height: 69px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.stat-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 550;
}

.stat-value {
  overflow: hidden;
  color: var(--ink-deep);
  font: 700 18px/1.15 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value small {
  margin-left: 3px;
  color: var(--muted);
  font: 8px var(--font-sans);
}

.stat-spark {
  display: flex;
  height: 30px;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 2px;
}

.stat-spark i {
  width: 3px;
  height: var(--h);
  max-height: 28px;
  border-radius: 2px;
  background: #cedbd4;
}

.stat-spark i:nth-last-child(1) {
  background: var(--clay);
}

.bar-chart-panel {
  margin: 14px 22px 18px;
  padding: 18px 20px 14px;
  border: 1px solid #d7e0da;
  border-radius: 14px;
  background:
    radial-gradient(420px 180px at 100% 0, rgba(197, 111, 80, 0.055), transparent 70%),
    linear-gradient(180deg, #fbfcfa, #f4f7f3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.bar-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.bar-chart-head h4 {
  margin: 3px 0 2px;
  color: var(--ink-deep);
  font: 700 16px/1.25 var(--font-serif);
  letter-spacing: 0.03em;
}

.bar-chart-head p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.bar-chart-meta {
  display: flex;
  align-items: stretch;
  gap: 7px;
  color: var(--muted);
}

.bar-chart-meta > span {
  display: flex;
  min-width: 69px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 6px 9px;
  border: 1px solid #e0e6e1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.bar-chart-meta small {
  color: var(--muted);
  font-size: 7px;
}

.bar-chart-meta b {
  color: var(--forest);
  font: 700 10px var(--font-mono);
  white-space: nowrap;
}

.bar-prediction-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bar-prediction-key i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--clay);
}

.bar-chart-scroll {
  min-width: 0;
  overflow-x: auto;
  border-bottom: 1px solid #cdd8d1;
  background:
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent 39px,
      rgba(106, 130, 120, 0.09) 39px,
      rgba(106, 130, 120, 0.09) 40px
    );
  scrollbar-width: thin;
  scrollbar-color: #c2cec6 transparent;
}

.bar-chart-plot {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 9px;
}

.bar-chart-axis {
  display: flex;
  height: 174px;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px 0 20px;
  color: #8c9a95;
  font: 500 7px var(--font-mono);
  text-align: right;
}

.bar-chart {
  display: grid;
  width: 100%;
  min-width: max(100%, calc(var(--bar-count, 10) * 40px));
  height: 174px;
  grid-template-columns: repeat(var(--bar-count, 10), minmax(30px, 1fr));
  align-items: flex-end;
  gap: 5px;
  padding: 0 5px;
}

.bar-item {
  position: relative;
  display: grid;
  min-width: 0;
  height: 174px;
  grid-template-rows: 20px minmax(0, 1fr) 24px;
  align-items: center;
  justify-items: center;
  gap: 2px;
  padding: 0 2px;
  border-radius: 8px 8px 4px 4px;
  transition: background 150ms ease;
}

.bar-item:hover {
  background: rgba(255, 255, 255, 0.48);
}

.bar-count {
  display: inline-flex;
  min-width: 22px;
  height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #61746d;
  background: rgba(232, 239, 234, 0.8);
  font: 700 8px/1 var(--font-mono);
}

.bar-track {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: flex-end;
  justify-content: center;
}

.bar-track i {
  position: relative;
  width: min(54px, 64%);
  height: var(--bar-height);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(64, 105, 92, 0.12);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #8eaea2 0%, #5f8578 60%, #4d7167 100%);
  box-shadow:
    0 7px 14px rgba(65, 104, 91, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: height 260ms ease, background 160ms ease, transform 160ms ease;
}

.bar-track i > span {
  position: absolute;
  top: 4px;
  right: 3px;
  left: 3px;
  height: 1px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.42);
}

.bar-item:hover .bar-track i {
  background: linear-gradient(180deg, #a8bfb6, #6f9387 60%, #577b70);
  transform: translateY(-2px);
}

.bar-item.is-peak .bar-track i {
  background: linear-gradient(180deg, #d6b478, #b88945 62%, #9a6e32);
  box-shadow:
    0 9px 18px rgba(164, 119, 52, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.bar-item.is-peak .bar-count {
  color: #8c622a;
  background: #f6ead6;
}

.bar-item.has-prediction .bar-track i {
  background: linear-gradient(180deg, #e19c83, var(--clay) 64%, var(--clay-deep));
  box-shadow:
    0 9px 18px rgba(168, 85, 57, 0.18),
    0 0 0 1px rgba(197, 111, 80, 0.14);
}

.bar-item.has-prediction .bar-count {
  color: var(--clay-deep);
  background: var(--clay-soft);
}

.bar-item.has-prediction .bar-track i::after {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--clay);
  transform: translateX(-50%);
  content: "";
}

.bar-label {
  display: flex;
  height: 24px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #6e807a;
  font: 600 9px/1 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 8px;
}

.bar-prediction-key {
  flex: 0 0 auto;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 22px 9px;
  color: var(--muted);
  font-size: 9px;
}

.chart-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.hit-swatch {
  background: var(--original-red);
}

.omit-swatch {
  border: 1px solid var(--line-strong);
  background: transparent;
}

.legend-tip {
  margin-left: auto;
}

.chart-shell {
  position: relative;
  height: 1166px;
  max-height: none;
  margin: 0 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  scrollbar-color: #b9c7bf #eef1ed;
  scrollbar-width: thin;
}

.chart-shell::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.chart-shell::-webkit-scrollbar-track {
  background: #eef1ed;
}

.chart-shell::-webkit-scrollbar-thumb {
  border: 2px solid #eef1ed;
  border-radius: 999px;
  background: #b9c7bf;
}

@media (min-width: 641px) and (pointer: fine) {
  .chart-shell:not(.is-drawing) .trend-table tbody tr[data-issue],
  .chart-shell:not(.is-drawing) .trend-table tbody tr[data-issue] td {
    cursor: grab;
  }

  .chart-shell:not(.is-drawing) .trend-table button,
  .chart-shell:not(.is-drawing) .trend-table a,
  .chart-shell:not(.is-drawing) .trend-table [role="button"] {
    cursor: pointer;
  }

  .chart-shell.is-mouse-panning,
  .chart-shell.is-mouse-panning * {
    cursor: grabbing !important;
    user-select: none !important;
  }
}

.chart-shell.is-meta-collapsed .trend-table .issue-col,
.chart-shell.is-meta-collapsed .trend-table .number-col {
  display: none;
}

.chart-stage {
  --chart-row-height: 36px;
  --chart-head-height: 72px;
  --chart-issue-width: 60px;
  --chart-number-width: 84px;
  --chart-value-width: 27px;
  --chart-wide-width: 36px;
  position: relative;
  display: inline-block;
  min-width: 100%;
  vertical-align: top;
  background: #fff;
}

.trend-table {
  position: relative;
  z-index: auto;
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-spacing: 0;
  border-collapse: separate;
  color: var(--ink);
  font-size: 10px;
}

.trend-table th,
.trend-table td {
  height: 36px;
  padding: 0;
  text-align: center;
  border-right: 1px solid #e3e8e3;
  border-bottom: 1px solid #e0e6e1;
  background: transparent;
}

.trend-table th {
  position: sticky;
  z-index: 8;
  color: #4d625e;
  background: #edf1ed;
  font: 600 10px/1.2 var(--font-sans);
  white-space: nowrap;
}

.trend-table thead tr:first-child th {
  top: 0;
  height: 36px;
  border-bottom-color: var(--line-strong);
}

.trend-table thead tr:nth-child(2) th {
  top: 36px;
}

.trend-table .group-head {
  color: var(--forest);
  background: #e8eee9;
  letter-spacing: 0.03em;
}

.trend-table th.surface-warm {
  color: #7e5d20;
  background: #fffde8;
}

.trend-table th.surface-cool {
  color: #365c7f;
  background: #f4faff;
}

.trend-table th.surface-sand {
  color: #7a5b2c;
  background: var(--original-sand);
}

.trend-table th.surface-neutral {
  color: #505d61;
  background: #f2f2f2;
}

.trend-table td.surface-warm {
  background: var(--original-warm);
}

.trend-table td.surface-cool {
  background: var(--original-cool);
}

.trend-table td.surface-sand {
  background: var(--original-sand);
}

.trend-table td.surface-neutral {
  background: #f7f7f7;
}

.trend-table th.original-tone-red {
  color: #9c1a1a;
}

.trend-table th.original-tone-blue {
  color: #155d9e;
}

.trend-table th.original-tone-amber {
  color: #8f5b18;
}

.trend-table th.original-tone-purple {
  color: var(--original-purple);
}

.trend-table th.original-tone-orange {
  color: #9a5b00;
}

.trend-table th.original-tone-gray {
  color: #555;
}

.trend-table .group-head span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trend-table .group-head span::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--original-red);
  content: "";
}

.trend-table .group-head.tone-teal span::before {
  background: var(--original-blue);
}

.trend-table .group-head.tone-gold span::before {
  background: var(--original-amber);
}

.trend-table .group-head.tone-blue span::before {
  background: var(--original-blue);
}

.trend-table .group-head.tone-red span::before {
  background: var(--original-red);
}

.trend-table th.header-tone-clay {
  color: #a3533d;
}

.trend-table th.header-tone-orange {
  color: #a76735;
}

.trend-table th.header-tone-teal {
  color: #3f7166;
}

.trend-table th.header-tone-blue {
  color: #4f6887;
}

.trend-table th.header-tone-sage {
  color: #567a69;
}

.trend-table th.header-tone-forest {
  color: #355d53;
}

.trend-table th.header-tone-gold {
  color: #89672f;
}

.trend-table th.header-tone-sand {
  color: #7b6855;
}

.trend-table th.header-tone-gray {
  color: #647570;
}

.trend-table th.header-tone-green {
  color: #466d51;
}

.trend-table th.header-tone-red {
  color: #a84e48;
}

.trend-table .row-sticky {
  position: sticky;
  z-index: 5;
  box-shadow: 1px 0 0 var(--line);
}

.trend-table th.row-sticky {
  z-index: 12;
}

.trend-table .issue-col {
  left: 0;
  width: var(--chart-issue-width);
  min-width: var(--chart-issue-width);
  max-width: var(--chart-issue-width);
}

.trend-table .number-col {
  left: var(--chart-issue-width);
  width: var(--chart-number-width);
  min-width: var(--chart-number-width);
  max-width: var(--chart-number-width);
}

.chart-shell:not(.is-meta-collapsed) .trend-table .issue-col,
.chart-shell:not(.is-meta-collapsed) .trend-table .number-col {
  position: sticky;
  left: auto;
  box-shadow: none;
}

.trend-table td.issue-cell,
.trend-table td.number-cell {
  padding: 2px 4px;
  text-align: center;
}

.issue-cell strong {
  display: block;
  overflow: hidden;
  color: #3f5451;
  font: 600 11px/1.3 var(--font-mono);
  text-overflow: ellipsis;
}

.number-balls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.number-ball {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: 700 12.5px/1 var(--font-mono);
}

.number-ball.is-repeated {
  color: #fff;
  border-color: var(--original-red);
  background: var(--original-red);
  box-shadow: 0 1px 3px rgba(153, 0, 0, 0.2);
}

.trend-table tbody td.row-sticky {
  background: #fbfcf9;
}

.trend-table tbody tr:nth-child(even) td.row-sticky {
  background: #f1f4f0;
}

.trend-table td.value-cell {
  position: relative;
  width: var(--chart-value-width);
  min-width: var(--chart-value-width);
  max-width: var(--chart-value-width);
  color: #58666a;
  font: 500 11px var(--font-mono);
}

.trend-table .scalar-head,
.trend-table .scalar-cell {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
}

.trend-table .scalar-head {
  padding: 0 5px;
  color: #415a55;
  background: #eef2ed;
  font-size: 10px;
  white-space: normal;
}

.trend-table .scalar-cell {
  color: #263e3a;
  background: #fbfcf8;
  font: 700 11px var(--font-mono);
}

.trend-table .scalar-cell.has-value {
  color: #a32d24;
  background: #fff7f4;
}

.trend-table .scalar-value {
  display: inline-block;
  min-width: 24px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(217, 72, 55, 0.08);
}

.trend-table td.wide-cell {
  width: var(--chart-wide-width);
  min-width: var(--chart-wide-width);
  max-width: var(--chart-wide-width);
  overflow: hidden;
  padding: 0 2px;
  color: #566468;
  font-size: 9.5px;
  white-space: nowrap;
}

.trend-table td.win-cell {
  color: transparent;
}

.trend-table td.win-cell .hit-dot {
  position: relative;
  z-index: 4;
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--original-red);
  box-shadow: 0 1px 2px rgba(99, 9, 9, 0.2);
  font: 700 11px/1 var(--font-mono);
}

.trend-table td.win-cell.tone-teal .hit-dot {
  background: var(--original-blue);
}

.trend-table td.win-cell.tone-gold .hit-dot {
  color: #fff;
  background: var(--original-amber);
}

.trend-table td.win-cell.tone-blue .hit-dot {
  background: var(--original-blue);
}

.trend-table td.win-cell.tone-sage .hit-dot {
  background: var(--original-amber);
}

.trend-table td.win-cell.tone-forest .hit-dot {
  background: var(--original-amber);
}

.trend-table td.win-cell.tone-orange .hit-dot {
  background: var(--original-orange);
}

.trend-table td.win-cell.tone-gray .hit-dot {
  background: var(--original-gray);
}

.trend-table td.win-cell.tone-green .hit-dot {
  background: #009900;
}

.trend-table td.win-cell.tone-sand .hit-dot {
  background: var(--original-amber);
}

.trend-table td.win-cell.tone-red .hit-dot {
  background: var(--original-red);
}

.trend-table td.win-cell.tone-neutral .hit-dot {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: none;
}

.trend-table td.win-cell.tone-amber .hit-dot {
  background: var(--original-amber);
}

.trend-table td.win-cell.tone-purple .hit-dot {
  background: var(--original-purple);
}

.trend-table td.win-cell.cat-hit .hit-dot {
  width: auto;
  min-width: 22px;
  padding: 0 5px;
  border-radius: 999px;
  font: 600 9px/1 var(--font-sans);
}

.trend-table tbody tr[data-issue] {
  cursor: pointer;
}

.trend-table tbody tr.is-row-highlighted > td {
  background: #e7ebe7 !important;
}

.trend-table tbody tr.is-row-highlighted > td.row-sticky {
  background: #dde3de !important;
}

.presence-repeat-count {
  position: absolute;
  z-index: 2;
  top: -7px;
  right: -8px;
  display: grid;
  min-width: 15px;
  height: 15px;
  padding: 0 2px;
  place-items: center;
  border: 1px solid var(--original-red);
  border-radius: 999px;
  color: var(--original-red);
  background: #fff;
  box-shadow: 0 1px 3px rgba(92, 9, 9, 0.24);
  font: 700 8px/1 var(--font-sans);
  pointer-events: none;
}

.trend-table .guide-start {
  border-left: 2px solid #c9d2cc;
}

.trend-table .guide-end {
  border-right: 2px solid #c9d2cc;
}

.line-layer {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.line-layer polyline {
  fill: none;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-empty {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.empty-orbit {
  position: relative;
  display: grid;
  width: 70px;
  height: 70px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  color: var(--clay);
  background: var(--surface-soft);
  font: 700 22px var(--font-mono);
}

.empty-orbit::after {
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
}

.chart-empty h4 {
  margin: 0;
  color: var(--ink-deep);
  font: 700 18px var(--font-serif);
}

.chart-empty p {
  margin: 8px 0 17px;
  color: var(--muted);
  font-size: 10px;
}

.chart-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px 14px;
  color: var(--muted);
  font-size: 9px;
}

.chart-footer .text-button {
  height: 39px;
  min-height: 39px;
  padding: 0 10px;
  margin-left: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  font-size: 9px;
}

.chart-footer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-left: auto;
}

.chart-footer .text-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.chart-footer .drawing-launch-button {
  display: inline-flex;
  height: 39px;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  padding: 0 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--forest);
  background: var(--surface-raised);
  font-size: 9px;
  font-weight: 650;
  transition: 160ms ease;
}

.chart-footer .drawing-launch-button:hover,
.chart-footer .drawing-launch-button[aria-pressed="true"] {
  border-color: rgba(197, 111, 80, 0.38);
  color: var(--clay-deep);
  background: var(--clay-soft);
}

.chart-footer .drawing-launch-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.chart-footer .drawing-launch-button svg {
  width: 14px;
  height: 14px;
}

.chart-footer .drawing-launch-chevron {
  width: 12px;
  height: 12px;
  transition: transform 160ms ease;
}

.chart-footer .drawing-launch-button[aria-pressed="true"] .drawing-launch-chevron {
  transform: rotate(180deg);
}

.drawing-panel {
  position: fixed;
  z-index: 140;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  width: min(760px, calc(100vw - 28px));
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d9e0da;
  border-radius: 12px;
  background:
    linear-gradient(120deg, rgba(109, 145, 131, 0.06), rgba(197, 111, 80, 0.035)),
    #f8faf7;
  box-shadow:
    0 20px 55px rgba(24, 44, 43, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.drawing-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.drawing-tool-group,
.drawing-action-group,
.drawing-color-group,
.drawing-width-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.drawing-tool,
.drawing-action,
.drawing-width {
  display: inline-grid;
  width: 34px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #5d706c;
  background: transparent;
  transition: 150ms ease;
}

.drawing-tool:hover,
.drawing-action:hover,
.drawing-width:hover {
  color: var(--forest);
  border-color: var(--line);
  background: #fff;
}

.drawing-tool.is-active {
  color: #fff;
  border-color: var(--clay);
  background: var(--clay);
  box-shadow: 0 4px 12px rgba(197, 111, 80, 0.2);
}

.drawing-tool svg,
.drawing-action svg {
  width: 18px;
  height: 18px;
}

.drawing-action:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.drawing-action.is-danger:hover {
  color: var(--danger);
  border-color: rgba(182, 83, 77, 0.28);
  background: var(--danger-soft);
}

.drawing-color {
  width: 23px;
  height: 23px;
  padding: 0;
  cursor: pointer;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--draw-color);
  box-shadow: 0 0 0 1px #cbd4ce;
  transition: 150ms ease;
}

.drawing-color:hover,
.drawing-color.is-active {
  box-shadow:
    0 0 0 1px var(--draw-color),
    0 0 0 4px color-mix(in srgb, var(--draw-color) 18%, transparent);
  transform: translateY(-1px);
}

.drawing-width {
  border-color: var(--line);
  background: #fff;
}

.drawing-width i {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: currentColor;
}

.drawing-width.is-active {
  color: #fff;
  border-color: var(--forest);
  background: var(--forest);
}

.drawing-text-entry {
  display: flex;
  min-width: min(300px, 46vw);
  align-items: center;
  gap: 6px;
}

.drawing-text-entry input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 10px;
}

.drawing-text-entry button {
  height: 32px;
  flex: 0 0 auto;
  padding: 0 10px;
  cursor: pointer;
  border: 1px solid var(--clay);
  border-radius: 8px;
  color: #fff;
  background: var(--clay);
  font-size: 9px;
  font-weight: 650;
}

.chart-drawing-layer {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
}

.chart-drawing-layer--base {
  z-index: 20;
}

.chart-drawing-layer--preview {
  z-index: 21;
}

.chart-shell.is-drawing .chart-drawing-layer--preview {
  cursor: crosshair;
  pointer-events: auto;
  touch-action: none;
}

.chart-shell.is-drawing .chart-drawing-layer--preview[data-draw-tool="text"] {
  cursor: text;
}

.chart-shell.is-drawing .chart-drawing-layer--preview[data-draw-tool="eraser"] {
  cursor: cell;
}

.chart-shell.is-drawing .chart-drawing-layer--preview[data-draw-tool="pan"] {
  cursor: grab;
}

.chart-shell.is-drawing.is-panning .chart-drawing-layer--preview {
  cursor: grabbing;
}

.trend-table .prediction-divider td {
  height: 31px;
  padding: 0 12px;
  text-align: left;
  color: var(--forest);
  background: #e4ebe6;
  font: 650 9px var(--font-sans);
  letter-spacing: 0.08em;
}

.trend-table .prediction-divider span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trend-table .prediction-divider span::before {
  width: 18px;
  height: 1px;
  background: var(--clay);
  content: "";
}

.trend-table .prediction-row td {
  background: transparent;
}

.trend-table .prediction-row td.surface-warm {
  background: var(--original-warm);
}

.trend-table .prediction-row td.surface-cool {
  background: var(--original-cool);
}

.trend-table .prediction-row td.surface-sand {
  background: var(--original-sand);
}

.trend-table .prediction-row td.surface-neutral {
  background: #f7f7f7;
}

.trend-table .prediction-row td.row-sticky {
  background: #eef3ef;
}

.trend-table .prediction-row .issue-cell strong {
  color: var(--clay-deep);
}

.prediction-issue-summary {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: #59748d;
  font: 600 7px/1.2 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prediction-label {
  color: var(--muted);
  font: 600 8px var(--font-mono);
  letter-spacing: 0.08em;
}

.prediction-toolbar-row td {
  height: 44px;
  padding: 0 12px;
  background: #e5ece7;
}

.prediction-table-toolbar {
  display: flex;
  min-width: 840px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.prediction-table-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.prediction-table-heading strong {
  color: var(--forest);
  font-size: 10px;
  font-weight: 700;
}

.prediction-table-heading span {
  color: var(--muted);
  font-size: 8px;
}

.prediction-table-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.prediction-table-actions button {
  height: 27px;
  padding: 0 10px;
  cursor: pointer;
  border: 1px solid #c9d4cd;
  border-radius: 6px;
  color: var(--forest);
  background: #fff;
  font-size: 8px;
  font-weight: 600;
}

.prediction-table-actions button:hover {
  border-color: var(--sage);
  background: var(--sage-soft);
}

.prediction-table-actions button.is-danger {
  color: var(--danger);
  border-color: rgba(182, 83, 77, 0.2);
  background: rgba(255, 255, 255, 0.65);
}

.prediction-table-actions button.is-danger:hover {
  background: var(--danger-soft);
}

.prediction-table-choice {
  display: grid;
  width: 100%;
  height: 27px;
  padding: 0 3px;
  cursor: pointer;
  place-items: center;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #697a76;
  background: transparent;
  font: 600 9px var(--font-sans);
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: 120ms ease;
}

.prediction-table-choice:hover {
  color: var(--forest);
  border-color: #cbd6cf;
  background: rgba(255, 255, 255, 0.85);
}

.prediction-table-choice.is-selected {
  display: inline-grid;
  width: auto;
  min-width: 22px;
  height: 23px;
  margin: auto;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  border-color: var(--choice-tone, var(--forest));
  background: var(--choice-tone, var(--forest));
  box-shadow: 0 2px 4px rgba(31, 52, 50, 0.12);
  font: 600 9px/1 var(--font-sans);
}

.prediction-table-choice.is-number-choice.is-selected {
  width: auto;
  height: 23px;
  padding: 0 5px;
  border-radius: 999px;
}

.prediction-table-choice.is-category-choice.is-selected {
  height: 23px;
  padding: 0 5px;
  border-radius: 999px;
}

.line-layer polyline.prediction-line {
  stroke-width: 1.55;
}

.prediction-table-choice.tone-clay,
.prediction-table-choice.tone-red {
  --choice-tone: var(--original-red);
}

.prediction-table-choice.tone-orange {
  --choice-tone: var(--original-orange);
}

.prediction-table-choice.tone-teal {
  --choice-tone: var(--original-blue);
}

.prediction-table-choice.tone-blue {
  --choice-tone: var(--original-blue);
}

.prediction-table-choice.tone-sage {
  --choice-tone: var(--original-amber);
}

.prediction-table-choice.tone-forest {
  --choice-tone: var(--original-amber);
}

.prediction-table-choice.tone-gold {
  --choice-tone: var(--original-amber);
}

.prediction-table-choice.tone-sand {
  --choice-tone: var(--original-amber);
}

.prediction-table-choice.tone-gray {
  --choice-tone: var(--original-gray);
}

.prediction-table-choice.tone-green {
  --choice-tone: #009900;
}

.prediction-table-choice.tone-amber {
  --choice-tone: var(--original-amber);
}

.prediction-table-choice.tone-purple {
  --choice-tone: var(--original-purple);
}

.prediction-table-row-actions {
  display: flex;
  justify-content: center;
  gap: 2px;
}

.prediction-table-icon {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #7a8b87;
  background: transparent;
}

.prediction-table-icon:hover {
  color: var(--forest);
  border-color: var(--line);
  background: #fff;
}

.prediction-table-icon.is-danger:hover {
  color: var(--danger);
  border-color: rgba(182, 83, 77, 0.18);
  background: var(--danger-soft);
}

.prediction-table-icon:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.prediction-table-icon svg {
  width: 13px;
  height: 13px;
}

.trend-stats-row td {
  background: #f4f7f4;
}

.trend-stats-row:first-of-type td {
  border-top: 2px solid #cfdad2;
}

.trend-stats-row td.row-sticky {
  background: #eef3ef;
}

.trend-stats-row .issue-cell strong {
  color: #596b67;
  font: 650 8px var(--font-sans);
}

.trend-stat-cell {
  color: #657773;
  font: 500 10px var(--font-mono);
}

.trend-stat-cell.is-frequency-cell {
  position: relative;
  height: 40px;
  padding: 0;
  overflow: hidden;
  vertical-align: top;
}

.frequency-value {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: 0;
  left: 0;
  display: block;
  padding: 0;
  color: #596c67;
  font: 600 10px/1 var(--font-mono);
  text-align: center;
}

.frequency-bar {
  position: absolute;
  z-index: 1;
  bottom: 2px;
  left: 50%;
  width: 10px;
  height: var(--frequency-height);
  max-height: 18px;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(90deg, #009900 0%, #63b779 28%, #fdfefd 50%, #63b779 72%, #009900 100%);
  transform: translateX(-50%);
}

.prediction-zone {
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(150deg, rgba(109, 145, 131, 0.055), rgba(197, 111, 80, 0.03)),
    #f8faf7;
}

.prediction-zone-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.prediction-zone-title h4 {
  margin: 3px 0 2px;
  color: var(--ink-deep);
  font: 700 20px/1.2 var(--font-serif);
  letter-spacing: 0.04em;
}

.prediction-zone-title p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.prediction-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.prediction-actions button {
  min-height: 36px;
  padding: 0 11px;
  font-size: 9px;
}

.prediction-clear {
  color: var(--danger);
}

.prediction-list {
  display: grid;
  gap: 8px;
}

.prediction-empty {
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
}

.prediction-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font: 700 15px var(--font-serif);
}

.prediction-empty p {
  margin: 0;
  font-size: 9px;
}

.prediction-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-xs);
}

.prediction-card.is-open {
  border-color: #c5d2ca;
  background: #fff;
}

.prediction-card-head {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.prediction-toggle {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
  padding: 2px;
  cursor: pointer;
  text-align: left;
  border: 0;
  background: transparent;
}

.prediction-number {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--forest);
  font: 650 9px var(--font-mono);
}

.prediction-toggle-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.prediction-toggle-copy strong {
  color: var(--ink);
  font-size: 10px;
  font-weight: 650;
}

.prediction-toggle-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prediction-toggle-arrow {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 160ms ease;
}

.prediction-card.is-open .prediction-toggle-arrow {
  transform: rotate(180deg);
}

.prediction-row-actions {
  display: flex;
  gap: 3px;
}

.prediction-row-action {
  display: grid;
  width: 29px;
  height: 29px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #82918d;
  background: transparent;
}

.prediction-row-action:hover {
  color: var(--forest);
  border-color: var(--line);
  background: var(--surface-soft);
}

.prediction-row-action:disabled {
  cursor: not-allowed;
  color: #b6bfbb;
  opacity: 0.55;
}

.prediction-row-action.is-danger:hover {
  color: var(--danger);
  border-color: rgba(182, 83, 77, 0.2);
  background: var(--danger-soft);
}

.prediction-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 10px 8px 45px;
}

.prediction-summary span {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 8px;
}

.prediction-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 11px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.prediction-field {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.prediction-field.is-wide-field {
  grid-column: 1 / -1;
}

.prediction-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.prediction-field-head strong {
  color: var(--ink);
  font-size: 9px;
  font-weight: 650;
}

.prediction-field-head small {
  color: var(--muted);
  font-size: 7px;
}

.prediction-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.prediction-choice {
  min-width: 29px;
  height: 27px;
  padding: 0 6px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--choice-tone, var(--sage));
  border-radius: 6px;
  color: var(--ink-soft);
  background: #fff;
  font: 550 9px var(--font-sans);
  transition: 130ms ease;
}

.prediction-choice:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.prediction-choice.is-selected {
  color: #fff;
  border-color: var(--choice-tone, var(--forest));
  background: var(--choice-tone, var(--forest));
  box-shadow: 0 2px 5px rgba(31, 52, 50, 0.12);
}

.prediction-choice.tone-clay,
.prediction-choice.tone-red {
  --choice-tone: #b75d48;
}

.prediction-choice.tone-orange {
  --choice-tone: #b87843;
}

.prediction-choice.tone-teal {
  --choice-tone: #4f7d72;
}

.prediction-choice.tone-blue {
  --choice-tone: #647a95;
}

.prediction-choice.tone-sage {
  --choice-tone: #708f82;
}

.prediction-choice.tone-forest {
  --choice-tone: #3e695f;
}

.prediction-choice.tone-gold {
  --choice-tone: #a67e3e;
}

.prediction-choice.tone-sand {
  --choice-tone: #947d66;
}

.prediction-choice.tone-gray {
  --choice-tone: #7b8885;
}

.prediction-choice.tone-green {
  --choice-tone: #4f7d5f;
}

.drawer-scrim {
  position: fixed;
  z-index: 180;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  background: rgba(26, 43, 41, 0.25);
  backdrop-filter: blur(3px);
  transition: 220ms ease;
}

.drawer-scrim.is-open {
  visibility: visible;
  opacity: 1;
}

.data-drawer {
  position: fixed;
  z-index: 190;
  top: 0;
  right: 0;
  display: flex;
  width: min(440px, 100%);
  height: 100dvh;
  flex-direction: column;
  padding: 24px;
  border-left: 1px solid var(--line);
  background:
    radial-gradient(300px 240px at 100% 0, rgba(109, 145, 131, 0.1), transparent 72%),
    #fafbf8;
  box-shadow: -20px 0 64px rgba(24, 43, 41, 0.18);
  transform: translateX(102%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.data-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2,
.modal-heading h2 {
  margin: 4px 0 0;
  color: var(--ink-deep);
  font: 700 23px/1.2 var(--font-serif);
  letter-spacing: 0.04em;
}

.drawer-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.close-button {
  flex: 0 0 auto;
}

.drawer-tools {
  display: flex;
  gap: 7px;
  margin-top: 16px;
}

.grow {
  flex: 1;
}

.export-menu-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  right: 0;
  display: none;
  width: 184px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}

.export-menu.is-open {
  display: block;
}

.export-menu button {
  width: 100%;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  font-size: 10px;
}

.export-menu button:hover {
  background: var(--surface-soft);
}

.drawer-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 13px 0;
  padding: 10px 11px;
  border: 1px solid #d5e2da;
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--sage-soft);
  font-size: 9px;
  line-height: 1.65;
}

.drawer-note svg {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--sage);
}

.drawer-note a {
  margin-left: 5px;
  color: var(--forest);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.draw-list {
  display: flex;
  min-height: 120px;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding: 2px 2px 12px;
  scrollbar-color: #bcc8c0 transparent;
  scrollbar-width: thin;
}

.draw-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  transition: 150ms ease;
}

.draw-item.is-synced {
  grid-template-columns: minmax(0, 1fr) auto;
}

.draw-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.draw-item-tail {
  display: flex;
  align-items: center;
  gap: 5px;
}

.draw-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.draw-item-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.draw-sequence {
  display: flex;
  gap: 3px;
}

.mini-ball {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface-soft);
  font: 700 11px/1 var(--font-mono);
}

.mini-ball.is-repeated {
  color: #fff;
  border-color: var(--original-red);
  background: var(--original-red);
}

.draw-item-copy {
  min-width: 0;
}

.draw-item-copy strong {
  overflow: hidden;
  color: var(--ink-soft);
  font: 600 10px var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draw-action {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #8d9b97;
  background: transparent;
}

.draw-action:hover {
  color: var(--forest);
  border-color: var(--line);
  background: var(--surface-soft);
}

.draw-action.delete:hover {
  color: var(--danger);
  border-color: rgba(182, 83, 77, 0.2);
  background: var(--danger-soft);
}

.draw-source-badge {
  display: inline-flex;
  height: 23px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #c9d8d0;
  border-radius: 999px;
  color: var(--forest);
  background: #edf4ef;
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.draw-source-badge.is-manual {
  color: var(--clay-deep);
  border-color: rgba(197, 111, 80, 0.3);
  background: var(--clay-soft);
}

.draw-list-empty {
  display: flex;
  flex: 1;
  min-height: 190px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.draw-list-empty strong {
  margin-bottom: 5px;
  color: var(--ink);
  font: 700 16px var(--font-serif);
}

.draw-list-empty p {
  margin: 0;
  font-size: 9px;
}

.drawer-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.clear-lottery-button {
  flex: 0 0 100%;
}

.modal-layer {
  position: fixed;
  z-index: 220;
  inset: 0;
  display: grid;
  visibility: hidden;
  padding: 20px;
  place-items: center;
  opacity: 0;
  background: rgba(24, 42, 40, 0.32);
  backdrop-filter: blur(4px);
  transition: 180ms ease;
}

.modal-layer.is-open {
  visibility: visible;
  opacity: 1;
}

.modal-card {
  position: relative;
  width: min(540px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98);
  transition: 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-layer.is-open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 17px;
  right: 17px;
}

.modal-heading {
  padding-right: 38px;
  margin-bottom: 21px;
}

.modal-heading .section-kicker {
  display: block;
}

.modal-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.confirm-card {
  width: min(430px, 100%);
}

.confirm-card .modal-heading {
  margin-bottom: 0;
}

.confirm-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 12px;
  color: var(--gold);
  background: #f4ecdf;
  font: 700 19px var(--font-mono);
}

.confirm-symbol.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-message {
  min-height: 35px;
  white-space: pre-line;
  font-size: 11px !important;
  line-height: 1.8 !important;
}

.confirm-actions {
  margin-top: 20px;
}

.confirm-action.is-danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: 0 6px 16px rgba(182, 83, 77, 0.18);
}

.confirm-action.is-danger:hover {
  border-color: #963f3a;
  background: #963f3a;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 15px;
}

.field > span,
.color-fieldset legend {
  padding: 0;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 43px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 12px;
  transition: 150ms ease;
}

.field input::placeholder {
  color: #a0aaa7;
}

.field input:focus {
  border-color: var(--sage);
  background: #fff;
}

.field small {
  color: var(--muted);
  font-size: 8px;
}

.prize-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prize-input-row > input {
  flex: 1;
  color: var(--forest);
  font: 700 18px var(--font-mono);
  letter-spacing: 0.1em;
}

.prize-preview {
  display: flex;
  gap: 5px;
}

.prize-preview span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface-soft);
  font: 700 16px var(--font-mono);
}

.prize-preview span.is-repeated {
  color: #fff;
  border-color: var(--original-red);
  background: var(--original-red);
}

.prize-preview span.is-placeholder {
  color: #9aa6a2;
  background: #e9ede9;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 21px;
}

.color-fieldset {
  padding: 0;
  border: 0;
}

.color-fieldset legend {
  margin-bottom: 9px;
}

.color-options {
  display: flex;
  gap: 10px;
}

.color-options label {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
}

.color-options input {
  position: absolute;
  opacity: 0;
}

.color-options span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--swatch);
}

.color-options input:checked + span {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--swatch);
}

.toast-stack {
  position: fixed;
  z-index: 260;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(350px, calc(100vw - 32px));
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-md);
  animation: toastIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
  font-size: 10px;
}

.toast::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.toast.is-error::before {
  background: var(--danger);
}

.site-footer {
  width: min(1580px, calc(100% - 36px));
  margin: 0 auto;
  padding: 0 0 28px;
}

.site-footer-inner {
  padding: 15px 2px 0;
  border-top: 1px solid rgba(188, 200, 192, 0.62);
}

.site-footer p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 150ms ease;
}

.site-footer a:hover {
  color: var(--clay-deep);
}

.site-footer i {
  width: 1px;
  height: 10px;
  margin: 0 3px;
  background: var(--line-strong);
}

.site-footer svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

body.has-overlay {
  overflow: hidden;
}

@media (max-width: 1120px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .lottery-deck {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.86fr);
    gap: 16px;
    padding-right: 15px;
    padding-left: 15px;
  }

  .deck-status-list {
    grid-column: 1 / -1;
  }

  .lottery-control {
    grid-template-columns: minmax(0, 1fr) 38px 38px 38px;
  }

  .chart-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-toolbar {
    justify-content: flex-start;
  }

  .chart-tab {
    padding-right: 7px;
    padding-left: 7px;
  }
}

@media (max-width: 860px) {
  .app-main {
    width: calc(100% - 24px);
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 12px;
  }

  .lottery-deck {
    position: relative;
    top: auto;
    display: block;
    padding: 17px;
  }

  .deck-lead h1 {
    font-size: 22px;
  }

  .deck-lead p {
    max-width: 540px;
    white-space: normal;
  }

  .lottery-control {
    grid-template-columns: minmax(160px, 1fr) 40px 40px 40px;
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
  }

  .control-label {
    display: none;
  }

  .deck-status-list {
    grid-column: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 13px;
  }

  .deck-status-list > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-library-bar {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .chart-library-copy {
    display: none;
  }

  .smart-entry-button {
    width: 40px;
    height: 40px;
    justify-content: center;
    padding: 0;
  }

  .smart-entry-copy {
    display: none;
  }

  .smart-entry-pulse {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 5px;
    height: 5px;
    margin: 0;
  }

  .site-footer {
    width: calc(100% - 24px);
  }
}

.guide-launch-button {
  color: var(--clay-deep);
  border-color: rgba(197, 111, 80, 0.26);
  background: #fffaf6;
}

.guide-launch-button:hover {
  color: #8e452e;
  border-color: rgba(197, 111, 80, 0.5);
  background: #fff4ed;
}

.guide-launch-button svg {
  width: 18px;
  height: 18px;
}

.mobile-guide-launch {
  display: none;
}

body:has(.app-header.is-chart-header-hidden) .mobile-guide-launch {
  position: fixed;
  z-index: 90;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid rgba(168, 85, 57, 0.76);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #cf7b57, #a85539);
  box-shadow: 0 10px 24px rgba(120, 57, 38, 0.26);
}

body:has(.app-header.is-chart-header-hidden) .mobile-guide-launch:hover {
  color: #fff;
  background: linear-gradient(145deg, #cf7b57, #a85539);
}

body:has(.app-header.is-chart-header-hidden) .mobile-guide-launch svg {
  width: 18px;
  height: 18px;
}

.onboarding-layer {
  position: fixed;
  z-index: 320;
  inset: 0;
  pointer-events: auto;
  overscroll-behavior: contain;
  touch-action: none;
}

.onboarding-layer.is-centered {
  background: rgba(20, 35, 34, 0.58);
  backdrop-filter: blur(2px);
}

.onboarding-spotlight {
  position: fixed;
  z-index: 321;
  pointer-events: none;
  border: 2px solid rgba(244, 185, 143, 0.96);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 0 0 9999px rgba(20, 35, 34, 0.62),
    0 0 0 5px rgba(244, 185, 143, 0.2),
    0 16px 42px rgba(19, 34, 33, 0.2);
  transition:
    top 180ms ease,
    left 180ms ease,
    width 180ms ease,
    height 180ms ease;
}

.onboarding-card {
  position: fixed;
  z-index: 322;
  width: min(390px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid rgba(217, 198, 183, 0.9);
  border-radius: 18px;
  color: var(--ink);
  background:
    radial-gradient(180px 100px at 100% 0, rgba(197, 111, 80, 0.09), transparent 72%),
    linear-gradient(145deg, #fffefa, #f8f6f0);
  box-shadow: 0 28px 80px rgba(18, 35, 33, 0.26);
}

.onboarding-layer.is-centered .onboarding-card {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.onboarding-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-step-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font: 700 8px/1 var(--font-mono);
  letter-spacing: 0.09em;
}

.onboarding-step-meta b {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--forest);
  background: #fff;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.onboarding-close {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: #fff;
}

.onboarding-close:hover {
  color: var(--clay-deep);
  border-color: rgba(197, 111, 80, 0.38);
}

.onboarding-close svg {
  width: 15px;
  height: 15px;
}

.onboarding-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  margin-top: 16px;
  place-items: center;
  border: 1px solid rgba(197, 111, 80, 0.28);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--clay), var(--clay-deep));
  box-shadow: 0 8px 20px rgba(168, 85, 57, 0.2);
  font: 700 13px/1 var(--font-mono);
}

.onboarding-card h2 {
  margin: 13px 0 7px;
  color: var(--ink-deep);
  font: 700 22px/1.25 var(--font-serif);
  letter-spacing: 0.02em;
}

.onboarding-card p {
  min-height: 47px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.68;
}

.onboarding-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 17px 0 16px;
}

.onboarding-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #d7ddd8;
  transition: width 170ms ease, background 170ms ease;
}

.onboarding-dots i.is-active {
  width: 20px;
  background: var(--clay);
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.onboarding-actions > div {
  display: flex;
  gap: 7px;
}

.onboarding-skip {
  padding: 8px 0;
  cursor: pointer;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.onboarding-skip:hover {
  color: var(--ink);
}

.onboarding-button {
  min-width: 76px;
  height: 36px;
  padding: 0 14px;
  cursor: pointer;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
}

.onboarding-button.secondary {
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: #fff;
}

.onboarding-button.primary {
  border: 1px solid var(--clay-deep);
  color: #fff;
  background: var(--clay-deep);
  box-shadow: 0 6px 15px rgba(168, 85, 57, 0.18);
}

.onboarding-button:disabled {
  cursor: default;
  opacity: 0.35;
  box-shadow: none;
}

body.onboarding-open {
  overscroll-behavior: none;
}

@media (max-width: 640px) {
  .app-header {
    min-height: 58px;
    padding: 8px 11px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
    border-radius: 9px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy small {
    max-width: 195px;
    overflow: hidden;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-status {
    display: none;
  }

  .header-actions {
    gap: 5px;
  }

  .guide-launch-button {
    display: none;
  }

  .mobile-guide-launch {
    position: fixed;
    z-index: 90;
    right: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    cursor: pointer;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    border-color: rgba(168, 85, 57, 0.76);
    background: linear-gradient(145deg, #cf7b57, #a85539);
    box-shadow: 0 10px 24px rgba(120, 57, 38, 0.26);
  }

  .mobile-guide-launch:hover {
    color: #fff;
    border-color: rgba(168, 85, 57, 0.76);
    background: linear-gradient(145deg, #cf7b57, #a85539);
  }

  .mobile-guide-launch svg {
    width: 18px;
    height: 18px;
  }

  .onboarding-layer.is-centered {
    background: rgba(20, 35, 34, 0.55);
  }

  .onboarding-card {
    top: auto !important;
    right: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 12px !important;
    width: auto;
    padding: 17px;
    border-radius: 16px;
    transform: none !important;
  }

  .onboarding-symbol {
    width: 38px;
    height: 38px;
    margin-top: 12px;
  }

  .onboarding-card h2 {
    margin-top: 10px;
    font-size: 20px;
  }

  .onboarding-card p {
    min-height: 54px;
    font-size: 11.5px;
  }

  .onboarding-dots {
    margin: 13px 0 14px;
  }

  .onboarding-button {
    min-width: 70px;
    height: 35px;
    padding: 0 12px;
  }

  .app-header .smart-entry-button {
    display: none;
  }

  .mobile-smart-launch {
    position: relative;
    display: flex;
    width: calc(100% - 22px);
    min-height: 96px;
    align-items: center;
    gap: 11px;
    overflow: hidden;
    margin: 10px auto 0;
    padding: 14px 13px;
    border: 1px solid rgba(120, 54, 36, 0.2);
    border-radius: 17px;
    color: #fffaf5;
    background:
      radial-gradient(130px 100px at 92% -5%, rgba(255, 228, 207, 0.34), transparent 72%),
      linear-gradient(125deg, #d17d58 0%, #b85f40 56%, #99482f 100%);
    box-shadow:
      0 13px 30px rgba(133, 65, 43, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-decoration: none;
    isolation: isolate;
  }

  .mobile-smart-launch::before {
    position: absolute;
    z-index: -1;
    top: -55px;
    right: -28px;
    width: 150px;
    height: 150px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    box-shadow:
      0 0 0 24px rgba(255, 255, 255, 0.025),
      0 0 0 48px rgba(255, 255, 255, 0.018);
    content: "";
  }

  .mobile-smart-launch:active {
    transform: translateY(1px);
  }

  .mobile-smart-launch:focus-visible {
    outline: 3px solid rgba(197, 111, 80, 0.3);
    outline-offset: 3px;
  }

  .mobile-smart-icon {
    position: relative;
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    color: #ffe2cb;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .mobile-smart-icon::after {
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(255, 226, 203, 0.22);
    border-radius: 17px;
    content: "";
    animation: mobile-smart-halo 2.8s ease-out infinite;
  }

  .mobile-smart-icon svg {
    width: 25px;
    height: 25px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.15;
  }

  .mobile-smart-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
  }

  .mobile-smart-kicker {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 244, 234, 0.74);
    font: 700 7px/1.2 var(--font-mono);
    letter-spacing: 0.06em;
  }

  .mobile-smart-kicker i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffe0c7;
    box-shadow: 0 0 0 3px rgba(255, 224, 199, 0.12);
  }

  .mobile-smart-copy > strong {
    overflow: hidden;
    color: #fffdf9;
    font: 700 17px/1.25 var(--font-serif);
    letter-spacing: 0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-smart-copy > small {
    overflow: hidden;
    color: rgba(255, 244, 235, 0.79);
    font-size: 8.5px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-smart-go {
    display: flex;
    height: 34px;
    flex: 0 0 auto;
    align-items: center;
    gap: 3px;
    padding: 0 8px 0 11px;
    border-radius: 999px;
    color: #8d432c;
    background: #fff2e8;
    box-shadow: 0 5px 14px rgba(78, 31, 19, 0.14);
    font-size: 9px;
    font-weight: 700;
  }

  .mobile-smart-go svg {
    width: 13px;
    height: 13px;
  }

  .app-header .icon-button {
    width: 35px;
    height: 35px;
  }

  .smart-entry-button {
    width: 37px;
    height: 37px;
    border-radius: 10px;
  }

  .smart-entry-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
  }

  .smart-entry-icon svg {
    width: 15px;
    height: 15px;
  }

  .app-header .primary-button {
    position: relative;
    width: 35px;
    min-width: 35px;
    height: 35px;
    min-height: 35px;
    max-height: 35px;
    padding: 0;
    overflow: visible;
    font-size: 0;
  }

  .app-header .primary-button svg {
    width: 15px;
    height: 15px;
  }

  .app-header .count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    font-size: 8px;
  }

  .app-main {
    width: calc(100% - 14px);
    padding: 8px 0 24px;
  }

  .site-footer {
    width: calc(100% - 14px);
    padding-bottom: 22px;
  }

  .site-footer-inner {
    padding-top: 12px;
  }

  .site-footer p {
    gap: 5px;
    font-size: 8px;
    line-height: 1.8;
  }

  .site-footer i {
    display: none;
  }

  .lottery-deck {
    padding: 14px;
    border-radius: 14px;
  }

  .deck-overline {
    max-width: 245px;
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .deck-lead h1 {
    font-size: 20px;
  }

  .deck-lead p {
    max-width: 300px;
    font-size: 9px;
    line-height: 1.6;
  }

  .lottery-control {
    grid-template-columns: minmax(0, 1fr) 38px 38px 38px;
    gap: 6px;
    margin-top: 15px;
    padding-top: 14px;
  }

  .lottery-picker-trigger {
    height: 38px;
  }

  .lottery-deck .square-button {
    width: 38px;
    height: 38px;
  }

  .deck-status-list {
    gap: 0;
    margin-top: 13px;
  }

  .deck-status-list > div {
    padding: 8px 7px;
  }

  .deck-status-list span {
    font-size: 6px;
  }

  .deck-status-list b {
    font-size: 8px;
  }

  .workspace-top {
    padding: 13px;
    border-radius: 14px;
  }

  .section-heading {
    align-items: center;
    margin-bottom: 10px;
  }

  .section-heading h2 {
    font-size: 20px;
  }

  .section-heading p {
    max-width: 240px;
    font-size: 8px;
  }

  .array-readout {
    min-width: 74px;
    padding: 6px 7px;
  }

  .array-readout b {
    font-size: 17px;
  }

  .chart-library-bar {
    gap: 7px;
    margin-bottom: 7px;
    padding: 7px;
    border-radius: 10px;
  }

  .chart-library-select .custom-select-trigger {
    height: 36px;
    padding-right: 34px;
    font-size: 10px;
  }

  .chart-library-select .custom-select-menu {
    width: min(360px, calc(100vw - 28px));
    max-height: min(360px, 55vh);
  }

  .custom-select-option {
    min-height: 38px;
    font-size: 11.5px;
  }

  .custom-select-option.has-description {
    min-height: 38px;
    align-items: center;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .custom-select-option-description {
    display: none;
  }

  .custom-select-group {
    font-size: 8.5px;
  }

  .chart-favorite-button {
    height: 36px;
    padding: 0 9px;
    font-size: 9px;
  }

  .chart-step-actions .icon-button {
    width: 34px;
    height: 34px;
  }

  .chart-tabs {
    gap: 3px;
    padding: 4px;
    border-radius: 11px;
  }

  .chart-tab {
    flex: 0 0 78px;
    width: 78px;
    min-width: 78px;
    max-width: 78px;
    min-height: 60px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    overflow: hidden;
    padding: 5px 4px;
    text-align: center;
  }

  .tab-index {
    width: 25px;
    height: 22px;
    border: 1px solid #ead8cc;
    border-radius: 7px;
    background: #f7ebe4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    font-size: 8px;
  }

  .chart-tab.is-active .tab-index {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
  }

  .chart-tab > span:last-child {
    display: block;
  }

  .chart-tab strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.3;
    white-space: normal;
    word-break: break-all;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .chart-tab small {
    display: none;
  }

  .chart-panel {
    margin-top: 8px;
    border-radius: 14px;
  }

  .chart-info {
    gap: 14px;
    padding: 16px 13px 13px;
  }

  #chartTitle {
    font-size: 21px;
  }

  #chartDescription {
    font-size: 9px;
  }

  .chart-toolbar {
    width: 100%;
    gap: 5px;
  }

  .chart-toolbar .drawing-shortcut {
    display: none;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding: 0 4px;
  }

  .toggle-chip {
    height: 35px;
    flex: 1;
    justify-content: center;
  }

  .stats-grid {
    gap: 6px;
    padding: 9px 9px 0;
  }

  .stat-card {
    min-height: 59px;
    padding: 9px 10px;
  }

  .stat-value {
    font-size: 16px;
  }

  .stat-spark {
    display: none;
  }

  .bar-chart-panel {
    margin: 9px 9px 13px;
    padding: 14px 11px 11px;
    border-radius: 12px;
  }

  .bar-chart-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .bar-chart-head p {
    max-width: none;
  }

  .bar-chart-meta {
    width: 100%;
  }

  .bar-chart-meta > span {
    min-width: 0;
    flex: 1;
  }

  .bar-chart-plot {
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 6px;
  }

  .bar-prediction-key {
    display: none;
  }

  .bar-chart {
    height: 156px;
    min-width: max(100%, calc(var(--bar-count, 10) * 36px));
    grid-template-columns: repeat(var(--bar-count, 10), minmax(28px, 1fr));
    gap: 3px;
    padding: 0 2px;
  }

  .bar-chart-axis {
    height: 156px;
    padding: 15px 0 20px;
    font-size: 6px;
  }

  .bar-item {
    height: 156px;
    grid-template-rows: 18px minmax(0, 1fr) 22px;
  }

  .bar-count {
    height: 16px;
    min-width: 19px;
    padding: 0 4px;
    font-size: 7px;
  }

  .bar-track i {
    width: min(36px, 68%);
  }

  .bar-label {
    height: 22px;
    font-size: 8px;
  }

  .bar-chart-foot {
    font-size: 7px;
  }

  .chart-legend {
    gap: 11px;
    padding: 10px 10px 7px;
  }

  .legend-tip {
    display: none;
  }

  .chart-shell {
    height: 1102px;
    max-height: none;
    margin: 0 7px;
    border-radius: 8px;
  }

  .chart-stage {
    --chart-row-height: 34px;
    --chart-head-height: 68px;
    --chart-issue-width: 54px;
    --chart-number-width: 76px;
    --chart-value-width: 26px;
    --chart-wide-width: 35px;
  }

  .trend-table th,
  .trend-table td {
    height: 34px;
  }

  .trend-table thead tr:first-child th {
    height: 34px;
  }

  .trend-table thead tr:nth-child(2) th {
    top: 34px;
  }

  .trend-table .issue-col {
    width: var(--chart-issue-width);
    min-width: var(--chart-issue-width);
    max-width: var(--chart-issue-width);
  }

  .trend-table .number-col {
    left: var(--chart-issue-width);
    width: var(--chart-number-width);
    min-width: var(--chart-number-width);
    max-width: var(--chart-number-width);
  }

  .trend-table td.value-cell {
    width: var(--chart-value-width);
    min-width: var(--chart-value-width);
    max-width: var(--chart-value-width);
    font-size: 10px;
  }

  .trend-table td.wide-cell {
    width: var(--chart-wide-width);
    min-width: var(--chart-wide-width);
    max-width: var(--chart-wide-width);
    font-size: 9.5px;
  }

  .number-ball {
    width: 21px;
    height: 21px;
    font-size: 12px;
  }

  .trend-table td.win-cell .hit-dot {
    width: 21px;
    height: 21px;
    font-size: 10px;
  }

  .chart-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 10px 11px;
  }

  .chart-footer-actions {
    width: 100%;
    flex-wrap: nowrap;
    gap: 5px;
    margin-left: 0;
  }

  .chart-footer-actions > button {
    min-width: 0;
    flex: 1 1 0;
    justify-content: center;
  }

  .chart-footer .drawing-launch-button {
    height: 35px;
    margin-left: 0;
  }

  .chart-footer .text-button {
    height: 35px;
    min-height: 35px;
  }

  .chart-footer .chart-fullscreen-button {
    display: none;
  }

  .drawing-panel {
    right: 7px;
    bottom: max(7px, env(safe-area-inset-bottom));
    left: 7px;
    width: auto;
    gap: 7px;
    margin: 0;
    padding: 8px;
    border-radius: 10px;
    transform: none;
  }

  .drawing-panel-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .drawing-tool,
  .drawing-action {
    width: 32px;
    height: 31px;
  }

  .drawing-tool-group {
    min-width: 0;
    flex: 1;
    justify-content: flex-start;
  }

  .drawing-action-group {
    margin-left: auto;
  }

  .drawing-tool-group .drawing-tool,
  .drawing-action-group .drawing-action {
    width: 31px;
  }

  .drawing-text-entry {
    width: 100%;
    min-width: 0;
  }

  .chart-footer span:first-child {
    display: none;
  }

  .data-drawer {
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(88dvh, 760px);
    padding: 19px 15px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(102%);
  }

  .data-drawer.is-open {
    transform: translateY(0);
  }

  .drawer-header h2 {
    font-size: 21px;
  }

  .drawer-tools {
    margin-top: 13px;
  }

  .drawer-footer > button:first-child {
    width: 100%;
    flex: auto;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92dvh;
    padding: 23px 16px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(40px);
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .prize-input-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .prize-input-row > input {
    width: 100%;
  }

  .toast-stack {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .prediction-zone {
    padding: 14px 10px 16px;
  }

  .prediction-zone-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
  }

  .prediction-zone-title h4 {
    font-size: 18px;
  }

  .prediction-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .prediction-actions button {
    width: 100%;
  }

  .prediction-editor {
    grid-template-columns: 1fr;
  }

  .prediction-field.is-wide-field {
    grid-column: auto;
  }

  .prediction-summary {
    padding-left: 10px;
  }
}

@media (max-width: 390px) {
  .brand-copy small {
    max-width: 150px;
  }

  .section-heading p {
    display: none;
  }

  .chart-tab strong {
    font-size: 8px;
  }

  .deck-status-list b {
    font-size: 7px;
  }
}

@media (max-width: 360px) {
  .mobile-smart-launch {
    gap: 9px;
    padding: 12px 11px;
  }

  .mobile-smart-icon {
    width: 42px;
    height: 42px;
  }

  .mobile-smart-copy > strong {
    font-size: 15px;
    letter-spacing: 0.01em;
  }

  .mobile-smart-go {
    padding: 0 7px 0 9px;
  }
}

@keyframes mobile-smart-halo {
  0%,
  58% {
    opacity: 0.7;
    transform: scale(0.96);
  }
  90%,
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
