:root {
  --bg-base: #060b18;
  --bg-elev: rgba(8, 20, 43, 0.76);
  --line: rgba(138, 192, 255, 0.24);
  --line-strong: rgba(157, 214, 255, 0.46);
  --text-main: #e8f3ff;
  --text-muted: #a9c1df;
  --brand-a: #38c7ff;
  --brand-b: #73ffcf;
  --danger: #ff7676;
  --radius: 18px;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  --stat-bg: rgba(7, 20, 45, 0.7);
  --primary-grad-a: rgba(56, 199, 255, 0.35);
  --primary-grad-b: rgba(115, 255, 207, 0.35);
  --body-bg:
    radial-gradient(circle at 10% 10%, #183267 0, rgba(24, 50, 103, 0) 32%),
    radial-gradient(circle at 92% 14%, #1f6f7a 0, rgba(31, 111, 122, 0) 36%),
    linear-gradient(160deg, #04070f 0%, #071226 45%, #08152f 100%);
  --aurora-bg:
    conic-gradient(
      from 120deg at 50% 50%,
      rgba(70, 200, 255, 0.14),
      rgba(130, 255, 207, 0.08),
      rgba(70, 200, 255, 0.12)
    );
  --card-bg: rgba(8, 20, 43, 0.74);
  --chip-bg: rgba(8, 17, 36, 0.6);
  --input-bg: rgba(7, 18, 40, 0.8);
  --ghost-bg: rgba(11, 26, 56, 0.56);
}

:root[data-theme="light"] {
  --bg-base: #eef2f7;
  --bg-elev: rgba(255, 255, 255, 0.84);
  --line: rgba(30, 56, 91, 0.16);
  --line-strong: rgba(52, 112, 189, 0.34);
  --text-main: #17283f;
  --text-muted: #586d88;
  --brand-a: #2f86ff;
  --brand-b: #2e9eb3;
  --danger: #c7445c;
  --shadow: 0 18px 40px rgba(18, 44, 77, 0.13);
  --stat-bg: rgba(255, 255, 255, 0.9);
  --primary-grad-a: rgba(81, 145, 255, 0.34);
  --primary-grad-b: rgba(72, 186, 201, 0.3);
  --body-bg:
    radial-gradient(circle at 10% 8%, rgba(119, 161, 236, 0.22) 0, rgba(119, 161, 236, 0) 38%),
    radial-gradient(circle at 88% 10%, rgba(113, 207, 210, 0.18) 0, rgba(113, 207, 210, 0) 35%),
    linear-gradient(162deg, #edf2f8 0%, #f4f7fb 56%, #fbfcfe 100%);
  --aurora-bg:
    conic-gradient(
      from 120deg at 50% 50%,
      rgba(41, 120, 229, 0.1),
      rgba(65, 174, 170, 0.07),
      rgba(41, 120, 229, 0.08)
    );
  --card-bg: rgba(255, 255, 255, 0.88);
  --chip-bg: rgba(246, 249, 253, 0.94);
  --input-bg: rgba(255, 255, 255, 0.94);
  --ghost-bg: rgba(241, 246, 251, 0.92);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "SUIT", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: var(--body-bg);
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: -40%;
  background: var(--aurora-bg);
  filter: blur(48px);
  z-index: 0;
  animation: flow 16s linear infinite;
  pointer-events: none;
}

@keyframes flow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1200px, 92vw);
  margin: 0 auto;
  padding: 32px 0 56px;
}

.shell-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.local-time-widget {
  min-width: 230px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.local-time-label {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.local-time-value {
  margin: 4px 0 0;
  font-family: "Orbitron", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.local-time-meta {
  margin: 3px 0 0;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.hero {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  transform: translateY(0);
  animation: rise-in 0.7s ease-out;
}

.hero-compact {
  padding-bottom: 20px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  font-size: 0.83rem;
  color: var(--brand-b);
}

h1,
h2 {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  margin: 10px 0 10px;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
}

.hero-copy {
  margin: 0;
  color: var(--text-muted);
  max-width: 70ch;
  line-height: 1.58;
}

.meta-line {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 10px 16px;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(90deg, var(--primary-grad-a), var(--primary-grad-b));
  border-color: var(--line-strong);
}

.btn-ghost {
  background: var(--ghost-bg);
  border-color: var(--line);
}

.theme-toggle {
  min-width: 128px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
}

.theme-icons {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.theme-icon {
  font-size: 0.95rem;
  opacity: 0.35;
  transform: scale(0.88);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.theme-label {
  font-size: 0.84rem;
  font-weight: 700;
}

:root[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: scale(1.06);
}

:root[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: scale(1.06);
}

.stats-panel {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  background: var(--stat-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.stat-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-value {
  margin: 8px 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.stat-inline {
  font-size: 1rem;
  line-height: 1.5;
}

.stat-ball-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}

.stat-plus {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 2px;
}

.stat-top-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.stat-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stat-top-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
}

.stat-top-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.recommendation-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.algo-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
  min-height: 44px;
}

.algo-prob {
  margin: 10px 0 12px;
  color: var(--brand-b);
  font-weight: 600;
}

.set-list {
  display: grid;
  gap: 10px;
}

.set-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--chip-bg);
}

.set-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ball-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
}

.ball {
  width: 34px;
  height: 34px;
  position: relative;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0b2740;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.35) 34%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(165deg, #c4f2ff 0%, #78d7ff 54%, #4eaee6 100%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.6),
    inset 0 -5px 8px rgba(24, 88, 143, 0.17),
    0 6px 10px rgba(17, 53, 85, 0.18);
}

.ball::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 8px;
  width: 7px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  filter: blur(0.2px);
}

.ball::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 74%;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(27, 59, 89, 0.28) 0%, rgba(27, 59, 89, 0) 74%);
  pointer-events: none;
}

.ball.mini {
  width: 28px;
  height: 28px;
  font-size: 0.78rem;
}

.ball.mini::before {
  top: 4px;
  left: 6px;
  width: 6px;
  height: 4px;
}

.ball.bonus {
  color: #5b3408;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.32) 34%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(165deg, #ffeab4 0%, #ffbb6d 52%, #ef9541 100%);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.58),
    inset 0 -5px 8px rgba(170, 96, 24, 0.17),
    0 6px 10px rgba(99, 59, 10, 0.2);
}

.ball.changed {
  animation: changed-pop 0.64s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes changed-pop {
  0% {
    transform: scale(0.72);
    filter: saturate(1.9);
    box-shadow: 0 0 0 rgba(66, 255, 220, 0.1);
  }
  55% {
    transform: scale(1.18);
    box-shadow: 0 0 24px rgba(66, 255, 220, 0.58);
  }
  100% {
    transform: scale(1);
    box-shadow:
      inset 0 2px 4px rgba(255, 255, 255, 0.6),
      inset 0 -5px 8px rgba(24, 88, 143, 0.17),
      0 6px 10px rgba(17, 53, 85, 0.18);
  }
}

.disclaimer {
  margin-top: 14px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.site-meta-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--chip-bg);
}

.site-meta-title {
  margin: 0;
  font-size: 0.95rem;
}

.site-meta-copy {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.site-meta-links {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-info-group {
  margin-top: 16px;
  display: grid;
  gap: 2px;
}

.site-info-group .site-meta-links {
  margin-top: 0;
}

.site-meta-links .btn {
  padding: 8px 14px;
}

.latest-history-card {
  margin-top: 14px;
}

.latest-history-table {
  min-width: 860px;
}

.latest-history-table td:last-child,
.latest-history-table th:last-child {
  text-align: right;
}

.latest-history-table td:nth-child(5),
.latest-history-table th:nth-child(5) {
  text-align: center;
}

.latest-history-card a {
  color: var(--text-main);
  text-underline-offset: 3px;
}

.content-guide-panel {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.content-guide-panel h2 {
  margin: 0;
}

.content-guide-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.content-guide-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  line-height: 1.55;
}

.policy-layer[hidden] {
  display: none;
}

.policy-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.policy-layer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 24, 0.7);
  backdrop-filter: blur(2px);
}

.policy-layer__panel {
  position: relative;
  width: min(760px, 94vw);
  max-height: min(84vh, 860px);
  margin: 8vh auto 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.policy-layer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.policy-layer__header h2 {
  margin: 0;
  font-size: 1rem;
}

.policy-layer__close {
  min-width: 42px;
  padding: 8px 10px;
}

.policy-layer__body {
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}

.policy-layer__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.policy-tab-btn.active {
  background: linear-gradient(90deg, var(--primary-grad-a), var(--primary-grad-b));
  border-color: var(--line-strong);
  font-weight: 700;
}

.policy-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--chip-bg);
  padding: 12px;
  display: grid;
  gap: 8px;
  line-height: 1.6;
}

.policy-panel h3,
.policy-panel p {
  margin: 0;
}

.policy-panel a {
  color: var(--text-main);
  text-underline-offset: 3px;
}

.history-toolbar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-toolbar input {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-main);
  padding: 10px 12px;
  min-width: 180px;
}

