:root {
  color-scheme: dark;
  --page-bg: #090a0f;
  --card-bg: #121422;
  --field-bg: #171a2b;
  --border: #292b40;
  --accent: #d8b4fe;
  --muted: #a8a5b8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page-bg); color: #f3f0fa; font: 16px/1.6 system-ui, "Malgun Gothic", sans-serif; }
a { color: var(--accent); }
button, input, select { font: inherit; }
button, .action { min-height: 44px; border-radius: 10px; padding: 9px 16px; border: 1px solid #8047b6; background: #7135ae; color: #fff; cursor: pointer; }
button:hover, .action:hover { background: #8343c4; }
button.secondary, .action.secondary { background: var(--field-bg); border-color: var(--border); }
button.danger { color: #ffb5bd; background: #2a1821; border-color: #78404f; }
button:disabled, input:disabled { opacity: .6; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.brand { color: #f3e6ff; text-decoration: none; font-weight: 850; font-size: 1.2rem; }
.tool-main { width: min(1050px, calc(100% - 32px)); margin: 32px auto 56px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 16px; }
p { margin: 8px 0; }
.intro, .hint { color: var(--muted); }
.hint { font-size: .88rem; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 24px; align-items: start; }
.panel { min-width: 0; padding: 24px; border: 1px solid #543374; border-radius: 20px; background: var(--card-bg); }
.panel.wide { grid-column: 1 / -1; }
.fields { display: grid; gap: 16px; }
label.field { display: grid; gap: 6px; color: #e0daed; font-size: .93rem; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; min-height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--field-bg); color: #fff; padding: 9px 12px; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: #ac67ec; flex: none; }
.check-field { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.action { display: inline-flex; align-items: center; text-decoration: none; }
.status { min-height: 1.5em; overflow-wrap: anywhere; color: var(--accent); margin: 12px 0 0; }
.status.error { color: #ffb1bc; }
.result { font-size: clamp(1.45rem, 4vw, 2.1rem); font-weight: 800; color: var(--accent); overflow-wrap: anywhere; white-space: pre-line; }
.result-detail { white-space: pre-line; color: #d2cbdc; overflow-wrap: anywhere; }
.record-list { padding: 0; margin: 16px 0 0; list-style: none; display: grid; gap: 12px; }
.record { min-width: 0; border: 1px solid var(--border); background: var(--field-bg); border-radius: 12px; padding: 16px; overflow-wrap: anywhere; }
.record h3 { margin: 0; font-size: 1.05rem; }
.record p { margin: 4px 0; }
.record .actions { margin-top: 10px; }
.record label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.record .completed { text-decoration: line-through; color: var(--muted); }
.filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
.filter .field { width: 220px; max-width: 100%; }
.tool-footer { border-top: 1px solid var(--border); padding: 20px 16px; text-align: center; color: var(--muted); font-size: .85rem; }
.lotto-balls { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; max-width: 420px; list-style: none; padding: 0; margin: 16px 0; }
.lotto-ball { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; font-weight: 850; font-size: clamp(1rem, 3vw, 1.35rem); color: white; }
.lotto-range-0 { background: #292c42; color: var(--muted); }
.lotto-range-1 { background: #765800; }
.lotto-range-2 { background: #17548f; }
.lotto-range-3 { background: #963b5a; }
.lotto-range-4 { background: #53566a; }
.lotto-range-5 { background: #276348; }
@media (max-width: 740px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 18px; }
  .tool-main { margin-top: 24px; }
}
