﻿:root {
  --bg: #eef8f1;
  --panel: rgba(250, 255, 251, 0.92);
  --panel-border: rgba(47, 143, 91, 0.12);
  --text: #163325;
  --muted: #5c7868;
  --accent: #68c18c;
  --accent-strong: #2f8f5b;
  --accent-soft: #d9f5e3;
  --olive: #54b87a;
  --gold: #9ae6b4;
  --gold-button-start: #f3ca47;
  --gold-button-end: #d49d15;
  --gold-button-text: #4a3200;
  --shadow: 0 18px 60px rgba(38, 92, 62, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(154, 230, 180, 0.32), transparent 28%),
    radial-gradient(circle at left center, rgba(104, 193, 140, 0.18), transparent 25%),
    linear-gradient(180deg, #f9fffb 0%, var(--bg) 100%);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  transform: translateY(-200%);
  padding: 10px 14px;
  border-radius: 12px;
  background: #103b26;
  color: #fff;
  z-index: 10;
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  color: var(--accent-strong);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.site-nav,
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-nav a,
.footer-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(47, 143, 91, 0.1);
}

.nav-label-short {
  display: none;
}

.site-nav a[aria-current="page"] {
  background: linear-gradient(135deg, rgba(104, 193, 140, 0.24), rgba(47, 143, 91, 0.18));
  color: var(--accent-strong);
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 32px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(246, 255, 249, 0.96), rgba(225, 247, 233, 0.94));
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 2px 0;
}

.hero-copy h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-lead,
.footer-text,
.legal-card p,
.content-card p,
.info-card p,
.faq-item p {
  margin: 0;
  line-height: 1.7;
}

.hero-generator {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(8px);
}

.generator-stack {
  display: grid;
  gap: 18px;
}