.table-wrap {
  margin-top: 12px;
  overflow: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  font-size: 0.93rem;
}

.history-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.history-table td:last-child,
.history-table th:last-child {
  text-align: right;
}

.history-table td:nth-child(5),
.history-table th:nth-child(5) {
  text-align: center;
}

.table-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-balls .ball {
  width: 30px;
  height: 30px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #09243b;
  text-shadow: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.22) 34%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(165deg, #bfeeff 0%, #79d5ff 54%, #4fa8df 100%);
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.52),
    inset 0 -3px 5px rgba(23, 83, 133, 0.14),
    0 4px 8px rgba(17, 53, 85, 0.16);
}

.table-balls .ball.bonus {
  color: #573005;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.84) 0%, rgba(255, 255, 255, 0.2) 34%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(165deg, #ffe7aa 0%, #ffc072 52%, #ea9a45 100%);
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.5),
    inset 0 -3px 5px rgba(161, 92, 22, 0.14),
    0 4px 8px rgba(94, 56, 11, 0.17);
}

.table-balls .ball::before {
  display: none;
}

.table-balls .ball::after {
  display: none;
}

.empty-state {
  color: var(--danger);
  font-weight: 600;
}

.pagination-wrap {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

body.modal-open {
  overflow: hidden;
}

.history-layer[hidden] {
  display: none;
}

.history-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.history-layer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 24, 0.7);
  backdrop-filter: blur(2px);
}

