:root {
  --primary: #5b8def;
  --primary-2: #41d1c9;
  --accent: #ff7a9c;
  --accent-2: #ffb85c;
  --red: #f25f6c;
  --blue: #4d92ff;
  --text-main: #2c3a52;
  --text-sub: #5f7196;
  --text-faint: #93a3c2;
  --bg-1: #e3f0ff;
  --bg-2: #f0f8f3;
  --bg-3: #f4efff;
  --card: rgb(255 255 255 / 66%);
  --line: rgb(255 255 255 / 75%);
  --shadow: 0 24px 70px rgb(69 95 145 / 13%);
  --radius: 24px;
  font-family: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: var(--bg-1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: linear-gradient(145deg, var(--bg-1), var(--bg-2) 52%, var(--bg-3)); }
body { position: relative; min-height: 100dvh; margin: 0; overflow-x: hidden; background: linear-gradient(145deg, rgb(227 240 255 / 80%), rgb(240 248 243 / 72%) 52%, rgb(244 239 255 / 82%)); }
body::before { position: fixed; inset: 0; z-index: -3; pointer-events: none; content: ""; background: linear-gradient(135deg, rgb(255 255 255 / 30%), transparent 42%); }
a { color: inherit; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
.ambient { position: fixed; z-index: -2; width: 280px; height: 280px; border-radius: 50%; pointer-events: none; filter: blur(34px); opacity: .52; animation: drift 15s ease-in-out infinite alternate; }
.ambient-one { top: -90px; left: -100px; background: rgb(91 141 239 / 36%); }
.ambient-two { right: -120px; bottom: 8%; background: rgb(255 122 156 / 25%); animation-delay: -4s; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; width: min(440px, 100%); min-height: 62px; margin: 0 auto; padding: 0 20px; border-bottom: 1px solid rgb(255 255 255 / 58%); background: rgb(255 255 255 / 33%); backdrop-filter: blur(18px); }
.topbar-brand { color: var(--text-main); font-size: 19px; font-weight: 800; letter-spacing: -.06em; text-decoration: none; }
.account-nav { display: flex; align-items: center; gap: 12px; color: var(--text-sub); font-size: 12px; }
.account-nav a { text-decoration: none; }
.login-link { color: var(--primary); font-weight: 800; }
.quiet-button { padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 12px; }
.inline-form { display: inline; }
.app-shell { width: min(440px, calc(100% - 24px)); margin: 0 auto; padding: 30px 0 calc(96px + env(safe-area-inset-bottom)); }
.narrow-shell { padding-top: 58px; }
.hero { padding: 22px 12px 25px; text-align: center; }
.eyebrow, .card-kicker { margin: 0 0 9px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.hero h1 { margin: 0; color: var(--text-main); font-size: clamp(34px, 10vw, 46px); font-weight: 850; letter-spacing: -.08em; line-height: 1.05; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero-copy { margin: 14px auto 0; max-width: 330px; color: var(--text-sub); font-size: 13px; line-height: 1.75; }
.lottery-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 15px; padding: 5px; border: 1px solid rgb(255 255 255 / 75%); border-radius: 18px; background: rgb(255 255 255 / 36%); box-shadow: 0 8px 24px rgb(69 95 145 / 7%); }
.lottery-tab { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; border-radius: 13px; color: var(--text-sub); font-size: 12px; font-weight: 700; text-decoration: none; transition: background .2s ease, color .2s ease, transform .2s ease; }
.lottery-tab.selected { color: var(--text-main); background: rgb(255 255 255 / 85%); box-shadow: 0 5px 15px rgb(69 95 145 / 9%); }
.lottery-tab:hover { transform: translateY(-1px); }
.lottery-dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-kl8 { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.dot-ssq { background: linear-gradient(135deg, var(--red), var(--accent)); }
.dot-dlt { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.guess-card, .form-card, .analysis-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.guess-card { position: relative; padding: 22px 18px 19px; overflow: hidden; }
.guess-card::after { position: absolute; right: -60px; top: -80px; width: 160px; height: 160px; border-radius: 50%; content: ""; background: radial-gradient(circle, rgb(255 184 92 / 33%), transparent 70%); }
.guess-card-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.guess-card h2 { margin: 0; color: var(--text-main); font-size: 25px; letter-spacing: -.06em; }
.rule-copy { margin: 7px 0 0; color: var(--text-sub); font-size: 11px; line-height: 1.6; }
.small-select, .version-select, .analysis-toolbar label { display: grid; gap: 5px; color: var(--text-faint); font-size: 10px; font-weight: 800; white-space: nowrap; }
.small-select select, .version-select select, .analysis-toolbar select { min-height: 32px; padding: 0 8px; border: 1px solid rgb(255 255 255 / 90%); border-radius: 10px; outline: 0; color: var(--text-main); background: rgb(255 255 255 / 74%); font-size: 12px; font-weight: 700; }
.version-select { position: relative; z-index: 1; width: 100%; margin-top: 16px; }
.version-select select { width: 100%; }
.selection-stage { position: relative; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; min-height: 148px; margin: 18px 0 15px; padding: 20px 12px; border: 1px solid rgb(255 255 255 / 75%); border-radius: 20px; background: linear-gradient(135deg, rgb(227 240 255 / 62%), rgb(255 255 255 / 43%)); }
.stage-placeholder, .loading-state, .empty-state { margin: 0; color: var(--text-faint); font-size: 12px; line-height: 1.6; text-align: center; }
.number-ball { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: white; font: 800 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; box-shadow: 0 8px 16px rgb(91 141 239 / 18%), inset 0 1px rgb(255 255 255 / 58%); animation: pop .45s cubic-bezier(.2, .75, .25, 1) both; }
.ball-kl8 { background: linear-gradient(145deg, var(--accent-2), var(--accent)); }
.ball-red { background: linear-gradient(145deg, #ff9a9a, var(--red)); }
.ball-blue { background: linear-gradient(145deg, #85caff, var(--blue)); }
.ball-front { background: linear-gradient(145deg, #87caff, var(--primary)); }
.ball-back { background: linear-gradient(145deg, #75dfd1, var(--primary-2)); }
.selection-group { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 7px; width: 100%; }
.group-label { width: 100%; color: var(--text-faint); font-size: 10px; font-weight: 800; }
.guess-form { position: relative; z-index: 1; }
.guess-button { display: grid; place-items: center; width: 100%; min-height: 49px; padding: 0 18px; border: 0; border-radius: 17px; color: white; background: linear-gradient(110deg, var(--primary), var(--primary-2)); box-shadow: 0 12px 24px rgb(91 141 239 / 23%); cursor: pointer; font-size: 15px; font-weight: 850; text-decoration: none; transition: transform .2s ease, filter .2s ease; }
.guess-button:hover { filter: saturate(1.08) brightness(1.03); transform: translateY(-2px); }
.guess-button:disabled { cursor: wait; opacity: .65; transform: none; }
.guess-button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, .quiet-button:focus-visible { outline: 3px solid rgb(65 209 201 / 45%); outline-offset: 3px; }
.error-message { min-height: 18px; margin: 10px 0 0; color: #cc4b67; font-size: 12px; line-height: 1.5; text-align: center; }
.history-section { padding: 29px 7px 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.06em; }
.text-link, .secondary-link { color: var(--primary); font-size: 12px; font-weight: 800; text-decoration: none; }
.history-list { display: grid; gap: 9px; margin-top: 14px; }
.history-card { padding: 14px; border: 1px solid rgb(255 255 255 / 72%); border-radius: 17px; background: rgb(255 255 255 / 42%); }
.history-meta, .member-row > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-sub); font-size: 10px; }
.history-meta strong { color: var(--text-main); font-size: 11px; }
.history-meta time, .member-row time { color: var(--text-faint); }
.history-balls { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.history-balls span { display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 5px; border-radius: 9px; color: white; font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.balls-kl8 span { background: linear-gradient(145deg, var(--accent-2), var(--accent)); }
.balls-red span { background: var(--red); }
.balls-blue span { background: var(--blue); }
.balls-front span { background: var(--primary); }
.balls-back span { background: var(--primary-2); }
.history-groups { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.history-groups .history-balls { margin-top: 0; }
.history-label { margin-right: 1px; color: var(--text-faint); font-size: 10px; font-weight: 800; }
.target-date { margin: 10px 0 0; color: var(--text-faint); font-size: 10px; }
.form-card { padding: 27px 21px; }
.form-card h1 { margin: 0 0 22px; font-size: 32px; letter-spacing: -.08em; }
.account-form { display: grid; gap: 14px; }
.account-form label { display: grid; gap: 7px; color: var(--text-sub); font-size: 12px; font-weight: 800; }
.account-form input { min-height: 45px; padding: 0 12px; border: 1px solid rgb(255 255 255 / 90%); border-radius: 12px; outline: 0; color: var(--text-main); background: rgb(255 255 255 / 68%); }
.form-hint, .form-switch { color: var(--text-sub); font-size: 12px; line-height: 1.65; }
.form-switch { margin: 17px 0 0; text-align: center; }
.form-switch a { color: var(--primary); font-weight: 800; }
.form-error { margin: 0 0 13px; text-align: left; }
.analysis-shell { padding-top: 24px; }
.analysis-hero { padding-bottom: 17px; }
.analysis-toolbar { display: flex; gap: 9px; margin: 0 0 12px; padding: 0 7px; }
.analysis-toolbar label { flex: 1; }
.analysis-toolbar select { width: 100%; }
.analysis-card { min-height: 210px; padding: 17px; }
.metric-strip { display: flex; gap: 27px; padding: 4px 0 17px; border-bottom: 1px solid rgb(255 255 255 / 75%); }
.metric { display: grid; gap: 3px; }
.metric b { color: var(--primary); font-size: 25px; letter-spacing: -.05em; }
.metric span { color: var(--text-faint); font-size: 10px; }
.analysis-card details { border-bottom: 1px solid rgb(255 255 255 / 65%); padding: 14px 0; }
.analysis-card summary { cursor: pointer; color: var(--text-main); font-size: 12px; font-weight: 800; }
.pool-list, .plan-list { display: grid; gap: 6px; margin-top: 11px; }
.pool-line, .plan-line { display: grid; grid-template-columns: 95px 1fr; gap: 7px; color: var(--text-sub); font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.pool-line strong, .plan-line strong { color: var(--text-main); font-family: inherit; }
.backtest-json { max-height: 260px; margin: 10px 0 0; overflow: auto; color: var(--text-sub); font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.member-hero { padding: 8px 7px 21px; }
.member-hero h1 { margin: 0; font-size: 33px; letter-spacing: -.08em; }
.button-link { margin-bottom: 10px; }
.secondary-link { display: block; padding: 8px; text-align: center; }
.member-records { padding: 27px 7px 0; }
.member-row { display: grid; gap: 8px; padding: 13px 0; border-bottom: 1px solid rgb(255 255 255 / 70%); }
.member-row > span { color: var(--primary); font: 700 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tabbar { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-around; width: min(440px, 100%); min-height: 67px; margin: 0 auto; padding: 9px 26px calc(9px + env(safe-area-inset-bottom)); border: 1px solid rgb(255 255 255 / 72%); border-bottom: 0; border-radius: 22px 22px 0 0; background: rgb(255 255 255 / 60%); box-shadow: 0 -12px 28px rgb(69 95 145 / 10%); backdrop-filter: blur(20px); }
.tab { display: grid; justify-items: center; gap: 3px; min-width: 58px; color: var(--text-faint); font-size: 10px; font-weight: 700; text-decoration: none; }
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.tab.active { color: var(--primary); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.65); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes drift { from { transform: translate3d(-10px, 0, 0) scale(1); } to { transform: translate3d(30px, 22px, 1px) scale(1.12); } }
@media (min-width: 700px) { body { padding-bottom: 0; } .topbar { margin-top: 12px; border-radius: 22px; } .tabbar { bottom: 14px; border-bottom: 1px solid rgb(255 255 255 / 72%); border-radius: 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
