* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: #f5f7fa; padding: 16px; padding-bottom: 80px; color: #333; font-size: 16px; }
body.in-app { padding-top: calc(36px + env(safe-area-inset-top, 0px)); }

.card { background: white; border-radius: 16px; padding: 80px 16px 16px 16px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: relative; }
.card h2 { position: sticky; top: 0; z-index: 10; margin: -90px -16px 12px -16px; padding: calc(30px + env(safe-area-inset-top, 0px)) 16px 12px 16px; background: white; border-radius: 16px 16px 0 0; box-shadow: 0 2px 4px rgba(0,0,0,0.02); font-size: 20px; color: #1a2a3a; display: flex; align-items: center; justify-content: space-between; }

label { font-size: 15px; font-weight: 600; display: block; margin-top: 12px; }
input, textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 10px; font-size: 16px; margin-top: 4px; background: #fafbfc; }
textarea { height: 60px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { background: #2d7aff; color: white; border: none; padding: 12px; border-radius: 12px; font-size: 16px; font-weight: 600; width: 100%; margin-top: 16px; cursor: pointer; transition: 0.2s; }
.btn:active { transform: scale(0.97); background: #1a5fd0; }
.btn-danger { background: #ff4d4f; }
.btn-danger:active { background: #d9363e; }
.btn-outline { background: white; color: #2d7aff; border: 2px solid #2d7aff; }
.btn-success { background: #52c41a; }
.btn-success:active { background: #389e0d; }
.btn-sm { padding: 8px 16px; font-size: 14px; margin-top: 8px; width: auto; }
.btn-warning { background: #f39c12; color: white; }
.btn-warning:active { background: #d68910; }
.btn-orange { background: #e67e22; color: white; }
.btn-orange:active { background: #ca6f1e; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; text-align: center; }
.stats-grid div { background: #f0f4ff; padding: 10px; border-radius: 12px; }
.stats-grid span { display: block; font-size: 20px; font-weight: 700; }
.stats-grid small { font-size: 12px; color: #666; }
.profit-positive { color: #e74c3c; }
.profit-negative { color: #27ae60; }

.record-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #eee; align-items: center; width: 100%; }
.record-item:last-child { border-bottom: none; }
.record-item .period { font-weight: 700; color: #2d7aff; }
.record-item .detail { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record-item .money { text-align: right; font-weight: 600; }
.record-item .profit { text-align: right; font-weight: 600; }
.record-item .edit-btn { text-align: center; cursor: pointer; color: #2d7aff; font-size: 14px; background: none; border: none; padding: 4px; }
.record-item .edit-btn:active { color: #1a5fd0; }
.header-row { display: flex; justify-content: space-between; font-size: 12px; color: #999; padding: 4px 0; border-bottom: 1px solid #eee; }
.header-row span:nth-child(1) { width: 45px; text-align: center; }
.header-row span:nth-child(2) { width: 60px; text-align: left; }
.header-row span:nth-child(3) { flex: 1; text-align: right; padding-right: 20px; }
.header-row span:nth-child(4) { width: 85px; text-align: right; }
.header-row span:nth-child(5) { width: 32px; }

.tab-bar { position: fixed; bottom: 0; left: 0; right: 0; background: white; display: flex; border-top: 1px solid #ddd; padding: 6px 0 env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 100; }
.tab-bar button { flex: 1; background: none; border: none; font-size: 13px; font-weight: 600; color: #888; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tab-bar button .icon { font-size: 18px; }
.tab-bar .active { color: #2d7aff; }

.bulletin-board { background: white; border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid #2d7aff; }
.bulletin-title { font-size: 15px; font-weight: 700; color: #1a2a3a; margin-bottom: 8px; }
.bulletin-content { font-size: 13px; color: #555; line-height: 1.8; }
.bulletin-content p { margin-bottom: 4px; }

.carousel-container { position: relative; width: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px; background: #f0f4ff; }
.carousel-track { display: flex; transition: transform 0.3s ease-out; width: 100%; }
.carousel-slide { flex: 0 0 100%; width: 100%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-sizing: border-box; overflow: hidden; }
.carousel-slide a { display: block; width: 100%; }
.carousel-slide img { width: 100%; height: 180px; object-fit: cover; display: block; margin: 0; padding: 0; }
.carousel-indicators { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 10; }
.carousel-indicator { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); transition: 0.3s; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.carousel-indicator.active { background: #2d7aff; width: 16px; border-radius: 4px; }

.home-main-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: white; border-radius: 16px; padding: 10px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.home-main-tabs .main-tab { border: none; background: #f5f7fa; padding: 14px 4px; border-radius: 12px; font-size: 15px; font-weight: 700; color: #666; cursor: pointer; transition: 0.2s; font-family: inherit; text-align: center; }
.home-main-tabs .main-tab:active { transform: scale(0.96); }
.home-main-tabs .main-tab.active { background: #2d7aff; color: white; box-shadow: 0 2px 8px rgba(45,122,255,0.3); }

.page-header { display: flex; align-items: center; justify-content: space-between; background: white; border-radius: 16px; padding: 12px 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 90; }
.back-btn { background: #f0f4ff; border: none; padding: 8px 14px; border-radius: 20px; color: #2d7aff; font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.back-btn:active { transform: scale(0.95); background: #e0e8ff; }
.page-title { font-size: 16px; font-weight: 700; color: #1a2a3a; }

.home-sub-tabs { display: flex; gap: 6px; background: white; border-radius: 14px; padding: 6px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 50; }
.home-sub-tabs .sub-tab { flex: 1; border: none; background: transparent; padding: 10px 4px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #666; cursor: pointer; transition: 0.2s; font-family: inherit; }
.home-sub-tabs .sub-tab:active { transform: scale(0.96); }
.home-sub-tabs .sub-tab.active { background: #2d7aff; color: white; box-shadow: 0 2px 8px rgba(45,122,255,0.3); }

.action-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.action-row .btn { margin-top: 0; flex: 1; min-width: 70px; }
.file-input-wrapper { position: relative; overflow: hidden; display: inline-block; width: 100%; }
.file-input-wrapper input[type=file] { position: absolute; left: 0; top: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
#totalRecords { font-size: 14px; color: #666; margin-left: 8px; font-weight: normal; }
.desc-row { display: flex; justify-content: space-between; font-size: 12px; color: #999; margin-top: 4px; flex-wrap: wrap; }
.hint { background: #fff8e1; padding: 12px; border-radius: 10px; font-size: 13px; color: #856404; margin-top: 8px; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 999; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 20px; padding: 24px; max-width: 440px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 16px; }
.modal .btn-row { display: flex; gap: 10px; margin-top: 16px; }
.modal .btn-row .btn { margin-top: 0; }
.modal .btn-row .btn:first-child { flex: 2; }
.modal .btn-row .btn:last-child { flex: 1; background: #ddd; color: #333; }
.close-btn { float: right; background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }

.chart-section { margin-top: 12px; border-top: 1px solid #f0f0f0; padding-top: 12px; }
.chart-section .chart-title { font-size: 14px; font-weight: 600; color: #333; display: flex; justify-content: space-between; align-items: center; }
.chart-section .chart-title small { font-size: 12px; font-weight: normal; color: #999; }
.chart-box { width: 100%; height: 200px; margin-top: 6px; }
.chart-tips { display: flex; justify-content: center; gap: 20px; font-size: 12px; color: #999; margin-top: 4px; flex-wrap: wrap; }
.chart-tips span { display: flex; align-items: center; gap: 4px; }
.chart-tips .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.chart-tips .dot.red { background: #e74c3c; }
.chart-tips .dot.blue { background: #2d7aff; }
.chart-tips .dot.green { background: #27ae60; }
.chart-tips .dot.orange { background: #f39c12; }
.chart-divider { height: 1px; background: #f0f0f0; margin: 12px 0; }
.no-data-tip { display: flex; align-items: center; justify-content: center; height: 100%; color: #bbb; font-size: 14px; }

.zodiac-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.zodiac-item { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 0; background: #ffffff; border-radius: 8px; font-size: 11px; font-weight: 500; color: #333; cursor: pointer; border: 2px solid #ddd; transition: 0.15s; user-select: none; position: relative; aspect-ratio: 1/1; min-height: 38px; }
.zodiac-item::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; border-radius: 0 0 6px 6px; background: #ddd; transition: 0.15s; }
.zodiac-item:active { transform: scale(0.92); }
.zodiac-item .num { font-size: 22px; font-weight: 700; color: #1a2a3a; line-height: 1.1; }
.zodiac-item .zod { font-size: 14px; color: #666; line-height: 1.1; }
.zodiac-item.selected { background: #2d7aff; border-color: #2d7aff; transform: scale(0.95); }
.zodiac-item.selected .num, .zodiac-item.selected .zod { color: white; }
.zodiac-item.selected::after { background: #1a5fd0; }

.zodiac-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; margin-bottom: 6px; }
.zodiac-selector .zod-btn { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 10px 4px; border-radius: 10px; border: 2px solid #ddd; background: #fafbfc; cursor: pointer; transition: 0.15s; user-select: none; font-weight: 700; font-size: 16px; color: #333; position: relative; }
.zodiac-selector .zod-btn:active { transform: scale(0.94); }
.zodiac-selector .zod-btn .zod-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; }
.zodiac-selector .zod-btn .zod-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.zodiac-selector .zod-btn .zod-dot.red { background: #E74C3C; }
.zodiac-selector .zod-btn .zod-dot.blue { background: #3498DB; }
.zodiac-selector .zod-btn .zod-dot.green { background: #2ECC71; }
.zodiac-selector .zod-btn.active { border-color: #2d7aff; background: #e8f0fe; color: #2d7aff; box-shadow: 0 0 0 3px rgba(45,122,255,0.15); }
.zodiac-selector .zod-btn .zod-badge-count { position: absolute; top: -4px; right: -4px; background: #f1c40f; color: #333; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; box-shadow: 0 2px 6px rgba(241,196,15,0.4); }
.zodiac-selector .zod-btn.active .zod-badge-count { background: #2d7aff; color: white; }

.pick-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pick-btn { display: flex; justify-content: center; align-items: center; padding: 10px 4px; border-radius: 10px; border: 2px solid #e0e0e0; background: #fafbfc; font-size: 14px; font-weight: 700; color: #444; cursor: pointer; transition: 0.15s; font-family: inherit; user-select: none; -webkit-tap-highlight-color: transparent; }
.pick-btn:active { transform: scale(0.94); }
.pick-btn.active { border-color: #2d7aff; background: #e8f0fe; color: #2d7aff; box-shadow: 0 0 0 3px rgba(45,122,255,0.12); }
.pick-btn.partial { border-style: dashed; border-color: #2d7aff; color: #2d7aff; }
.pick-btn[data-pick="red"].active { border-color: #E74C3C; background: #fdecea; color: #E74C3C; box-shadow: 0 0 0 3px rgba(231,76,60,0.12); }
.pick-btn[data-pick="blue"].active { border-color: #3498DB; background: #eaf4fc; color: #3498DB; box-shadow: 0 0 0 3px rgba(52,152,219,0.12); }
.pick-btn[data-pick="green"].active { border-color: #2ECC71; background: #eafaf1; color: #2ECC71; box-shadow: 0 0 0 3px rgba(46,204,113,0.12); }

.zod-year-label { font-size: 13px; color: #888; text-align: center; margin-top: 8px; padding: 6px 0; background: #f8f9fa; border-radius: 8px; }
.zod-year-label strong { color: #2d7aff; font-weight: 700; }

#selectedNumbersDisplay { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 10px; font-size: 15px; background: #fafbfc; min-height: 48px; margin-top: 8px; }
.select-actions { display: flex; gap: 10px; margin-top: 8px; }
.select-actions .btn { flex: 1; margin-top: 0; }
.ai-section { margin-top: 16px; border-top: 2px dashed #e0e0e0; padding-top: 16px; }
.ai-section .ai-title { font-size: 16px; font-weight: 700; color: #2d7aff; display: flex; align-items: center; gap: 8px; }
.ai-section .ai-title small { font-size: 12px; font-weight: normal; color: #999; }
.ai-count-input { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.ai-count-input label { margin-top: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.ai-count-input input { width: 70px; padding: 8px 10px; font-size: 16px; text-align: center; flex-shrink: 0; }
.btn-row-ai { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.btn-row-ai .btn { flex: 1; margin-top: 0; min-width: 100px; }
.ai-result-box { background: #f8f9fa; border-radius: 12px; padding: 16px; margin-top: 12px; min-height: 60px; border-left: 4px solid #2d7aff; }
.ai-result-box .result-numbers { font-size: 22px; font-weight: 700; color: #2d7aff; letter-spacing: 2px; display: flex; flex-wrap: wrap; gap: 4px; }
.ai-result-box .result-reason { font-size: 14px; color: #555; margin-top: 8px; line-height: 1.6; }
.ai-result-box .result-status { color: #999; font-size: 14px; }
.ai-result-box .result-error { color: #e74c3c; font-size: 14px; }
.ai-loading { display: inline-block; width: 20px; height: 20px; border: 3px solid #f0f0f0; border-top-color: #2d7aff; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.ai-actions .btn { flex: 1; min-width: 80px; margin-top: 0; }
.result-tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 14px; font-weight: 600; color: white; cursor: pointer; transition: 0.15s; user-select: none; border: none; }
.result-tag:active { transform: scale(0.92); }
.result-tag.removed { background: #e9ecef !important; color: #999 !important; text-decoration: line-through; cursor: pointer; }
.result-tag.red { background: #E74C3C; }
.result-tag.blue { background: #3498DB; }
.result-tag.green { background: #2ECC71; }

.setting-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f0f0; }
.setting-group:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.setting-group .group-title { font-size: 15px; font-weight: 600; color: #333; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.setting-group .group-title small { font-size: 12px; font-weight: normal; color: #999; }
.setting-status { font-size: 13px; padding: 6px 12px; border-radius: 8px; display: inline-block; margin-top: 4px; }
.setting-status.success { background: #d4edda; color: #155724; }
.setting-status.error { background: #f8d7da; color: #721c24; }
.setting-status.info { background: #d1ecf1; color: #0c5460; }
.model-select { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.model-select .model-option { padding: 6px 14px; border-radius: 20px; border: 2px solid #ddd; background: white; font-size: 13px; cursor: pointer; transition: 0.15s; font-weight: 500; }
.model-select .model-option:active { transform: scale(0.95); }
.model-select .model-option.active { border-color: #2d7aff; background: #e8f0fe; color: #2d7aff; }
.model-select .model-option .model-tag { font-size: 10px; color: #999; font-weight: 400; }
.ai-service-selector { display: flex; gap: 10px; margin-top: 4px; }
.ai-service-selector .service-btn { flex: 1; padding: 10px; border-radius: 12px; border: 2px solid #ddd; background: white; text-align: center; font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.ai-service-selector .service-btn:active { transform: scale(0.96); }
.ai-service-selector .service-btn.active { border-color: #2d7aff; background: #e8f0fe; color: #2d7aff; }
.ai-service-selector .service-btn .s-icon { font-size: 20px; display: block; margin-bottom: 2px; }
.ai-service-selector .service-btn .s-name { font-size: 13px; }
.ai-service-selector .service-btn .s-badge { font-size: 10px; background: #f0f0f0; padding: 2px 8px; border-radius: 10px; display: inline-block; margin-top: 2px; }
.api-key-input-wrap { position: relative; }
.api-key-input-wrap input { padding-right: 50px; }
.api-key-input-wrap .toggle-vis { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; cursor: pointer; color: #999; padding: 4px; }

.file-drop-zone { border: 2px dashed #ddd; border-radius: 12px; padding: 24px 16px; text-align: center; color: #999; transition: 0.2s; cursor: pointer; background: #fafbfc; margin-top: 4px; }
.file-drop-zone:active { transform: scale(0.98); }
.file-drop-zone.dragover { border-color: #2d7aff; background: #e8f0fe; color: #2d7aff; }
.file-drop-zone .icon { font-size: 32px; display: block; margin-bottom: 6px; }
.file-drop-zone .hint-text { font-size: 14px; }
.file-drop-zone .sub-hint { font-size: 12px; color: #bbb; margin-top: 4px; }
.file-drop-zone .file-input-hidden { display: none; }
.file-preview { margin-top: 10px; background: #f8f9fa; border-radius: 10px; padding: 12px; border: 1px solid #e9ecef; }
.file-preview .file-name { font-weight: 600; font-size: 14px; color: #333; }
.file-preview .file-info { font-size: 12px; color: #888; margin-top: 2px; }
.file-preview .file-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.file-preview .file-actions .btn { margin-top: 0; padding: 6px 16px; font-size: 13px; width: auto; }
.file-preview .parsed-preview { background: white; border-radius: 8px; padding: 10px; margin-top: 8px; border: 1px solid #e9ecef; font-size: 13px; max-height: 150px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-family: monospace; color: #333; }

.date-display { font-size: 13px; color: #888; font-weight: normal; }
.data-source-tabs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.data-source-tabs .tab-btn { padding: 6px 16px; border-radius: 20px; border: 1px solid #ddd; background: #f5f5f5; font-size: 13px; cursor: pointer; transition: 0.2s; font-weight: 500; }
.data-source-tabs .tab-btn:active { transform: scale(0.95); }
.data-source-tabs .tab-btn.active { background: #2d7aff; color: white; border-color: #2d7aff; }
.data-panel { margin-top: 8px; }
.data-panel textarea { height: 100px; font-size: 14px; }
.fetch-status { font-size: 12px; color: #888; margin-top: 4px; }
.fetch-status.success { color: #27ae60; }
.fetch-status.error { color: #e74c3c; }
.ai-status-badge { display: inline-block; margin-left: 12px; padding: 2px 10px; border-radius: 12px; font-size: 11px; color: white; }

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.78); color: white; padding: 12px 24px; border-radius: 12px; font-size: 14px; z-index: 9999; display: none; max-width: 90%; text-align: center; pointer-events: none; word-break: break-all; line-height: 1.5; }
.toast.show { display: block; animation: toastFade 2.5s ease forwards; }
@keyframes toastFade { 0% { opacity: 0; transform: translateX(-50%) translateY(-12px); } 15% { opacity: 1; transform: translateX(-50%) translateY(0); } 85% { opacity: 1; transform: translateX(-50%) translateY(0); } 100% { opacity: 0; transform: translateX(-50%) translateY(-12px); } }

.copy-fallback-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 10000; padding: 20px; }
.copy-fallback-modal.active { display: flex; }
.copy-fallback-modal .box { background: white; border-radius: 16px; padding: 24px; max-width: 380px; width: 100%; text-align: center; }
.copy-fallback-modal .box textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; margin: 12px 0; height: 80px; resize: none; }
.copy-fallback-modal .box .btn { margin-top: 4px; }

#authLock { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 1000000 !important; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#authLock[style*="display: flex"] { display: flex !important; }
#authLock .auth-box { position: relative; background: white; padding: 32px 24px; border-radius: 24px; max-width: 380px; width: 92%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5); margin: 16px; }
#authLock .auth-box h2 { font-size: 22px; margin-bottom: 4px; color: #1a2a3a; }
#authLock .auth-box .auth-sub { font-size: 13px; color: #888; margin-bottom: 16px; }
#authLock .auth-box .machine-box { background: #f5f7fa; border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; border: 1px dashed #d0d7de; }
#authLock .auth-box .machine-label { font-size: 11px; color: #999; margin-bottom: 2px; }
#authLock .auth-box .machine-code { font-family: 'Courier New', monospace; font-size: 18px; font-weight: 700; color: #2d7aff; word-break: break-all; letter-spacing: 2px; user-select: all; }
#authLock .auth-box .copy-machine-btn { background: #e8f0fe; border: none; padding: 6px 18px; border-radius: 20px; font-size: 13px; color: #2d7aff; cursor: pointer; margin-bottom: 14px; transition: 0.15s; }
#authLock .auth-box .copy-machine-btn:active { transform: scale(0.95); }
#authLock .auth-box .divider { border-top: 1px solid #eee; padding-top: 14px; margin-top: 4px; }
#authLock .auth-box .license-label { font-size: 13px; font-weight: 600; display: block; text-align: left; margin-bottom: 4px; }
#authLock .auth-box input[type="text"] { width: 100%; padding: 12px 14px; border: 2px solid #ddd; border-radius: 12px; font-size: 18px; text-align: center; letter-spacing: 3px; background: #fafbfc; transition: border-color 0.2s; }
#authLock .auth-box input[type="text"]:focus { outline: none; border-color: #2d7aff; }
#authLock .auth-box .btn-activate { background: #2d7aff; color: white; border: none; padding: 14px; border-radius: 12px; font-size: 18px; font-weight: 600; width: 100%; margin-top: 12px; cursor: pointer; transition: 0.2s; }
#authLock .auth-box .btn-activate:active { transform: scale(0.97); background: #1a5fd0; }
#authLock .auth-box .auth-error { color: #e74c3c; font-size: 13px; margin-top: 10px; min-height: 20px; display: none; }
#authLock .auth-box .auth-success { color: #27ae60; font-weight: 600; margin-top: 8px; display: none; }
#authLock .auth-box .device-id-hint { font-size: 11px; color: #bbb; margin-top: 14px; word-break: break-all; }

.img-upload-area { border: 2px dashed #d0d7de; border-radius: 12px; padding: 20px 16px; text-align: center; color: #888; background: #fafbfc; cursor: pointer; transition: 0.2s; margin-top: 8px; }
.img-upload-area:active { transform: scale(0.98); }
.img-upload-area.dragover { border-color: #2d7aff; background: #e8f0fe; color: #2d7aff; }
.img-upload-area .icon { font-size: 36px; display: block; margin-bottom: 4px; }
.img-upload-area .hint-text { font-size: 14px; }
.img-upload-area .sub-hint { font-size: 12px; color: #bbb; margin-top: 2px; }
.img-upload-area .file-input-hidden { display: none; }
.ocr-progress { margin-top: 10px; background: #f0f4ff; border-radius: 10px; padding: 12px; font-size: 13px; color: #2d7aff; display: none; }
.ocr-progress .bar { height: 4px; background: #d0d7de; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.ocr-progress .bar .fill { height: 100%; background: #2d7aff; width: 0%; transition: width 0.3s; }
.ocr-result-item { background: #f8f9fa; border-radius: 8px; padding: 10px 12px; margin-top: 6px; border-left: 3px solid #2d7aff; font-size: 13px; }
.ocr-result-item .img-name { font-weight: 600; color: #333; font-size: 12px; }
.ocr-result-item .extracted { color: #2d7aff; font-weight: 500; word-break: break-all; }
.ocr-result-item .raw-text { color: #888; font-size: 12px; margin-top: 2px; word-break: break-all; max-height: 60px; overflow: auto; }
.ocr-result-item .status-badge { display: inline-block; padding: 1px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.ocr-result-item .status-badge.done { background: #d4edda; color: #155724; }
.ocr-result-item .status-badge.fail { background: #f8d7da; color: #721c24; }
.ocr-result-item .status-badge.processing { background: #d1ecf1; color: #0c5460; }
.ocr-result-item .source-tag { font-size: 10px; background: #e9ecef; padding: 0 6px; border-radius: 10px; color: #666; margin-left: 4px; }

.sort-result-modal .modal { max-width: 520px; }
.sort-result-modal .sort-section { margin-top: 12px; }
.sort-result-modal .sort-section .sort-title { font-size: 15px; font-weight: 700; color: #333; display: flex; align-items: center; gap: 8px; border-bottom: 2px solid #f0f0f0; padding-bottom: 6px; }
.sort-result-modal .sort-section .sort-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.sort-result-modal .sort-section .sort-item { display: inline-flex; align-items: center; gap: 4px; background: #f0f4ff; padding: 4px 12px; border-radius: 20px; font-size: 14px; font-weight: 500; border: 1px solid #e0e7ef; cursor: pointer; transition: 0.15s; }
.sort-result-modal .sort-section .sort-item:hover { background: #d0dfff; border-color: #2d7aff; }
.sort-result-modal .sort-section .sort-item:active { transform: scale(0.95); }
.sort-result-modal .sort-section .sort-item .count { background: #2d7aff; color: white; border-radius: 50%; padding: 0 8px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; }
.sort-result-modal .sort-section .sort-item .zod-label { color: #2d7aff; }
.sort-result-modal .sort-section .sort-item .num-label { color: #e67e22; }
.sort-result-modal .sort-empty { color: #bbb; font-size: 14px; padding: 12px 0; text-align: center; }

.vision-toggle { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.vision-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: #2d7aff; margin: 0; }
.ocr-apply-area { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.ocr-apply-area .btn { flex: 1; min-width: 120px; margin-top: 0; }
.zodiac-selector .zod-btn .zod-num-hint { font-size: 9px; color: #aaa; margin-top: 1px; }
.zodiac-selector .zod-btn.active .zod-num-hint { color: #2d7aff; }
.zodiac-selector .zod-btn .zod-badge-count { position: absolute; top: -4px; right: -4px; background: #ff4d4f; color: white; border-radius: 50%; width: 18px; height: 18px; font-size: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; box-shadow: 0 2px 6px rgba(255,77,79,0.3); }
.zodiac-selector .zod-btn.active .zod-badge-count { background: #2d7aff; }
.selected-banner { background: linear-gradient(135deg, #e8f0fe 0%, #f0f5ff 100%); border: 2px solid #d0e0ff; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.banner-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.banner-title { font-size: 13px; font-weight: 700; color: #2d7aff; }
.banner-count { font-size: 12px; background: #2d7aff; color: white; padding: 2px 10px; border-radius: 12px; font-weight: 600; }
.selected-banner textarea { width: 100%; padding: 10px 12px; border: 1px solid #d0e0ff; border-radius: 10px; font-size: 15px; background: white; min-height: 52px; resize: vertical; font-family: inherit; margin-top: 0; }
.banner-actions { display: flex; gap: 8px; margin-top: 8px; }
.mini-btn { flex: 1; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: 0.15s; font-family: inherit; }
.mini-btn:active { transform: scale(0.97); }
.mini-btn-primary { background: #2d7aff; color: white; }
.mini-btn-primary:active { background: #1a5fd0; }
.mini-btn-danger { background: #ff4d4f; color: white; }
.mini-btn-danger:active { background: #d9363e; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #f0f4f9; padding: 6px; border-radius: 14px; margin-bottom: 14px; }
.mode-tab { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border-radius: 10px; border: none; background: transparent; cursor: pointer; transition: 0.2s; color: #666; font-family: inherit; }
.mode-tab .tab-icon { font-size: 22px; line-height: 1; }
.mode-tab .tab-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.mode-tab .tab-title { font-size: 14px; font-weight: 700; line-height: 1.2; }
.mode-tab .tab-desc { font-size: 10px; color: #999; line-height: 1.2; margin-top: 2px; }
.mode-tab.active { background: white; color: #2d7aff; box-shadow: 0 2px 8px rgba(45,122,255,0.15); }
.mode-tab.active .tab-desc { color: #5b8fef; }
.tool-card { background: linear-gradient(135deg, #f8faff 0%, #f0f5ff 100%); border: 1px solid #e0e8f5; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.tool-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tool-title { font-size: 14px; font-weight: 700; color: #1a2a3a; }
.tool-hint { font-size: 11px; color: #999; }
.random-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.random-row label { margin: 0; font-size: 14px; font-weight: 600; color: #555; white-space: nowrap; }
.random-row input { width: 70px; padding: 8px 10px; border: 1px solid #d0e0ff; border-radius: 8px; font-size: 15px; text-align: center; font-weight: 700; color: #2d7aff; background: white; margin: 0; flex-shrink: 0; }
.btn-gen { flex: 1; padding: 9px 12px; border: none; border-radius: 10px; background: linear-gradient(135deg, #2d7aff 0%, #5b8fef 100%); color: white; font-size: 14px; font-weight: 700; cursor: pointer; transition: 0.15s; box-shadow: 0 2px 6px rgba(45,122,255,0.25); font-family: inherit; margin-top: 0; }
.btn-gen:active { transform: scale(0.97); box-shadow: 0 1px 3px rgba(45,122,255,0.3); }
.section-block { margin-bottom: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-title { font-size: 14px; font-weight: 700; color: #1a2a3a; }
.section-hint { font-size: 11px; color: #999; font-weight: normal; }
.api-status-card { display: flex; align-items: center; justify-content: space-between; background: #f8f9fa; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; border-left: 3px solid #2d7aff; }
.api-status-left { display: flex; align-items: center; gap: 10px; }
.api-icon { font-size: 20px; }
.api-title { font-size: 13px; font-weight: 700; color: #1a2a3a; }
.api-sub { font-size: 11px; color: #999; margin-top: 1px; }
.api-status-card .ai-status-badge { margin-left: 0; padding: 3px 10px; }
.ai-tool-card { background: linear-gradient(135deg, #faf5ff 0%, #f0ebff 100%); border-color: #e5d8f5; }
.ai-tool-card .tool-title { color: #8e44ad; }
.ai-action-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-action-row label { margin: 0; font-size: 13px; font-weight: 600; color: #555; }
.ai-action-row input { width: 70px; padding: 8px 10px; border: 1px solid #d8c5f5; border-radius: 8px; font-size: 15px; text-align: center; font-weight: 700; color: #8e44ad; background: white; margin: 0; }
.ai-action-row > span { font-size: 13px; color: #555; }
.btn-ai-primary { flex: 1; min-width: 120px; padding: 10px 12px; border: none; border-radius: 10px; background: linear-gradient(135deg, #8e44ad 0%, #a065c8 100%); color: white; font-size: 14px; font-weight: 700; cursor: pointer; transition: 0.15s; box-shadow: 0 2px 6px rgba(142,68,173,0.25); font-family: inherit; }
.btn-ai-primary:active { transform: scale(0.97); }
.btn-ai-secondary { width: 100%; padding: 9px 12px; border: 1.5px solid #d8c5f5; border-radius: 10px; background: white; color: #8e44ad; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.15s; font-family: inherit; }
.btn-ai-secondary:active { transform: scale(0.97); background: #f5edff; }
@media (max-width: 480px) { .mode-tab .tab-icon { font-size: 20px; } .mode-tab .tab-title { font-size: 13px; } .mode-tab .tab-desc { font-size: 9px; } }
.api-fetch-card { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px 14px; margin-top: 8px; margin-bottom: 12px; }
.api-fetch-card .api-fetch-title { font-size: 13px; font-weight: 700; color: #166534; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.api-fetch-card .api-fetch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.api-fetch-card .api-fetch-actions .btn { margin-top: 0; flex: 1; min-width: 100px; padding: 8px 10px; font-size: 12px; border-radius: 8px; }
.api-fetch-status { font-size: 12px; color: #166534; margin-top: 6px; min-height: 16px; }
.api-fetch-status.error { color: #dc2626; }
.api-fetch-status.success { color: #15803d; }
.latest-fetch-card { background: linear-gradient(135deg, #eff6ff 0%, #e0edff 100%); border: 1.5px solid #bfdbfe; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.latest-fetch-card .latest-fetch-title { font-size: 13px; font-weight: 700; color: #1e40af; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.latest-fetch-card .latest-fetch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.latest-fetch-card .latest-fetch-actions .btn { margin-top: 0; flex: 1; min-width: 100px; padding: 9px 12px; font-size: 13px; border-radius: 8px; }
.latest-fetch-status { font-size: 12px; color: #1e40af; margin-top: 8px; min-height: 16px; line-height: 1.5; word-break: break-all; }
.latest-fetch-status.error { color: #dc2626; }
.latest-fetch-status.success { color: #15803d; }
#trialCountdown { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); background: rgba(45,122,255,0.95); color: #fff; padding: 7px 18px; border-radius: 20px; font-size: 13px; font-weight: 700; z-index: 9998; box-shadow: 0 4px 14px rgba(45,122,255,0.35); display: none; white-space: nowrap; letter-spacing: 0.5px; pointer-events: none; transition: background 0.3s; }
#trialCountdown.warning { background: rgba(243,156,18,0.96); box-shadow: 0 4px 14px rgba(243,156,18,0.4); }
#trialCountdown.danger  { background: rgba(231,76,60,0.96);  box-shadow: 0 4px 14px rgba(231,76,60,0.45); animation: trialPulse 1s ease-in-out infinite; }
@keyframes trialPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.ai-locked-hint { background: #fff3cd; border: 1.5px solid #ffc107; border-radius: 10px; padding: 10px 14px; font-size: 13px; color: #856404; margin-bottom: 12px; display: none; line-height: 1.5; }
.ai-locked-hint.active { display: block; }
.btn-ai-primary.locked, .btn-ai-secondary.locked, .btn.locked { opacity: 0.55; cursor: not-allowed; position: relative; filter: grayscale(0.3); }
.btn-ai-primary.locked::after, .btn-ai-secondary.locked::after, .btn.locked::after { content: '🔒'; margin-left: 6px; font-size: 12px; }
#wechatQrModal .modal { max-width: 320px; padding: 20px; text-align: center; }
#wechatQrModal img { width: 100%; max-width: 260px; border-radius: 12px; margin: 12px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.placeholder-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 40px 20px; }
.placeholder-page .placeholder-icon { font-size: 72px; margin-bottom: 16px; }
.placeholder-page .placeholder-title { font-size: 22px; font-weight: 700; color: #1a2a3a; margin-bottom: 8px; }
.placeholder-page .placeholder-desc { font-size: 14px; color: #888; line-height: 1.6; max-width: 300px; }
.placeholder-page .placeholder-badge { margin-top: 16px; background: #fff8e1; color: #856404; padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; }