.history-layer__panel {
  position: relative;
  width: min(1180px, 94vw);
  height: min(86vh, 920px);
  margin: 7vh auto 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.history-layer__body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  overflow: hidden;
}

.history-layer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.history-layer__header h2 {
  margin: 0;
  font-size: 1rem;
}

.history-layer__close {
  min-width: 42px;
  padding: 8px 10px;
}

.history-layer .history-toolbar {
  margin-top: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.history-layer .history-toolbar .meta-line {
  margin: 0 0 0 auto;
}

.history-layer__table-wrap {
  margin-top: 0;
  padding: 0 12px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.history-layer .history-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(10, 26, 52, 0.94);
  box-shadow: 0 1px 0 rgba(137, 190, 255, 0.18);
}

.history-layer__pagination {
  margin-top: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  justify-content: center;
}

.page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-number-btn {
  min-width: 40px;
  padding: 8px 12px;
}

.page-number-btn.active {
  background: linear-gradient(90deg, var(--primary-grad-a), var(--primary-grad-b));
  border-color: var(--line-strong);
  font-weight: 700;
}

.page-info-inline {
  margin: 0;
  min-width: 70px;
  text-align: center;
}

:root[data-theme="light"] .history-layer__backdrop {
  background: rgba(25, 42, 66, 0.36);
  backdrop-filter: blur(5px) saturate(1.06);
}

:root[data-theme="light"] .policy-layer__backdrop {
  background: rgba(25, 42, 66, 0.36);
  backdrop-filter: blur(5px) saturate(1.06);
}

:root[data-theme="light"] .policy-layer__panel {
  border-color: rgba(45, 79, 124, 0.24);
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.97) 0%, rgba(244, 248, 252, 0.96) 58%, rgba(240, 245, 251, 0.96) 100%);
  box-shadow:
    0 24px 44px rgba(18, 45, 79, 0.2),
    0 2px 0 rgba(255, 255, 255, 0.85) inset;
}

