/* 全局主题和主页样式；最后的媒体查询负责 iPhone/窄屏布局。 */
:root { --ink: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7; --accent: #0071e3; --soft: #f5f5f7; --iphone-bg: #f2f4f7; --iphone-card: rgba(255,255,255,.82); --iphone-shadow: 0 16px 40px rgba(15,23,42,.08); }
* { box-sizing: border-box; }
html { background: linear-gradient(180deg, #eef2f7 0%, #f5f5f7 100%); }
body { margin: 0; padding-bottom: env(safe-area-inset-bottom); overflow-x: hidden; background: linear-gradient(180deg, #edf2f9 0%, #f5f5f7 100%); color: var(--ink); font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; }
.apple-nav { position: sticky; top: 0; z-index: 40; display: block; width: 100%; max-width: 430px; margin: 0 auto; border-bottom: 1px solid rgba(148, 163, 184, 0.18); background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.apple-nav-inner { position: relative; display: flex; align-items: center; justify-content: flex-end; width: calc(100% - 20px); height: 48px; margin: 0 auto; }
.apple-menu-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 38px; height: 38px; border: 0; background: transparent; padding: 0; cursor: pointer; }
.apple-menu-button span { display: block; width: 20px; height: 2px; border-radius: 999px; background: #111827; transition: transform 0.2s ease, opacity 0.2s ease; }
.apple-menu-button[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.apple-menu-button[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.apple-menu-button[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.apple-nav-links { position: absolute; top: 52px; left: 0; right: 0; max-height: 0; overflow: hidden; opacity: 0; pointer-events: none; transform: translateY(-6px); transition: max-height 0.22s ease, opacity 0.18s ease, transform 0.22s ease; }
.apple-nav-links.is-open { max-height: 420px; opacity: 1; pointer-events: auto; transform: translateY(0); }
.apple-nav-list { display: grid; gap: 8px; padding: 8px; border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 18px; background: rgba(255,255,255,0.96); box-shadow: 0 18px 40px rgba(15,23,42,0.12); }
.apple-nav-list .nav-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: #f8fafc; color: #475569; text-align: left; font-size: 14px; font-weight: 600; }
.apple-nav-list .nav-link.active, .apple-nav-list .nav-link:hover { background: #eef4ff; color: var(--accent); }
.apple-nav-list .nav-link .material-icons { font-size: 18px; }
@keyframes apple-menu-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.startup-auth-gate { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: #121212; }
.startup-auth-gate.authenticated { display: none; }
.startup-auth-card { width: min(400px, 100%); padding: 40px; border-radius: 16px; background: #1e1e1e; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); text-align: center; }
.startup-auth-card h1 { margin: 0 0 8px; color: #ffd700; font-size: 24px; }
.startup-auth-card p { margin: 0 0 30px; color: #888; font-size: 14px; }
.startup-auth-card input { width: 100%; padding: 15px; border: 1.5px solid #ffd700; border-radius: 12px; outline: none; background: transparent; color: #fff; font-size: 16px; }
.startup-auth-card input:focus { border-width: 2px; box-shadow: 0 0 8px rgba(255, 215, 0, .3); }
.startup-auth-card input::placeholder { color: #888; }
.startup-kami-buy { display: inline-block; margin-top: 12px; color: #ffd700; font-size: 13px; text-decoration: underline; }
.startup-kami-buy:hover { color: #fff; }
.startup-auth-card button { width: 100%; height: 50px; margin-top: 25px; border: 0; border-radius: 12px; background: #ffd700; color: #121212; font-size: 17px; font-weight: 700; cursor: pointer; }
.startup-auth-card button:disabled { opacity: .6; cursor: wait; }
.startup-auth-status { min-height: 20px; margin-top: 12px; color: #ff6b6b; font-size: 12px; }
.app-shell { max-width: 1180px; margin: 0 auto; padding: 8px 8px 18px !important; }
.home-intro { display: flex; align-items: flex-end; justify-content: space-between; min-height: 224px; padding: 58px 8px 42px; }
.home-kicker { margin: 0 0 14px; color: #86868b; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.home-intro h1 { margin: 0; color: #1d1d1f; font-size: clamp(38px, 5vw, 62px); font-weight: 700; letter-spacing: -2.5px; line-height: 1.05; }
.home-intro h1 span { color: #6e6e73; }
.home-description { margin: 18px 0 0; color: #6e6e73; font-size: 15px; }
.home-intro-meta { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; color: #6e6e73; font-size: 12px; }
.home-intro-meta strong { margin-left: 5px; color: #1d1d1f; font-weight: 600; }
.intro-dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 4px rgba(52,199,89,.14); }
/* 中间选号区：调整号码列之间的间距 */
.number-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px 4px; }
.number-column { display: grid; align-content: start; justify-items: center; gap: 3px; }
/* 中间选号区：稍微放大号码球，保持 iPhone 紧凑风格 */
.number-chip { width: 32px; height: 32px; justify-self: center; border: 1px solid var(--line); background: #fff; border-radius: 50%; font-size: 12px; font-weight: 800; color: #3b4658; transition: .15s ease; }
.killed-number-icon { display: block; width: 22px; height: 22px; margin: auto; object-fit: contain; }
.killed-number-icon { width: 23px; height: 23px; object-fit: contain; vertical-align: middle; }
.number-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.number-chip.selected { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 5px 12px rgba(39,100,231,.2); }
.number-chip.color-red { background: #fff0f1; border-color: #f3a2a9; color: #c93645; }
.number-chip.color-blue { background: #eef4ff; border-color: #9db9f8; color: #245bd2; }
.number-chip.color-green { background: #effaf3; border-color: #9bd5ae; color: #21834a; }
.number-chip.color-red.selected { background: #d9364a; border-color: #d9364a; color: #fff; box-shadow: 0 5px 12px rgba(217,54,74,.22); }
.number-chip.color-blue.selected { background: #2764e7; border-color: #2764e7; color: #fff; box-shadow: 0 5px 12px rgba(39,100,231,.22); }
.number-chip.color-green.selected { background: #2b9a59; border-color: #2b9a59; color: #fff; box-shadow: 0 5px 12px rgba(43,154,89,.22); }
.filter-chip { border: 1px solid var(--line); color: #424245; background: #fff; border-radius: 980px; padding: 7px 12px; white-space: nowrap; font-size: 13px; transition: .2s ease; }
.filter-chip.active, .filter-chip:hover { color: #fff !important; border-color: #1d4ed8 !important; background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%) !important; box-shadow: 0 8px 18px rgba(29,78,216,.22) !important; }
.result-ball { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: #eef4ff; color: #245bd2; font-weight: 700; }
/* 开奖区：调整开奖框高度和内边距 */
.latest-draw-box { width: 100%; flex-shrink: 0; border: 1px solid #e5eaf2; border-radius: 10px; background: #f8fafc; padding: 8px 10px; margin-top: auto !important; margin-bottom: 4px; }
.latest-draw-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: #667085; }
.latest-draw-heading h3 { color: var(--ink); font-size: 13px; font-weight: 700; }
.latest-draw-heading span { color: #8b95a5; font-size: 10px; white-space: nowrap; }
.latest-draw-list { display: flex; flex-wrap: wrap; gap: 7px; }
.latest-draw-item { display: grid; min-width: 32px; justify-items: center; text-align: center; }
.latest-draw-list .result-ball { width: 32px; height: 32px; font-size: 12px; }
.latest-draw-list .result-ball.history-color-red { background: #d9364a; border: 1px solid #d9364a; color: #fff; }
.latest-draw-list .result-ball.history-color-blue { background: #2764e7; border: 1px solid #2764e7; color: #fff; }
.latest-draw-list .result-ball.history-color-green { background: #2b9a59; border: 1px solid #2b9a59; color: #fff; }
.latest-draw-list small { display: block; margin-top: 2px; color: #8b95a5; font-size: 10px; white-space: nowrap; }
.three-panel-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr) 320px; gap: 12px; align-items: stretch; }
.panel-card { background: var(--iphone-card); border: 1px solid rgba(15,23,42,.05); border-radius: 22px; padding: 12px; box-shadow: var(--iphone-shadow); }
#page-home .three-panel-layout > aside:first-child { display: none !important; }
.three-panel-layout > section { display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
.panel-heading .material-icons { color: var(--accent); font-size: 19px; }
/* 调整记录：顶部计数行和按钮更贴。最终值：selection-toolbar gap 4px / margin-bottom 0 / button padding 4px 7px */
.section-label { color: #667085; font-size: 13px; font-weight: 700; margin: 0; }
/* 调整记录：剩 49 码与生肖更近。最终值：section-label margin 0 / zodiac-grid gap 0 / padding 0 */
.zodiac-grid { display: flex; flex-wrap: nowrap; gap: 0; overflow: visible; padding: 0; margin-top: 2px; }
/* 12生肖按键：字体大小、粗细和颜色在这里修改 */
.zodiac-grid .filter-chip { flex: 1 1 0; min-width: 18px; padding: 5px 0; border-color: #d2d2d7; color: #424245; background: #f5f5f7; text-align: center; font-size: clamp(9px, 2vw, 15px); font-weight: 700; line-height: 1; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: visible; letter-spacing: -0.02em; }
.zodiac-grid .filter-chip:nth-child(1), .zodiac-grid .filter-chip:nth-child(7), .zodiac-grid .filter-chip:nth-child(11) { color: #b42332; border-color: #f3b0b6; background: #fff0f1; }
.zodiac-grid .filter-chip:nth-child(2), .zodiac-grid .filter-chip:nth-child(5), .zodiac-grid .filter-chip:nth-child(9) { color: #245bd2; border-color: #a9c1f5; background: #eef4ff; }
.zodiac-grid .filter-chip:nth-child(3), .zodiac-grid .filter-chip:nth-child(6), .zodiac-grid .filter-chip:nth-child(12) { color: #21834a; border-color: #a8dcb8; background: #effaf3; }
.zodiac-grid .filter-chip:nth-child(4), .zodiac-grid .filter-chip:nth-child(8), .zodiac-grid .filter-chip:nth-child(10) { color: #8a4b08; border-color: #f1c98b; background: #fff7e6; }
.zodiac-grid .filter-chip:hover, .zodiac-grid .filter-chip.active { color: #1d4ed8 !important; border-color: #7aa7f2 !important; background: #dbeafe !important; }
/* 调整记录：生肖栏与号码区边框几乎贴合。最终值：number-selection-box margin-top 0 / padding 6px 4px 7px */
.number-selection-box { position: relative; border: 1px solid #e5e5ea; border-radius: 12px; padding: 6px 4px 7px; margin-top: 0 !important; background: #fafafa; }
.number-selection-header {
    position: absolute;
    right: 10px;
    bottom: 8px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.04em;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.side-filter-list { display: grid; gap: 8px; }
.function-filter-list { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px 4px; }
.side-filter-list .filter-chip, .function-filter-list .filter-chip { text-align: left; }
/* 功能区按钮：按功能分组配色，便于快速识别 */
.function-filter-list .filter-chip { min-width: 0; height: 30px; padding: 0 1px; border-radius: 7px; text-align: center; font-size: 12px; font-weight: 900; line-height: 1; white-space: nowrap; overflow: hidden; }
.function-filter-list .filter-chip:nth-child(1) { color: #536174; background: #f1f4f8; border-color: #d8dee8; }
.function-filter-list .filter-chip:nth-child(2), .function-filter-list .filter-chip:nth-child(8), .function-filter-list .filter-chip:nth-child(9) { color: #b42332; background: #fff0f1; border-color: #f3b0b6; }
.function-filter-list .filter-chip:nth-child(3) { color: #245bd2; background: #eef4ff; border-color: #a9c1f5; }
.function-filter-list .filter-chip:nth-child(4) { color: #21834a; background: #effaf3; border-color: #a8dcb8; }
.function-filter-list .filter-chip:nth-child(5), .function-filter-list .filter-chip:nth-child(6), .function-filter-list .filter-chip:nth-child(7) { color: #8a4b08; background: #fff7e6; border-color: #f1c98b; }
.function-filter-list .filter-chip:nth-child(n+15):nth-child(-n+28) { color: #096b78; background: #eaf8fa; border-color: #9ed9df; }
.function-filter-list .filter-chip:nth-child(n+29):nth-child(-n+68) { color: #7a4b00; background: #fff8dc; border-color: #ead58a; }
.function-filter-list .filter-chip:nth-child(n+69):nth-child(-n+82) { color: #355b8c; background: #edf3fa; border-color: #b7c9df; }
.function-filter-list .filter-chip:nth-child(n+83):nth-child(-n+86) { color: #9b3d35; background: #fff0ed; border-color: #e8b3aa; }
.function-filter-list .filter-chip:nth-child(n+87) { color: #fff; background: #64748b; border-color: #64748b; }
.function-filter-list .filter-chip.active, .function-filter-list .filter-chip:hover { color: #fff !important; background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important; border-color: #1d4ed8 !important; box-shadow: 0 8px 18px rgba(29,78,216,.22) !important; transform: translateY(-1px); }
/* 调整记录：下面输入框与功能区边框贴近。最终值：number-note margin-top 2px / padding 8px */
.number-note { border: 1px solid #e5e5ea; border-radius: 12px; background: #fafafa; padding: 8px; margin-top: 2px !important; }
.number-note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.number-note input { width: 100%; margin-top: 4px; padding: 7px 8px; border: 1px solid #dfe5ee; border-radius: 7px; outline: none; font-size: 13px; }
.number-note input:focus { border-color: #9db9f8; box-shadow: 0 0 0 2px #eef4ff; }
/* 杀号/出号输入框：84px 约可显示三行文字 */
.number-note textarea { width: 100%; min-height: 84px; margin-top: 3px; padding: 8px 8px; border: 1px solid #dfe5ee; border-radius: 7px; outline: none; resize: vertical; font-size: 12px; line-height: 1.5; }
.number-note textarea:focus { border-color: #9db9f8; box-shadow: 0 0 0 2px #eef4ff; }
.note-result { margin-top: 9px; color: #7d8798; font-size: 13px; min-height: 17px; }
.stats-shell { background: #20242c; color: #fff; border-radius: 10px; overflow: hidden; }
#page-statistics { width: 100%; max-width: 430px; margin: 0 auto; }
.stats-toolbar { padding: 14px; background: #292e37; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.stats-toolbar input, .stats-toolbar textarea { width: 100%; border: 1px solid #454c58; border-radius: 6px; background: #373e49; color: #fff; outline: none; padding: 9px 10px; font-size: 13px; }
.stats-toolbar input:focus, .stats-toolbar textarea:focus { border-color: #5c8ff2; }
.stats-toolbar textarea { height: 84px; margin-top: 9px; resize: vertical; line-height: 1.5; }
.stats-actions { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; grid-template-rows: repeat(2, auto) !important; gap: 6px; margin-top: 9px; }
.stats-actions button { border: 0; border-radius: 6px; color: #fff; padding: 7px 3px; font-weight: 700; cursor: pointer; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.stats-name-input { min-width: 0; width: 100%; border: 1px solid #7c3aed; border-radius: 6px; background: #373e49; color: #fff; padding: 9px 8px; outline: none; font-weight: 700; }
.stats-back { background: #475569; }
.stats-name-input::placeholder { color: #c4b5fd; }
.stats-name-input:focus { border-color: #a78bfa; }
.stats-name { background: #7c3aed; }
.stats-copy, .stats-danger { padding: 8px 12px; font-size: 12px; min-width: 0; }
.stats-copy { background: #2563eb; }
.stats-backup { background: #64748b; }
.stats-primary { background: #2563eb; }
.stats-mode { background: #0891b2; }
.stats-danger { background: #dc2626; }
/* 这块是合计显示样式：后期可以继续调字体、间距、颜色 */
#totalSummaryButton {
    text-align: left;
    padding-left: 10px;
    min-width: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: flex-start;
}
.stats-summary { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 13px; }
.stats-summary strong { color: #4ade80; }
.stats-summary button { border: 0; background: transparent; color: #60a5fa; cursor: pointer; }
.stats-zodiac-panel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 5px; }
.stats-zodiac-column { min-width: 0; background: #292e37; border-radius: 5px; overflow: hidden; }
.stats-zodiac-title { background: #3b414c; color: #fde047; text-align: center; padding: 5px 0; font-weight: 800; }
.stats-zodiac-total { background: #222730; color: #fb7185; text-align: center; padding: 3px 0; font-size: 12px; }
.stats-number-row { display: flex; justify-content: space-between; padding: 6px 7px; border-bottom: 1px solid #414752; cursor: pointer; }
.stats-number-row:hover { background: #3b414c; }
.stats-number-value { color: #4ade80; font-size: 11px; }
@media (max-width: 640px) { .stats-zodiac-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    #page-statistics { padding: 0; }
    .stats-shell { border-radius: 14px; }
    .stats-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, auto); gap: 6px; }
    .stats-actions button { min-height: 38px; padding: 7px 4px; font-size: 12px; }
}
/* 调整记录：顶部计数行和按钮更贴。最终值：gap 4px / margin-bottom 0 / filter-chip padding 4px 7px */
.selection-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 0;
    width: 100%;
}
.selection-toolbar > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}
.selection-toolbar > div:last-child,
.selection-toolbar .flex {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-left: auto;
    flex-wrap: nowrap;
    text-align: right;
}
.selection-toolbar .filter-chip {
    flex-shrink: 0;
    margin-left: 0;
    padding: 4px 7px;
}
.selection-toolbar h2 {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin: 0;
    line-height: 1;
    white-space: nowrap;
    margin-bottom: 2px;
}

#page-home .selection-toolbar h2 {
    margin-bottom: 0;
}

#page-home .section-label {
    margin-top: 2px;
}
.nav-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; color: #687386; text-align: left; font-size: 14px; }
.nav-link .material-icons { font-size: 19px; }
.nav-link:hover, .nav-link.active { color: var(--accent); background: #eef4ff; }
.history-page { min-height: calc(100vh - 56px); padding: 8px; color: #fff; background: #171a20; }
.history-back-button { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 8px; padding: 6px 0; border: 0; color: #9da5b1; background: transparent; cursor: pointer; font-size: 13px; }
.history-back-button:hover { color: #f2c94c; }
.history-back-button .material-icons { font-size: 18px; }
.history-search-bar { display: flex; gap: 8px; margin: 8px 0; }
.history-search-bar input { min-width: 0; padding: 9px 10px; border: 1px solid #3c434e; border-radius: 7px; outline: none; color: #fff; background: #252a32; font-size: 13px; }
.history-period-search { flex: 1; }
.history-search-button, .history-date-button { border: 0; border-radius: 7px; color: #171a20; background: #f2c94c; cursor: pointer; font-size: 13px; }
.history-search-button { padding: 9px 16px; }
.history-date-button { display: inline-flex; align-items: center; justify-content: center; width: 42px; }
.history-date-button .material-icons { font-size: 20px; }
.history-date-search { position: absolute; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; }
.history-today, .history-record { padding: 14px; border: 1px solid #303640; border-radius: 12px; background: #252a32; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.history-today { text-align: center; }
.history-today-title, .history-record h3 { margin: 0; color: #f2c94c; font-size: 16px; font-weight: 800; }
.history-today-balls, .history-record-balls { display: flex; flex-wrap: nowrap; justify-content: center; gap: 12px; margin-top: 14px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.history-ball-item { flex: 0 0 auto; min-width: 42px; text-align: center; }
.history-ball-item small { display: block; margin-top: 4px; color: #9da5b1; font-size: 11px; white-space: nowrap; }
.history-special { background: #f2c94c; color: #171a20; }
.history-page .result-ball.history-color-red { background: #d9364a; border: 1px solid #d9364a; color: #fff; }
.history-page .result-ball.history-color-blue { background: #2764e7; border: 1px solid #2764e7; color: #fff; }
.history-page .result-ball.history-color-green { background: #2b9a59; border: 1px solid #2b9a59; color: #fff; }
.history-list { display: grid; gap: 12px; max-height: calc(100vh - 250px); margin-top: 14px; padding-right: 4px; overflow-y: auto; overscroll-behavior: contain; }
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { border-radius: 6px; background: #596273; }
.history-record h3 small { margin-left: 8px; color: #9da5b1; font-size: 11px; font-weight: 400; }
.history-empty { color: #9da5b1; font-size: 13px; }
.history-loading { padding: 14px; color: #f2c94c; text-align: center; }
.history-loading .material-icons { animation: history-spin 1s linear infinite; }
@keyframes history-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .history-search-bar { flex-wrap: wrap; } .history-period-search { flex-basis: 100%; } .history-search-button, .history-date-search { flex: 1; } }
.account-status { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: #687386; font-size: 12px; }
.account-status .status-value { display: block; margin-top: 4px; color: var(--accent); font-size: 13px; font-weight: 700; }
.account-status .status-date { display: block; margin-top: 3px; color: #9aa3b2; font-size: 11px; }
.logout-button { display: flex; align-items: center; gap: 7px; width: 100%; margin-top: 13px; padding: 9px 10px; border-radius: 7px; color: #d24b58; background: #fff4f4; font-size: 13px; }
.logout-button:hover { background: #ffe8e8; }
.logout-button .material-icons { font-size: 17px; }
.kami-input { width: 100%; margin-top: 10px; padding: 8px 9px; border: 1px solid #dfe5ee; border-radius: 7px; outline: none; font-size: 12px; }
.kami-input:focus { border-color: #9db9f8; }
.kami-login-button { width: 100%; margin-top: 7px; padding: 8px; border: 0; border-radius: 7px; background: #2764e7; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.kami-login-button:disabled { opacity: .6; cursor: wait; }
.auth-status { display: block; margin-top: 7px; font-size: 11px; line-height: 1.4; }
.auth-status.success { color: #21834a; }
.auth-status.error { color: #d24b58; }
.forum-shell { position: relative; max-width: 900px; margin: 0 auto; min-height: 0; height: auto; max-height: none; padding: 8px 16px 20px; background: #fff; border: 1px solid #edf0f5; border-radius: 12px; box-shadow: 0 3px 14px rgba(33,46,72,.04); overflow: visible; }
.forum-page-title { position: static; margin: 0; color: var(--ink); font-size: 18px; font-weight: 800; letter-spacing: .02em; line-height: 1.2; }
.forum-header { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin: 8px 0 12px; }
.forum-header-copy { display: none; }
.forum-eyebrow { display: none; }
.forum-refresh-button, .forum-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 7px; padding: 9px 13px; cursor: pointer; font-size: 12px; font-weight: 700; }
.forum-refresh-button { color: var(--accent); background: #eef4ff; align-self: flex-start; }
.forum-refresh-button .material-icons, .forum-actions .material-icons { font-size: 16px; }
.forum-layout { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.forum-posts-section, .forum-auth-card { width: 100%; background: #fff; border: 1px solid #e6ebf2; border-radius: 10px; padding: 12px; box-sizing: border-box; }
.forum-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.forum-section-heading h3, .forum-auth-card h3 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 800; }
.forum-section-heading span { color: #9aa3b2; font-size: 11px; }
.forum-display { min-height: 200px; max-height: 260px; overflow-y: auto; padding-top: 4px; }
.post-item { padding: 14px 2px; border-bottom: 1px solid #edf0f5; }

@media (max-width: 640px) {
    .forum-shell { height: auto; max-height: none; padding: 12px; }
    .forum-header { margin: 6px 0 10px; }
    .forum-page-title { font-size: 18px; }
    .forum-display {
        min-height: 170px;
        max-height: 220px;
    }
    .forum-posts-section, .forum-auth-card { padding: 12px; }
    .forum-auth-card { position: static; }
    .forum-layout { gap: 12px; }
    .forum-content-input { min-height: 90px; }
    .forum-back-button { margin-top: 16px; }
}

@media (max-width: 420px) {
    .forum-display {
        min-height: 160px;
        max-height: clamp(160px, 28vh, 220px);
    }
    .forum-section-heading { padding-bottom: 10px; }
    .forum-header h2 { font-size: 18px; }
    .forum-actions { gap: 6px; }
}

.post-item { padding: 14px 2px; border-bottom: 1px solid #edf0f5; }
.post-item:last-child { border-bottom: 0; }
.post-title { color: var(--accent); font-size: 14px; font-weight: 800; }
.post-content { margin-top: 7px; color: #596579; font-size: 13px; line-height: 1.7; word-break: break-word; }
.forum-empty { padding: 48px 10px; color: #9aa3b2; text-align: center; font-size: 13px; }
.forum-auth-card { position: sticky; top: 16px; }
.forum-auth-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.forum-auth-card h3 { margin: 0; }
.forum-input { width: 100%; margin-top: 7px; padding: 9px 10px; border: 1px solid #dfe5ee; border-radius: 7px; outline: none; color: var(--ink); background: #fbfcfe; font-size: 12px; box-sizing: border-box; }
.forum-input:focus { border-color: #9db9f8; box-shadow: 0 0 0 2px #eef4ff; }
.forum-content-input { min-height: 100px; resize: vertical; line-height: 1.5; }
.forum-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.forum-secondary-button { color: #536174; background: #eef1f5; }
.forum-primary-button { color: #fff; background: var(--accent); }
.forum-back-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 100%; margin-top: 16px; padding: 8px 12px; border: 1px solid #dfe5ee; border-radius: 7px; color: #536174; background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; }
.forum-back-button:hover { color: var(--accent); border-color: #9db9f8; background: #eef4ff; }
.forum-back-button .material-icons { font-size: 16px; }
.version-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px 18px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 24px;
  background: rgba(255,255,255,0.9);
  box-shadow: var(--iphone-shadow);
}
.version-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
}
.version-panel p {
  margin: 0;
  color: #6e6e73;
  line-height: 1.7;
}
.version-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(241,245,249,0.9), rgba(255,255,255,0.9));
  color: #475569;
}
.version-user-info span,
.version-user-info strong,
.version-user-info .status-date {
  display: block;
}
.version-user-info span:first-child {
  color: #6b7280;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.version-user-info strong {
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}
.version-user-info .status-date {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}
.version-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: #f5f5f7;
  font-weight: 700;
  cursor: pointer;
}
.version-back-button:hover {
  background: #eef4ff;
  color: var(--accent);
}
.version-back-button .material-icons {
  font-size: 18px;
}
.post-content time { color: #9aa3b2; font-size: 11px; font-weight: 400; }
.analysis-page { min-height: 100vh; min-height: 100dvh; overflow: hidden; background: #f4f6fa; padding: 8px 10px 16px; }
.analysis-shell { width: min(900px, 100%); margin: 0 auto; }
.analysis-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.analysis-header p, .eyebrow { color: #8b95a5; font-size: 12px; margin: 0; }
.analysis-header h1, .analysis-card h2 { color: var(--ink); font-size: 18px; font-weight: 800; margin: 2px 0 0; }
.analysis-forum-link { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 700; text-decoration: none; }
.analysis-forum-link .material-icons { font-size: 17px; }
.analysis-forum-embed { display: flex; flex-direction: column; margin-top: 0; overflow: hidden; }
.analysis-forum-embed iframe { display: block; width: 100%; height: 620px; border: 0; border-radius: 8px; overflow-y: auto; overflow-x: hidden; }
.analysis-number-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.analysis-refresh-button { border: 1px solid #d2d2d7; border-radius: 8px; padding: 7px 12px; color: #1d1d1f; background: #fff; cursor: pointer; font-size: 12px; }
.analysis-refresh-button:disabled { opacity: .55; cursor: wait; }
.analysis-number-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.analysis-number-chip { display: grid; place-items: center; min-height: 38px; border: 1px solid #b9d4f7; border-radius: 10px; color: #1554a6; background: #eef5ff; font-size: 15px; font-weight: 800; }
.analysis-number-status { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.analysis-backtest-list { display: grid; gap: 6px; }
.analysis-backtest-row { display: grid; grid-template-columns: 86px minmax(0, 1fr) 54px; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid #edf0f5; color: #475569; font-size: 12px; }
.analysis-backtest-row strong { color: #1d1d1f; }
.analysis-backtest-row span { overflow-wrap: anywhere; }
.analysis-backtest-row em { color: #1554a6; font-style: normal; font-weight: 800; text-align: right; }
.analysis-backtest-row .analysis-hit { color: #16a34a; }
.analysis-backtest-row .analysis-miss { color: #dc2626; }
.analysis-back { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: 13px; }
.analysis-back .material-icons, .analysis-refresh .material-icons { font-size: 17px; }
.analysis-period { color: #8b95a5; font-size: 12px; }
.analysis-card { background: #fff; border: 1px solid #edf0f5; border-radius: 12px; padding: 16px; margin-top: 14px; box-shadow: 0 3px 14px rgba(33,46,72,.04); }
.analysis-card-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.analysis-coin-balance { flex-shrink: 0; padding: 5px 9px; border: 1px solid #ead58a; border-radius: 7px; color: #8a6500; background: #fff8dc; font-size: 12px; font-weight: 700; white-space: nowrap; }
.analysis-refresh { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; color: var(--accent); background: #fff; cursor: pointer; }
.analysis-draw { display: flex; flex-wrap: wrap; gap: 18px; }
.analysis-ball-item { display: grid; justify-items: center; gap: 3px; color: #667085; font-size: 12px; }
.analysis-ball-item small { color: #9aa3b2; font-size: 10px; }
.analysis-special { background: #fff2cc; color: #a56a00; }
.analysis-total { color: #2764e7; font-size: 12px; }
.analysis-zodiac-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; }
.analysis-zodiac-item { display: grid; justify-items: center; gap: 5px; padding: 12px 4px; border: 1px solid var(--line); border-radius: 8px; color: #8b95a5; }
.analysis-zodiac-item span { font-size: 18px; font-weight: 800; }
.analysis-zodiac-item.has-hit { border-color: #9db9f8; background: #eef4ff; color: var(--accent); }
@media (max-width: 640px) { .analysis-page { padding: 8px 10px 24px; } .analysis-header { align-items: flex-start; flex-wrap: wrap; } .analysis-header h1 { font-size: 20px; } .analysis-zodiac-grid { grid-template-columns: repeat(6, 1fr); } .analysis-shell { max-width: 430px; } .analysis-card { padding: 10px; margin-top: 8px; border-radius: 14px; } .analysis-card-heading { margin: 0 4px 8px; } .analysis-forum-embed iframe { margin: 0 -2px; width: calc(100% + 4px); } .analysis-number-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .three-panel-layout { grid-template-columns: 175px minmax(0, 1fr) 280px; } }
@media (max-width: 900px) { .three-panel-layout { grid-template-columns: 155px minmax(430px, 1fr); } .three-panel-layout > section { grid-column: 2; grid-row: 1 / span 2; } .three-panel-layout > aside:last-child { grid-column: 1; grid-row: 2; } .function-filter-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .number-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px 1px; } .number-chip { width: 29px; height: 29px; font-size: 10px; } .number-note-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .three-panel-layout { display: flex; flex-direction: column; } .three-panel-layout > section { order: 1; width: 100%; } .three-panel-layout > aside:first-child { order: 2; width: 100%; } .three-panel-layout > aside:last-child { order: 3; width: 100%; } }
@media (min-width: 901px) { html, body { overflow-y: auto; } .app-shell { max-height: none; overflow: visible; padding-bottom: 4px; } }
@media (max-width: 640px) {
    body { background: linear-gradient(180deg, #eff3f8 0%, #f7f7fa 100%); }
    .apple-nav-inner { width: calc(100% - 22px); }
    .apple-nav-caption { display: none; }
    .app-shell { max-width: 430px; padding: 10px 10px 24px !important; }
    .page-content { padding: 0; }
    .panel-card { border-radius: 24px; padding: 14px; box-shadow: 0 10px 28px rgba(15,23,42,.06); }
    .three-panel-layout { display: flex; flex-direction: column; gap: 12px; }
    .three-panel-layout > section, .three-panel-layout > aside { width: 100%; }
    .selection-toolbar { flex-wrap: nowrap; gap: 4px; margin-bottom: 0; }
    .selection-toolbar .flex { width: auto; justify-content: flex-end; gap: 4px; }
    .selection-toolbar h2 { gap: 2px; line-height: 1; }
    .section-label { margin: 0 0 1px; }
    .zodiac-grid { gap: 1px; padding: 0 1px; margin-top: 1px; }
    .number-grid { gap: 6px 4px; }
    .number-chip { width: 28px; height: 28px; }
    .number-selection-box { margin-top: 0 !important; padding: 6px 4px 7px; }
    .latest-draw-box { border-radius: 18px; }
    .forum-shell { padding: 16px; border-radius: 22px; }
    .forum-layout { grid-template-columns: 1fr; }
    .forum-auth-card { position: static; }
}

@media (min-width: 0px) {
    #page-home .three-panel-layout { display: flex; flex-direction: column; gap: 14px; }
    #page-home .three-panel-layout > aside:first-child { display: none; }
    #page-home .three-panel-layout > section { display: contents; }
    #page-home .selection-toolbar { order: 1; }
    #page-home .section-label { order: 2; }
    #page-home .section-label { display: none; }
    #page-home .zodiac-grid { order: 3; }
    #page-home .number-selection-box { order: 4; }
    #page-home .three-panel-layout > aside:last-child { order: 5; }
    #page-home .number-note { order: 6; }
    #page-home .latest-draw-box { display: none; }
    #page-home .three-panel-layout > aside:last-child { width: 100%; }
    #page-home .function-filter-list { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    #page-home .zodiac-grid { margin-top: 4px; }
}
@media (max-width: 640px) { #page-home .function-filter-list { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px 3px; } }
#page-home .three-panel-layout > aside:last-child .panel-heading h2 { display: none; }
#page-home .three-panel-layout > aside:last-child .panel-heading { display: none; }
#page-home .three-panel-layout > aside:last-child { padding-top: 0; }
#page-home .latest-draw-box { display: none !important; }
@media (max-width: 640px) {
    .app-shell { padding-right: 12px !important; padding-left: 12px !important; }
    .apple-nav-inner { width: calc(100% - 24px); }
    #page-home .three-panel-layout { gap: 10px; }
    #page-home .panel-card { padding: 12px; border-radius: 15px; }
    #page-home .selection-toolbar { margin-bottom: 0; }
    #page-home .zodiac-grid { margin-top: 0; padding: 0; }
    #page-home .number-selection-box { margin-top: 0 !important; padding: 6px 4px 7px; }
    #page-home .number-note { margin-top: 2px !important; padding: 8px; }
}

body {
    width: min(100vw, 430px);
    max-width: 430px;
    min-height: 100vh;
    margin: 0 auto;
    background: linear-gradient(180deg, #f2f3f5 0%, #eef1f4 100%);
}

@media (min-width: 700px) {
    body {
        display: block;
        width: min(100vw, 430px);
        max-width: 430px;
        margin: 0 auto;
        padding: 0;
        background: linear-gradient(180deg, #f2f3f5 0%, #eef1f4 100%);
    }
    .apple-nav,
    .app-shell,
    .page-content,
    .history-page,
    .forum-shell,
    .analysis-page {
        width: min(100vw, 430px);
        max-width: 430px;
        margin-left: auto;
        margin-right: auto;
    }
    .apple-nav {
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
    }
    .app-shell {
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }
    .page-content {
        min-height: auto;
    }
    .panel-card,
    .history-page,
    .forum-shell,
    .analysis-page {
        border-radius: 14px;
    }
}

@media (max-width: 420px) {
    body {
        font-size: 12px;
        background: linear-gradient(180deg, #f6f7f9 0%, #eef2f7 100%);
    }
    .apple-nav {
        height: 44px;
        background: rgba(250,250,252,.9);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .apple-nav-inner {
        width: calc(100% - 18px);
    }
    .apple-menu-button {
        width: 28px;
        height: 28px;
    }
    .apple-nav-links {
        left: 12px;
        right: 12px;
        min-width: 0;
        width: auto;
        border-radius: 16px;
    }
    .panel-card {
        border-radius: 12px;
        padding: 10px;
        box-shadow: 0 10px 26px rgba(15,23,42,.04);
    }
    .selection-toolbar {
        gap: 4px;
        margin-bottom: 0;
    }
    .selection-toolbar h2 {
        font-size: 15px;
        gap: 2px;
        line-height: 1;
    }
    .section-label {
        margin: 0 0 1px;
    }
    .zodiac-grid {
        gap: 1px;
        padding: 0 1px;
    }
    .zodiac-grid .filter-chip {
        min-width: 16px;
        padding: 4px 0;
        font-size: 9px;
        line-height: 1;
        letter-spacing: -0.02em;
    }
    .number-grid {
        gap: 3px 2px;
    }
    .number-chip {
        width: 24px;
        height: 24px;
        font-size: 9px;
    }
    .number-selection-box {
        padding: 6px 4px 7px;
        margin-top: 0 !important;
    }
    .number-note {
        padding: 8px;
    }
    .filter-chip,
    .function-filter-list .filter-chip {
        font-size: 10px;
    }
    .history-page {
        padding: 6px;
    }
    .history-today,
    .history-record {
        padding: 10px 8px;
        border-radius: 10px;
    }
    .history-today-title,
    .history-record h3 {
        font-size: 14px;
    }
    .history-ball-item .result-ball,
    .latest-draw-list .result-ball {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    .history-ball-item small,
    .latest-draw-list small {
        font-size: 8px;
    }
    .forum-shell {
        padding: 12px;
    }
    .forum-header h2 {
        font-size: 20px;
    }
    .selection-toolbar {
        gap: 4px;
        margin-bottom: 0;
    }
    .selection-toolbar h2 {
        font-size: 15px;
        gap: 2px;
        line-height: 1;
    }
    .section-label {
        margin: 0;
        font-size: 11px;
    }
    .zodiac-grid {
        gap: 0;
        padding: 0;
    }
    .zodiac-grid .filter-chip {
        min-width: 16px;
        padding: 4px 0;
        font-size: 9px;
        line-height: 1;
        letter-spacing: -0.02em;
    }
    .number-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 3px 2px;
    }
    .number-chip {
        width: 24px;
        height: 24px;
        font-size: 9px;
    }
    .number-selection-box {
        padding: 6px 4px 7px;
        margin-top: 0 !important;
    }
    .number-note {
        padding: 8px;
        margin-top: 8px !important;
    }
    .number-note-grid {
        gap: 8px;
    }
    .number-note input,
    .number-note textarea {
        font-size: 11px;
    }
    .filter-chip,
    .function-filter-list .filter-chip {
        font-size: 10px;
    }
    .function-filter-list {
        gap: 4px 3px;
    }
    .history-page {
        padding: 6px;
    }
    .history-search-bar {
        gap: 6px;
        margin: 6px 0;
    }
    .history-search-bar input {
        padding: 8px 9px;
        font-size: 12px;
    }
    .history-search-button,
    .history-date-button {
        font-size: 12px;
    }
    .history-date-button {
        width: 38px;
    }
    .history-today,
    .history-record {
        padding: 10px 8px;
        border-radius: 10px;
    }
    .history-today-title,
    .history-record h3 {
        font-size: 14px;
    }
    .history-today-balls,
    .history-record-balls,
    .latest-draw-list {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 4px;
        width: 100%;
        margin-top: 10px;
    }
    .history-ball-item,
    .latest-draw-item {
        flex: 1 1 0;
        min-width: 0;
    }
    .history-ball-item .result-ball,
    .latest-draw-list .result-ball {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    .history-ball-item small,
    .latest-draw-list small {
        display: block;
        margin-top: 2px;
        font-size: 8px;
        line-height: 1.2;
        letter-spacing: -.1px;
    }
    .history-record h3 {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }
    .history-record h3 small {
        margin-left: 0;
    }
    .latest-draw-box {
        padding: 7px 8px;
    }
    .latest-draw-heading h3 {
        font-size: 12px;
    }
    .latest-draw-heading span {
        font-size: 9px;
    }
    .account-status {
        margin-top: 10px;
        padding-top: 10px;
        font-size: 11px;
    }
    .kami-input,
    .kami-login-button,
    .logout-button {
        font-size: 11px;
    }
    .forum-shell {
        padding: 12px;
    }
    .forum-header h2 {
        font-size: 20px;
    }
    .forum-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    #page-forum {
        min-height: calc(100dvh - 44px);
    }
    #page-forum .forum-layout {
        padding-bottom: 360px;
    }
    #page-forum .forum-shell {
        width: 100vw;
        max-width: none;
        min-height: calc(100dvh - 44px);
        margin-left: calc(50% - 50vw);
        padding: 12px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    #page-forum .forum-auth-card {
        position: fixed;
        z-index: 50;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: max-content;
        max-height: calc(100dvh - 12px);
        overflow-y: auto;
        transform: none;
        border: 1px solid #e6ebf2;
        border-bottom: 0;
        border-radius: 12px 12px 0 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 24px rgba(33, 46, 72, .12);
    }
}