.generator-block {
  padding: 18px;
  border: 1px solid rgba(47, 143, 91, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.generator-title {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.panel {
  grid-column: span 4;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel-wide {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-head-hero {
  margin-bottom: 18px;
}

.section-head-hero h2 {
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.ticket {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 72px;
  align-items: center;
}

.ticket-loading {
  color: var(--muted);
  font-weight: 600;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.button-gold {
  background: linear-gradient(135deg, var(--gold-button-start) 0%, var(--gold-button-end) 100%);
  color: var(--gold-button-text);
  box-shadow: 0 10px 26px rgba(212, 157, 21, 0.22);
}

.button-gold:hover {
  filter: brightness(1.04);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(47, 143, 91, 0.12);
  color: var(--text);
  box-shadow: none;
}

.theme-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.92);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.generator-note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.generator-links {
  margin: 10px 0 0;
}

.generator-links a {
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.estimate-card .muted {
  display: block;
  margin-top: 6px;
}

.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(104, 193, 140, 0.16);
  border: 1px solid rgba(47, 143, 91, 0.16);
  font-weight: 700;
  color: var(--accent-strong);
}

.ball-large {
  width: 72px;
  height: 72px;
  min-width: 72px;
  padding: 0;
  background: linear-gradient(135deg, rgba(217, 245, 227, 0.95), rgba(154, 230, 180, 0.55));
  border: 1px solid rgba(47, 143, 91, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  font-weight: 800;
}

.ball-step-0 {
  background: linear-gradient(135deg, #f1fcf5, #dff7e7);
}

.ball-step-1 {
  background: linear-gradient(135deg, #e6f9ed, #cdf0da);
}

.ball-step-2 {
  background: linear-gradient(135deg, #d9f5e3, #bae8cc);
}

.ball-step-3 {
  background: linear-gradient(135deg, #c7edd4, #9fe0b5);
}

.ball-step-4 {
  background: linear-gradient(135deg, #aee2c0, #81d19e);
}

.ball-step-5 {
  background: linear-gradient(135deg, #8fd3aa, #58bb7d);
  color: #103b26;
}

.summary-grid,
.estimate-grid {
  display: grid;
  gap: 14px;
}

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

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

.metric-card,
.estimate-card,
.error-card,
.legal-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(47, 143, 91, 0.08);
}

.legal-card h1,
.legal-card h2 {
  margin-top: 0;
}

.metric-card.accent {
  background: linear-gradient(135deg, rgba(139, 224, 170, 0.98), rgba(73, 171, 111, 0.94));
  color: #103523;
}

.metric-label {
  display: block;
  font-size: 0.9rem;
  opacity: 0.82;
}

.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 1.4rem;
  line-height: 1.35;
}

.metric-subvalue {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.rank-chip {
  display: inline-flex;
  padding: 6px 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.chart-grid {
  display: block;
}

.probability-chart {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(47, 143, 91, 0.08);
}

.probability-chart-head,
.probability-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.probability-chart-head {
  padding: 0 0 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(47, 143, 91, 0.08);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.probability-chart-head span:last-child {
  display: flex;
  justify-content: space-between;
}

.probability-chart-body {
  display: grid;
  gap: 10px;
}

.probability-row {
  padding: 10px 0;
}

.probability-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.probability-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(104, 193, 140, 0.16);
  border: 1px solid rgba(47, 143, 91, 0.12);
  color: var(--accent-strong);
}

.probability-count {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.probability-bar-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 12px;
  align-items: center;
}

.probability-track {
  margin: 0;
  height: 14px;
}

.probability-value {
  text-align: right;
  font-size: 0.92rem;
  font-weight: 700;
}

.probability-row.warm .bar-fill {
  background: linear-gradient(90deg, #67c58e, #8dd8ab);
}

.probability-row.hot .bar-fill {
  background: linear-gradient(90deg, #2f8f5b, #68c18c);
}

.bar-track {
  margin: 10px 0 8px;
  height: 12px;
  border-radius: 999px;
  background: rgba(104, 193, 140, 0.14);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--olive), var(--gold));
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid rgba(47, 143, 91, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.ball.bonus {
  background: linear-gradient(135deg, #2f8f5b, #227549);
  border-color: rgba(34, 117, 73, 0.24);
  color: #f7fff9;
}

.notes-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.rounds-table {
  overflow-x: auto;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.legal-shell {
  display: grid;
  gap: 18px;
}

.noscript-banner {
  max-width: 1400px;
  margin: 0 auto 24px;
  padding: 0 20px;
  color: var(--text);
}

a {
  color: var(--accent-strong);
}

:root[data-theme="dark"] {
    --bg: #09130e;
    --panel: rgba(15, 28, 21, 0.92);
    --panel-border: rgba(114, 213, 150, 0.12);
    --text: #e8f5ee;
    --muted: #9cb8ab;
    --accent: #74c794;
    --accent-strong: #98e2b6;
    --accent-soft: rgba(104, 193, 140, 0.16);
    --olive: #7bd09b;
    --gold: #e1c75f;
    --gold-button-start: #f4d76b;
    --gold-button-end: #b98610;
    --gold-button-text: #221700;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top right, rgba(116, 199, 148, 0.15), transparent 24%),
    radial-gradient(circle at left center, rgba(212, 157, 21, 0.11), transparent 22%),
    linear-gradient(180deg, #0d1712 0%, var(--bg) 100%);
}

:root[data-theme="dark"] .skip-link {
  background: #eaf7ef;
  color: #102317;
}

:root[data-theme="dark"] .site-nav a,
:root[data-theme="dark"] .footer-nav a,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .hero-generator,
:root[data-theme="dark"] .generator-block,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .estimate-card,
:root[data-theme="dark"] .error-card,
:root[data-theme="dark"] .legal-card,
:root[data-theme="dark"] .probability-chart,
:root[data-theme="dark"] .site-footer {
  background: rgba(18, 33, 25, 0.88);
  border-color: rgba(114, 213, 150, 0.12);
}

:root[data-theme="dark"] .theme-toggle:hover {
  background: rgba(25, 43, 33, 0.96);
}

:root[data-theme="dark"] .hero {
  background: linear-gradient(135deg, rgba(15, 28, 21, 0.96), rgba(12, 23, 18, 0.92));
}

:root[data-theme="dark"] .metric-card.accent {
  background: linear-gradient(135deg, rgba(122, 211, 154, 0.96), rgba(64, 146, 96, 0.94));
  color: #0b2015;
}

:root[data-theme="dark"] .metric-card.accent .metric-label,
:root[data-theme="dark"] .metric-card.accent .metric-subvalue {
  color: #153624;
}

:root[data-theme="dark"] .metric-card.accent .metric-value {
  color: #08150e;
  text-shadow: none;
}

:root[data-theme="dark"] .probability-number,
:root[data-theme="dark"] .ball {
  background: rgba(116, 199, 148, 0.12);
  border-color: rgba(116, 199, 148, 0.18);
  color: #d9f7e6;
}

:root[data-theme="dark"] .ball-large {
  border-color: rgba(114, 213, 150, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .ball-step-0 {
  background: linear-gradient(135deg, #1a3125, #244735);
}

:root[data-theme="dark"] .ball-step-1 {
  background: linear-gradient(135deg, #20402f, #2d5640);
}

:root[data-theme="dark"] .ball-step-2 {
  background: linear-gradient(135deg, #27503a, #36684c);
}

:root[data-theme="dark"] .ball-step-3 {
  background: linear-gradient(135deg, #316449, #3f7a58);
}

:root[data-theme="dark"] .ball-step-4 {
  background: linear-gradient(135deg, #3d7a58, #52a170);
}

:root[data-theme="dark"] .ball-step-5 {
  background: linear-gradient(135deg, #4f9a6c, #6bc18d);
  color: #f7fff9;
}

:root[data-theme="dark"] .ball.bonus {
  background: linear-gradient(135deg, #f0c452, #cf9311);
  border-color: rgba(240, 196, 82, 0.28);
  color: #231700;
}

:root[data-theme="dark"] #refresh-button {
  color: #102317;
}

:root[data-theme="dark"] .bar-track {
  background: rgba(116, 199, 148, 0.12);
}

:root[data-theme="dark"] th,
:root[data-theme="dark"] td,
:root[data-theme="dark"] .probability-chart-head,
:root[data-theme="dark"] tr {
  border-color: rgba(114, 213, 150, 0.1);
}

:root[data-theme="dark"] .site-nav a,
:root[data-theme="dark"] .footer-nav a,
:root[data-theme="dark"] .theme-toggle {
  color: var(--text);
}

:root[data-theme="dark"] .site-nav a[aria-current="page"] {
  background: linear-gradient(135deg, rgba(116, 199, 148, 0.22), rgba(56, 117, 79, 0.22));
}

:root[data-theme="dark"] .button-gold {
  box-shadow: 0 10px 30px rgba(212, 157, 21, 0.26);
}

:root[data-theme="dark"] tr {
  background: rgba(18, 33, 25, 0.72);
}

:root[data-theme="dark"] a {
  color: #b7efcd;
}

@media (max-width: 1100px) {
  .panel,
  .panel-wide {
    grid-column: 1 / -1;
  }

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

@media (max-width: 720px) {
  .page-shell {
    padding: 20px 14px 40px;
  }

  .site-header {
    align-items: stretch;
  }

  .site-footer,
  .hero,
  .panel {
    padding: 20px;
  }

  .site-header,
  .header-actions,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-header,
  .header-actions {
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    row-gap: 8px;
  }

  .site-nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .site-nav a {
    min-width: 0;
    min-height: 36px;
    padding: 8px 1px;
    border-radius: 14px;
    font-size: clamp(0.54rem, 2.75vw, 0.72rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }

  .nav-label-full {
    display: inline;
  }

  .nav-label-short {
    display: none;
  }

  .site-footer {
    border-radius: 22px;
  }

  .theme-toggle {
    width: auto;
    justify-self: end;
    align-self: start;
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  .section-head button,
  .section-head .button-gold {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .hero,
  .panel {
    border-radius: 22px;
  }

  .hero-generator {
    padding: 16px 14px;
    min-width: 0;
    overflow: hidden;
  }

  .hero-copy {
    padding-top: 0;
  }

  .generator-stack,
  .generator-block,
  .section-head-hero,
  .section-head-hero > div {
    min-width: 0;
  }

  .generator-stack {
    gap: 12px;
  }

  .generator-block {
    padding: 14px 10px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .probability-caption {
    font-size: 0.72rem;
    white-space: nowrap;
    letter-spacing: -0.02em;
  }

  .section-head-hero .muted,
  .generator-note,
  .generator-links {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .generator-title {
    font-size: 0.88rem;
  }

  .generator-note,
  .generator-links a,
  .ticket.ticket-loading {
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .summary-grid,
  .estimate-grid {
    grid-template-columns: 1fr;
  }

  .estimate-card .muted {
    margin-top: 8px;
    font-size: 0.86rem;
  }

  .probability-chart {
    padding: 14px;
  }

  .probability-chart-head {
    display: none;
  }

  .probability-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 0;
  }

  .probability-bar-wrap {
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 10px;
  }

  .ticket {
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
  }

  .ticket.ticket-loading {
    display: block;
    min-height: auto;
  }

  .ball-large {
    width: min(calc((100% - 15px) / 6), 40px);
    height: auto;
    min-width: 0;
    aspect-ratio: 1 / 1;
    font-size: clamp(0.8rem, 3.2vw, 0.92rem);
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(47, 143, 91, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.45);
  }

  td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 8px 0;
    border: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
  }

  .balls {
    gap: 6px;
  }
}

@media (max-width: 380px) {
  .site-nav a {
    font-size: clamp(0.5rem, 2.7vw, 0.6rem);
    letter-spacing: -0.04em;
  }

  .theme-toggle {
    font-size: 0.74rem;
  }
}