:root[data-theme="light"] .policy-layer__header {
  border-bottom-color: rgba(47, 85, 133, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(247, 251, 255, 0.86) 100%);
}

:root[data-theme="light"] .policy-layer .btn-ghost {
  border-color: rgba(58, 101, 157, 0.24);
  background: rgba(241, 248, 255, 0.92);
  color: #1f3756;
}

:root[data-theme="light"] .policy-layer .btn-ghost:hover {
  background: rgba(230, 241, 255, 0.95);
  border-color: rgba(53, 96, 151, 0.32);
}

:root[data-theme="light"] .history-layer__panel {
  border-color: rgba(45, 79, 124, 0.24);
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.97) 0%, rgba(244, 248, 252, 0.96) 58%, rgba(240, 245, 251, 0.96) 100%);
  box-shadow:
    0 24px 44px rgba(18, 45, 79, 0.2),
    0 2px 0 rgba(255, 255, 255, 0.85) inset;
}

:root[data-theme="light"] .history-layer__header {
  border-bottom-color: rgba(47, 85, 133, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(247, 251, 255, 0.86) 100%);
}

:root[data-theme="light"] .history-layer__header h2 {
  color: #1e3552;
}

:root[data-theme="light"] .history-layer .history-toolbar {
  border-bottom-color: rgba(47, 85, 133, 0.18);
  background: rgba(246, 250, 255, 0.78);
}

:root[data-theme="light"] .history-layer .history-toolbar input {
  border-color: rgba(61, 104, 161, 0.25);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .history-layer__table-wrap {
  background: rgba(252, 254, 255, 0.82);
}

:root[data-theme="light"] .history-table th {
  color: #476184;
  background: rgba(242, 248, 255, 0.95);
}

:root[data-theme="light"] .history-table td {
  color: #1f344f;
  border-bottom-color: rgba(47, 85, 133, 0.14);
}

:root[data-theme="light"] .history-table tbody tr:hover {
  background: rgba(235, 244, 255, 0.62);
}

:root[data-theme="light"] .history-layer__pagination {
  border-top-color: rgba(47, 85, 133, 0.18);
  background: rgba(246, 250, 255, 0.8);
}

:root[data-theme="light"] .history-layer .btn-ghost {
  border-color: rgba(58, 101, 157, 0.24);
  background: rgba(241, 248, 255, 0.92);
  color: #1f3756;
}

:root[data-theme="light"] .history-layer .btn-ghost:hover {
  background: rgba(230, 241, 255, 0.95);
  border-color: rgba(53, 96, 151, 0.32);
}

:root[data-theme="light"] .history-layer .page-number-btn.active {
  color: #112a45;
  border-color: rgba(56, 102, 160, 0.44);
  box-shadow: 0 6px 12px rgba(45, 96, 163, 0.18);
}

.fireworks-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.22s ease;
  filter: saturate(1.08);
}

.fireworks-overlay.active {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .aurora {
    animation: none;
  }

  .ball.changed {
    animation: none;
  }

  .fireworks-overlay {
    display: none;
  }
}

@media (max-width: 767px) {
  .shell {
    width: min(1100px, 94vw);
    padding-top: 20px;
  }

  .shell-top-actions {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 8px;
  }

  .local-time-widget {
    min-width: 0;
  }

  .hero {
    padding: 20px;
  }

  .stats-panel,
  .recommendation-grid {
    grid-template-columns: 1fr;
  }

  .history-layer__panel {
    width: 96vw;
    height: 90vh;
    margin-top: 5vh;
  }

  .history-layer .history-toolbar .meta-line {
    width: 100%;
    margin-left: 0;
  }

  .history-layer__pagination {
    gap: 8px;
  }
}

@media (min-width: 768px) and (max-width: 1279px) {
  .stats-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 1280px) {
  .shell {
    width: min(1400px, 90vw);
  }

  .hero {
    padding: 34px;
  }

  .card {
    padding: 20px;
  }
}
