:root {
  --ink: #18302b;
  --muted: #62736e;
  --paper: #f7f4ec;
  --surface: #fffdf8;
  --green: #153a33;
  --green-2: #2e6b5e;
  --orange: #d4663f;
  --orange-soft: #f5d2c1;
  --line: #d9ddd6;
  --shadow: 0 22px 54px rgba(23, 54, 47, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--green-2); text-underline-offset: 3px; }
button, select, input { font: inherit; }

.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px max(24px, calc((100vw - 1180px) / 2)); background: rgba(247,244,236,.94); border-bottom: 1px solid rgba(24,48,43,.12); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: white; background: var(--orange); border-radius: 50%; }
.data-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.data-status small { padding-left: 10px; border-left: 1px solid var(--line); }
.status-dot { width: 8px; height: 8px; background: #36a878; border-radius: 50%; box-shadow: 0 0 0 4px rgba(54,168,120,.14); }
.status-dot.delayed { background: var(--orange); box-shadow: 0 0 0 4px rgba(212,102,63,.14); }

main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }
.workspace { display: grid; grid-template-columns: minmax(0, .85fr) minmax(480px, 1.15fr); align-items: center; gap: clamp(42px, 7vw, 90px); min-height: 610px; padding: 72px 0 64px; }
.eyebrow { margin: 0 0 10px; color: var(--orange); font-size: .75rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-weight: 600; letter-spacing: -.035em; }
h1 { max-width: 620px; font-size: clamp(2.8rem, 5.8vw, 5rem); line-height: .98; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.intro > p:last-child { max-width: 590px; margin: 24px 0 0; color: var(--muted); font-size: 1.04rem; line-height: 1.7; }

.picker-card { position: relative; overflow: hidden; padding: 30px; background: var(--green); color: white; border-radius: 28px; box-shadow: var(--shadow); }
.picker-card::after { position: absolute; right: -80px; bottom: -110px; width: 260px; height: 260px; content: ''; border: 40px solid rgba(255,255,255,.045); border-radius: 50%; }
.picker-controls { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: grid; gap: 7px; color: inherit; font-size: .78rem; font-weight: 750; letter-spacing: .04em; }
select, input { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: white; border: 1px solid transparent; border-radius: 10px; outline: none; }
select:focus, input:focus, button:focus-visible { box-shadow: 0 0 0 3px rgba(212,102,63,.35); }
.method-note { min-height: 44px; margin: 18px 0 8px; color: #c9d9d4; font-size: .88rem; line-height: 1.55; }
.pick-output { position: relative; z-index: 1; display: grid; gap: 22px; padding-top: 24px; }
.balls { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ball { display: grid; min-width: 0; aspect-ratio: 1; place-items: center; color: var(--green); background: var(--surface); border: 4px solid rgba(255,255,255,.2); border-radius: 50%; font-size: clamp(1.1rem, 2.4vw, 1.55rem); font-weight: 850; box-shadow: inset 0 -7px 0 rgba(21,58,51,.08); }
.primary-button { position: relative; z-index: 1; min-height: 50px; color: white; background: var(--orange); border: 0; border-radius: 12px; font-weight: 800; cursor: pointer; }
.primary-button:hover { background: #e2754c; }
.manual-panel { position: relative; z-index: 2; margin-top: 18px; padding: 16px; background: rgba(255,255,255,.07); border-radius: 14px; }
.manual-heading { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: .8rem; }
.manual-heading span { color: #c9d9d4; }
.number-locks { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.lock-number { aspect-ratio: 1; padding: 0; color: white; background: transparent; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; cursor: pointer; font-size: .72rem; }
.lock-number[aria-pressed="true"] { color: var(--green); background: white; border-color: white; font-weight: 800; }

.analysis-section, .results-section { padding: 72px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--muted); text-align: right; }
.frequency-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 8px; }
.frequency-cell { display: grid; min-height: 62px; place-items: center; padding: 8px; background: color-mix(in srgb, var(--orange) calc(var(--intensity) * 82%), var(--surface)); border: 1px solid rgba(24,48,43,.09); border-radius: 10px; }
.frequency-cell strong { font-size: 1rem; }
.frequency-cell span { color: var(--muted); font-size: .72rem; }
.legend { display: flex; justify-content: end; gap: 20px; margin-top: 14px; color: var(--muted); font-size: .75rem; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 12px; height: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 3px; }
.legend-dot.high { background: var(--orange); }
.additional-panel { margin-top: 24px; padding: 18px 20px; background: rgba(255,255,255,.48); border: 1px solid var(--line); border-radius: 14px; }
.additional-panel summary { font-weight: 750; cursor: pointer; }
.additional-panel .frequency-grid { margin-top: 18px; }
.compact .frequency-cell { min-height: 52px; }

.results-heading { align-items: center; }
.table-filters { display: flex; gap: 10px; }
.table-filters label { color: var(--muted); }
.table-filters input { border-color: var(--line); }
.table-wrap { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 30px rgba(23,54,47,.05); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 18px; border-bottom: 1px solid #e8e8e2; text-align: left; }
th { color: white; background: var(--green); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf4e9; }
.mini-balls { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-ball, .additional-ball { display: inline-grid; width: 32px; height: 32px; place-items: center; border: 1px solid #cfd7d1; border-radius: 50%; font-size: .78rem; font-weight: 750; }
.additional-ball { color: white; background: var(--orange); border-color: var(--orange); }
.empty-state { padding: 30px; text-align: center; }

.notice { display: flex; gap: 14px; margin: 0 0 70px; padding: 18px 20px; color: #5d5f57; background: #ede8db; border-left: 4px solid var(--orange); font-size: .86rem; line-height: 1.55; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px max(24px, calc((100vw - 1180px) / 2)); color: #cbd9d5; background: var(--green); font-size: .78rem; }
footer a { color: white; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 820px) {
  .site-header { align-items: flex-start; }
  .data-status { display: grid; gap: 2px; text-align: right; }
  .status-dot { display: none; }
  .data-status small { padding: 0; border: 0; }
  .workspace { grid-template-columns: 1fr; min-height: 0; padding: 54px 0; }
  .picker-card { padding: 24px; }
  .frequency-grid { grid-template-columns: repeat(7, 1fr); }
  .section-heading, .results-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > p { text-align: left; }
  .table-filters { width: 100%; }
  .table-filters label { flex: 1; }
}

@media (max-width: 600px) {
  main { width: min(100% - 24px, 1180px); }
  .site-header { padding: 12px; }
  .brand > span:last-child { display: none; }
  h1 { font-size: 2.7rem; }
  .picker-controls { grid-template-columns: 1fr; }
  .number-locks { grid-template-columns: repeat(7, 1fr); }
  .frequency-grid { grid-template-columns: repeat(5, 1fr); }
  .frequency-cell { min-height: 56px; }
  .table-wrap { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  table, thead, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
  tbody tr:hover { background: var(--surface); }
  td { padding: 0; border: 0; }
  td::before { display: block; margin-bottom: 4px; color: var(--muted); content: attr(data-label); font-size: .68rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
  td:nth-child(3) { grid-column: 1 / -1; }
  td:last-child { align-self: end; text-align: right; }
  .table-filters { flex-direction: column; }
  .notice, footer { flex-direction: column; }
}
