@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;600;700;900&display=swap');

/* ── Design Tokens ── */
:root {
  --navy:        #1A1A2E;
  --navy-dark:   #0F0F1A;
  --navy-deep:   #0A0A0A;
  --gold:        #D4AF37;
  --gold-bright: #F9A825;
  --gold-glow:   rgba(212,175,55,0.25);
  --gold-dim:    rgba(212,175,55,0.15);
  --glass:       rgba(255,255,255,0.08);
  --glass-hover: rgba(255,255,255,0.13);
  --glass-border:rgba(255,255,255,0.15);
  --glass-gold:  rgba(212,175,55,0.20);
  --text:        #FFFFFF;
  --text-soft:   rgba(255,255,255,0.75);
  --text-muted:  rgba(255,255,255,0.45);
  --crimson:     #B71C1C;
  --radius:      16px;
  --radius-sm:   10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0A0A0A;
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(26,26,46,0.9) 0%, transparent 65%),
    linear-gradient(155deg, #0A0A0A 0%, #1A1A2E 55%, #0A0A0A 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(5,5,10,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: env(safe-area-inset-top, 0) 16px 0;
  z-index: 100;
}
.navbar-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 0 10px;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

/* ── Scan Hero Button ── */
.btn-scan-hero {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(160deg, #FFE566 0%, #F9A825 45%, #C68A00 100%);
  border: none;
  border-radius: 20px;
  padding: 9px 18px;
  color: #1A0E00;
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
  white-space: nowrap;
  position: relative;
  /* 3D depth */
  box-shadow:
    0 2px 0 0 #8A5C00,
    0 3px 8px rgba(212,175,55,0.55),
    0 6px 20px rgba(212,175,55,0.25),
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -1px 0 rgba(0,0,0,0.18);
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.08s, box-shadow 0.08s;
  animation: scan-pulse 3s ease-in-out infinite;
}
.btn-scan-hero .scan-icon {
  font-size: 1.1rem;
  line-height: 1;
}
.btn-scan-hero:active {
  transform: translateY(2px);
  box-shadow:
    0 0px 0 0 #8A5C00,
    0 1px 4px rgba(212,175,55,0.45),
    0 3px 10px rgba(212,175,55,0.18),
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 -1px 0 rgba(0,0,0,0.12);
}
@keyframes scan-pulse {
  0%,100% { box-shadow: 0 2px 0 0 #8A5C00, 0 3px 8px rgba(212,175,55,0.55), 0 6px 20px rgba(212,175,55,0.25), inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.18); }
  50%      { box-shadow: 0 2px 0 0 #8A5C00, 0 3px 12px rgba(249,168,37,0.80), 0 8px 28px rgba(249,168,37,0.40), inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.18); }
}
.btn-scan-hero.active {
  background: linear-gradient(160deg, #D4AF37 0%, #B8860B 45%, #8A6200 100%);
  animation: none;
  box-shadow:
    0 0px 0 0 #5A3F00,
    0 2px 6px rgba(212,175,55,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 2px 4px rgba(0,0,0,0.2);
  transform: translateY(1px);
}
.navbar-logo {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.btn-install {
  background: rgba(212,175,55,0.15);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--gold-bright);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  line-height: 1;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-install:active { background: rgba(212,175,55,0.28); }
.btn-settings {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background 0.15s;
}
.btn-settings:active { background: var(--glass-hover); }

.tab-bar {
  display: flex;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
}
.tab-btn.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

/* ── Content ── */
.tab-content {
  padding-top: calc(96px + env(safe-area-inset-top, 0));
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0));
  min-height: 100dvh;
}

/* ── Ticket List ── */
.ticket-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 56px; margin-bottom: 14px; opacity: 0.6; }
.empty-text { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; color: var(--text-soft); }
.empty-sub  { font-size: 0.85rem; }

/* ── Ticket Card ── */
.ticket-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.ticket-card:hover { border-color: var(--gold-dim); }
.ticket-highlight { border: 2px solid var(--gold-bright) !important; box-shadow: 0 0 0 3px rgba(249,168,37,0.45); }

.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--glass-border);
}
.ticket-type {
  font-weight: 900;
  font-size: 0.95rem;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ticket-period { font-size: 0.92rem; color: var(--text-muted); margin-top: 2px; }
.ticket-draw-date { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }

.ticket-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.status-pending   { background: rgba(249,168,37,0.15); color: var(--gold-bright); border: 1px solid rgba(249,168,37,0.3); }
.status-win       { background: linear-gradient(90deg, rgba(212,175,55,0.25), rgba(249,168,37,0.25)); color: var(--gold-bright); border: 1px solid var(--gold); }
.status-unclaimed { background: rgba(249,168,37,0.2); color: #ffd54f; border: 1px solid rgba(249,168,37,0.5); animation: pulse-gold 2s ease-in-out infinite; }
.status-expired   { background: rgba(120,120,120,0.15); color: #888; border: 1px solid rgba(120,120,120,0.3); }
.status-lose      { background: var(--glass); color: var(--text-muted); border: 1px solid var(--glass-border); }

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249,168,37,0); }
  50%       { box-shadow: 0 0 0 4px rgba(249,168,37,0.2); }
}

.ticket-deadline {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-block;
  line-height: 1.4;
}
.deadline-normal   { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--glass-border); }
.deadline-warn     { background: rgba(249,168,37,0.12); color: var(--gold-bright); border: 1px solid rgba(249,168,37,0.3); }
.deadline-urgent   { background: rgba(239,83,80,0.13);  color: #ef9a9a; border: 1px solid rgba(239,83,80,0.35); }
.deadline-critical { background: rgba(183,28,28,0.2);   color: #ff5252; border: 1px solid rgba(183,28,28,0.55); animation: pulse-red 1.4s ease-in-out infinite; }
.deadline-expired  { background: var(--glass); color: var(--text-muted); border: 1px solid var(--glass-border); }
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,83,80,0); }
  50%       { box-shadow: 0 0 0 5px rgba(239,83,80,0.2); }
}

.ticket-body { padding: 12px 16px; }

.play-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.play-label { font-size: 0.9rem; color: var(--text-muted); min-width: 32px; }

.ball {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  font-family: 'Noto Sans TC', sans-serif;
  letter-spacing: 0;
  flex-shrink: 0;
}
.ball-normal {
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.22) 0%, rgba(120,130,160,0.15) 45%, rgba(30,32,50,0.9) 100%);
  color: rgba(255,255,255,0.9);
  border: 1.5px solid rgba(255,255,255,0.18);
  box-shadow:
    inset -2px -3px 6px rgba(0,0,0,0.5),
    inset 1px 2px 4px rgba(255,255,255,0.12),
    0 3px 8px rgba(0,0,0,0.5);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.ball-bonus {
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.22) 0%, rgba(120,130,160,0.15) 45%, rgba(30,32,50,0.9) 100%);
  color: rgba(255,255,255,0.9);
  border: 1.5px solid rgba(255,255,255,0.18);
  box-shadow:
    inset -2px -3px 6px rgba(0,0,0,0.5),
    inset 1px 2px 4px rgba(255,255,255,0.12),
    0 3px 8px rgba(0,0,0,0.5);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.ball-match {
  background:
    radial-gradient(circle at 35% 28%, #FFE566 0%, #D4AF37 40%, #A07800 100%);
  color: #3A2000;
  border: none;
  box-shadow:
    inset -2px -3px 6px rgba(100,60,0,0.5),
    inset 1px 2px 5px rgba(255,240,120,0.6),
    0 3px 12px rgba(212,175,55,0.55),
    0 1px 4px rgba(0,0,0,0.4);
  text-shadow: 0 1px 2px rgba(255,220,80,0.4);
}
.ball-bonus-match {
  background:
    radial-gradient(circle at 35% 28%, #FFFFFF 0%, #FFE040 20%, #F9A825 55%, #C77800 100%);
  color: #2A1500;
  border: none;
  box-shadow:
    inset -2px -3px 6px rgba(150,80,0,0.45),
    inset 1px 2px 5px rgba(255,255,180,0.7),
    0 4px 16px rgba(249,168,37,0.7),
    0 1px 4px rgba(0,0,0,0.4);
  text-shadow: 0 1px 2px rgba(255,200,50,0.5);
}

.ticket-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--glass-border);
}
.ticket-date { font-size: 0.9rem; color: var(--text-muted); }
.ticket-actions { display: flex; gap: 8px; }

.btn-check {
  padding: 6px 18px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  color: var(--navy-deep);
  border: none;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-check:active { opacity: 0.8; }

.btn-delete {
  padding: 6px 10px;
  background: var(--glass);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-delete:hover { border-color: var(--crimson); color: #ef5350; }

/* ── Scan ── */
.scan-wrap {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.scan-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px dashed rgba(212,175,55,0.4);
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.scan-card:hover {
  border-color: var(--gold);
  background: var(--glass-hover);
}
.scan-btn-label { cursor: pointer; display: block; }
.scan-icon { font-size: 52px; margin-bottom: 14px; }
.scan-hint { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.scan-hint-sub { font-size: 0.82rem; color: var(--text-muted); }

.scan-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.scan-failed {
  text-align: center;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(183,28,28,0.12);
  border: 1px solid rgba(183,28,28,0.35);
  border-radius: var(--radius);
  margin: 8px 0;
}
.scan-failed-icon { font-size: 40px; }
.scan-failed-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ef9a9a;
}
.scan-failed-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.scan-failed-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form ── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 16px 0 12px;
  color: var(--text);
}
.form-row { margin-bottom: 12px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--glass);
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus { border-color: var(--gold); }
.form-select option { background: var(--navy); color: white; }

.play-input-row {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
}
.play-input-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
}
.number-inputs { display: flex; gap: 6px; flex-wrap: wrap; }
.number-input {
  width: 44px;
  padding: 8px 4px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  background: var(--glass);
  color: var(--text);
  outline: none;
  font-family: 'Courier New', monospace;
  transition: border-color 0.15s;
}
.number-input:focus { border-color: var(--gold); }
.bonus-sep {
  width: 2px; height: 36px;
  background: rgba(212,175,55,0.4);
  border-radius: 2px;
  align-self: center;
}
.btn-remove-play {
  position: absolute;
  top: 8px; right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
}
.btn-remove-play:hover { color: #ef5350; }

.btn-outline {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1.5px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.confirm-actions { display: flex; gap: 10px; margin-top: 20px; }

.btn-primary {
  flex: 1;
  padding: 13px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  color: var(--navy-deep);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-primary:active { opacity: 0.85; }

.btn-secondary {
  padding: 13px 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,14,46,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  z-index: 200;
}
.modal-box {
  background: rgba(10,10,20,0.96);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
}
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}
.modal-close {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}

/* ── Draw Info ── */
.result-draw-info {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.result-draw-numbers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  align-items: center;
}

/* ── Play Results ── */
.result-play {
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.result-play.win  { background: rgba(212,175,55,0.12); border: 1px solid rgba(212,175,55,0.35); }
.result-play.lose { background: var(--glass); border: 1px solid var(--glass-border); }
.result-play-label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.result-prize { font-size: 0.88rem; font-weight: 700; color: var(--text-muted); margin-top: 6px; }
.result-prize.win-prize {
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Prize Guidance ── */
.prize-guidance-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}
.prize-guidance-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.guidance-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
}
.guidance-card.guidance-small {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.3);
}
.guidance-card.guidance-medium {
  background: rgba(249,168,37,0.08);
  border-color: rgba(249,168,37,0.3);
}
.guidance-card.guidance-large {
  background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(249,168,37,0.08));
  border-color: rgba(212,175,55,0.5);
}
.guidance-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.guidance-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 3px;
}
.guidance-small .guidance-title  { color: #34d399; }
.guidance-medium .guidance-title { color: var(--gold-bright); }
.guidance-large .guidance-title  {
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.guidance-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.guidance-tax {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(249,168,37,0.12);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
}

/* ── 中獎紀錄頁面 ── */
.history-summary {
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 12px 16px 4px;
}
.hist-summary-row {
  display: flex;
  align-items: center;
}
.hist-sum-item {
  flex: 1;
  text-align: center;
}
.hist-sum-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.hist-sum-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.history-list {
  padding: 8px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  gap: 8px;
}
.history-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.history-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.history-period {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.history-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.history-plays {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-play-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.history-play-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-play-num {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.history-prize-badge {
  background: rgba(212,175,55,0.2);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--gold-bright);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}
.history-claim-wrap {
  flex-shrink: 0;
}

/* ── 篩選列 ── */
.filter-bar {
  padding: 8px 16px 0;
}
.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-chip.active {
  background: rgba(212,175,55,0.18);
  border-color: rgba(212,175,55,0.5);
  color: var(--gold-bright);
}
.filter-chip:active { opacity: 0.7; }
.filter-empty {
  text-align: center;
  padding: 40px 20px;
}
.filter-empty .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.filter-empty .empty-text { font-size: 1rem; color: var(--text-muted); }

/* ── 批次對獎列 ── */
.batch-check-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 16px 4px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.batch-progress {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-soft);
}
.btn-check-all {
  flex-shrink: 0;
  background: linear-gradient(90deg, rgba(212,175,55,0.18), rgba(249,168,37,0.18));
  border: 1px solid rgba(212,175,55,0.38);
  color: var(--gold-bright);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
}
.btn-check-all:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-check-all:not(:disabled):active {
  background: linear-gradient(90deg, rgba(212,175,55,0.32), rgba(249,168,37,0.32));
}

/* ── 中獎統計 ── */
.win-stats {
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 12px 16px 4px;
}
.win-stats-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.win-stats-row {
  display: flex;
  align-items: center;
  gap: 0;
}
.win-stat-item {
  flex: 1;
  text-align: center;
}
.win-stat-sep {
  width: 1px;
  height: 36px;
  background: rgba(212,175,55,0.25);
}
.win-stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.win-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
}
.win-stat-claimed     { color: #69f0ae; }
.win-stat-unclaimed   { color: #ffd54f; }
.win-stat-profit-pos  { color: #69f0ae; }
.win-stat-profit-neg  { color: #ef9a9a; }
.stat-unclaimed-row {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #ffd54f;
  text-align: center;
}

/* ── 領獎操作 ── */
.claim-area, .claim-status {
  margin-top: 8px;
}
.btn-claim {
  background: rgba(212,175,55,0.15);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--gold-bright);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-claim:active { opacity: 0.7; }
.claim-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.claim-input-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.claim-amount-input {
  flex: 1;
  min-width: 80px;
  max-width: 140px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  padding: 5px 10px;
  font-size: 0.85rem;
  font-family: inherit;
}
.btn-claim-confirm {
  background: rgba(105,240,174,0.15);
  border: 1px solid rgba(105,240,174,0.4);
  color: #69f0ae;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-claim-cancel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.claim-status {
  font-size: 0.82rem;
  color: #69f0ae;
  font-weight: 600;
}
.btn-unclaim {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  margin-left: 8px;
}
.btn-unclaim:active { opacity: 0.6; }
.claim-loading {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 0;
}
.claim-auto-note {
  font-size: 0.75rem;
  margin-top: 5px;
}
.claim-auto-note.success { color: #69f0ae; }
.claim-auto-note.warn    { color: var(--gold-bright); }

/* ── Win Banner ── */
.win-banner {
  text-align: center;
  padding: 16px 0 8px;
  margin-bottom: 12px;
}
.win-banner-amount {
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright), #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0%, 100% { filter: brightness(1); }
  50%       { filter: brightness(1.3); }
}
.win-banner-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ── API Key Banner ── */
.api-key-banner {
  background: rgba(183,28,28,0.15);
  border: 1px solid rgba(183,28,28,0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: #fca5a5;
}
.api-key-banner button {
  flex-shrink: 0;
  padding: 5px 14px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  color: var(--navy-deep);
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

/* ── Scan quota badge ── */
.scan-quota-badge {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 4px 0;
  letter-spacing: 0.02em;
}
.scan-quota-badge .quota-remain {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 3px 0 5px;
  line-height: 1;
}
.scan-quota-badge .quota-total {
  font-weight: 700;
  margin: 0 3px 0 2px;
}
.scan-quota-badge.quota-ok   .quota-remain { color: #4ade80; }
.scan-quota-badge.quota-warn .quota-remain { color: #fbbf24; }
.scan-quota-badge.quota-empty .quota-remain { color: #f87171; }

/* ── Settings ── */
.settings-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 4px;
}
.api-key-input-wrap { display: flex; gap: 6px; align-items: center; }
.api-key-input-wrap .form-input {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.btn-toggle-key {
  flex-shrink: 0;
  padding: 10px;
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
/* ── 設定 How-to ── */
.howto-section { margin-top: 4px; }
.howto-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.howto-steps { display: flex; flex-direction: column; }
.howto-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 11px 13px;
}
.howto-step-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--navy-deep);
  font-size: 0.72rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.howto-step-icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1.3; }
.howto-step-body { flex: 1; min-width: 0; }
.howto-step-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.howto-step-desc {
  font-size: 0.80rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.howto-connector {
  width: 1px;
  height: 10px;
  background: linear-gradient(to bottom, var(--gold-dim), transparent);
  margin: 0 0 0 20px;
  align-self: stretch;
}
.howto-tips {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.howto-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.4;
}
.tip-icon { flex-shrink: 0; font-size: 0.95rem; }

.settings-divider { height: 1px; background: var(--glass-border); margin: 16px 0; }
.settings-help-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 10px; }
.settings-help-steps {
  padding-left: 20px;
  font-size: 0.84rem;
  color: var(--text-soft);
  line-height: 2.1;
}
.settings-help-steps a { color: var(--gold-bright); text-decoration: underline; }
.btn-get-api-key {
  display: block;
  text-align: center;
  margin-top: 14px;
  padding: 13px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  color: var(--navy-deep);
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 0.95rem;
  text-decoration: none;
}

/* ── 開發者資訊 ── */
.dev-info {
  padding: 4px 0 8px;
}
.dev-info-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.dev-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  margin-bottom: 8px;
}
.dev-info-label {
  color: var(--text-muted);
  min-width: 64px;
}
.dev-info-value {
  color: var(--text-soft);
}
.dev-info-link {
  color: var(--gold-bright);
  text-decoration: none;
}
.dev-info-link:hover { text-decoration: underline; }

/* ── 選號頁 ── */
.lucky-wrap {
  padding: 24px 16px 40px;
}
.lucky-title {
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.lucky-form {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.lucky-count-btns {
  display: flex;
  gap: 8px;
  flex: 1;
}
.lucky-count-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.lucky-count-btn.active {
  background: rgba(212,175,55,0.2);
  border-color: rgba(212,175,55,0.5);
  color: var(--gold-bright);
}
.lucky-count-btn:active { opacity: 0.7; }
.btn-lucky-pick {
  width: 100%;
  padding: 16px;
  font-size: 1.08rem;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(212,175,55,0.25), rgba(249,168,37,0.25));
  border: 1px solid rgba(212,175,55,0.5);
  color: var(--gold-bright);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: all 0.15s;
  margin-bottom: 20px;
}
.btn-lucky-pick:active {
  background: linear-gradient(135deg, rgba(212,175,55,0.42), rgba(249,168,37,0.42));
  transform: scale(0.98);
}
.lucky-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.lucky-play {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.lucky-play-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.lucky-balls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.lucky-ball {
  animation: ball-pop 0.35s cubic-bezier(0.34,1.56,0.64,1) backwards;
}
@keyframes ball-pop {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.lucky-sep-line {
  width: 1px;
  height: 30px;
  background: rgba(255,255,255,0.18);
  margin: 0 4px;
}
.lucky-actions {
  display: flex;
  gap: 10px;
}
.lucky-actions .btn-secondary,
.lucky-actions .btn-primary { flex: 1; }

/* ── 歷史 sub-tabs ── */
.history-sub-tabs {
  display: flex;
  gap: 0;
  margin: 8px 16px 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.hist-sub-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.hist-sub-btn.active {
  background: rgba(212,175,55,0.2);
  color: var(--gold-bright);
}

/* ── 號碼統計 ── */
.numstat-type-row {
  display: flex;
  gap: 8px;
  padding: 10px 16px 2px;
}
.numstat-summary {
  display: flex;
  align-items: center;
  margin: 12px 16px 4px;
  padding: 13px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}
.numstat-sum-item { flex: 1; text-align: center; }
.numstat-sum-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 3px; }
.numstat-sum-val { font-size: 1.1rem; font-weight: 700; }
.numstat-title-row {
  display: flex;
  align-items: center;
  padding: 10px 16px 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.numstat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.numstat-ball {
  font-size: 0.8rem !important;
  width: 30px !important;
  height: 30px !important;
  flex-shrink: 0;
}
.numstat-bar-wrap {
  flex: 1;
  position: relative;
  height: 20px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.numstat-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(212,175,55,0.38);
  border-radius: 4px;
}
.numstat-bar-label {
  position: relative;
  z-index: 1;
  font-size: 0.76rem;
  color: var(--text-soft);
  padding-left: 7px;
  font-weight: 600;
}
.numstat-rate {
  text-align: right;
  font-size: 0.74rem;
  font-weight: 600;
  min-width: 50px;
  line-height: 1.4;
}
.numstat-pct { font-size: 0.88rem; font-weight: 700; display: block; }
.rate-high { color: #69f0ae; }
.rate-mid  { color: var(--gold-bright); }
.rate-low  { color: var(--text-muted); }
.numstat-empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── Toast ── */
/* ── Ad Slots ── */
.ad-slot {
  width: 100%; margin: 12px 0;
  min-height: 60px; background: transparent;
}

/* ── Footer ── */
.app-footer {
  text-align: center; padding: 16px 0 24px;
  font-size: 12px;
}
.app-footer a {
  color: var(--text-muted, #8899bb);
  text-decoration: none; opacity: 0.7;
}
.app-footer a:hover { opacity: 1; text-decoration: underline; }

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13,21,69,0.95);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 300;
  white-space: nowrap;
  backdrop-filter: blur(16px);
}

/* ── 搜尋期數 ── */
.search-bar {
  padding: 10px 12px 4px;
}

.search-period-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: #fff;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.search-period-input:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.10);
}

.search-period-input::placeholder {
  color: rgba(255,255,255,0.35);
}

/* ── 封存區 ── */
.archive-section {
  margin: 8px 0 4px;
}

.archive-toggle {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  color: rgba(255,255,255,0.5);
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.2s;
}

.archive-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}

.archive-list .ticket-card {
  opacity: 0.55;
}

.archive-list .ticket-card:hover {
  opacity: 0.75;
}

/* ── 開獎通知跑馬燈 ── */
.draw-notice-banner {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #B71C1C, #E53935, #FF8F00, #E53935, #B71C1C);
  background-size: 300% auto;
  animation: noticeBannerShine 4s linear infinite;
  color: #fff;
  padding: 7px 10px 7px 0;
  gap: 8px;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.15);
}

/* 顯示跑馬燈時，tab-content 多補 40px 避免被蓋住 */
body.notice-active .tab-content {
  padding-top: calc(136px + env(safe-area-inset-top, 0));
}

@keyframes noticeBannerShine {
  0%   { background-position: 0% center; }
  100% { background-position: 300% center; }
}

.draw-notice-scroll {
  flex: 1;
  overflow: hidden;
}

.draw-notice-inner {
  display: inline-block;
  white-space: nowrap;
  animation: noticeMarquee 12s linear infinite;
}

.draw-notice-inner span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

@keyframes noticeMarquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.draw-notice-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.7);
  color: #fff;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s;
}

.draw-notice-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ── Confetti Canvas ── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  display: none;
}

/* ── 開獎倒計時 Widget ── */
.draw-widget {
  margin: 12px 16px 0;
  background: rgba(26,26,46,0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.draw-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 8px;
  border-bottom: 1px solid var(--glass-border);
}
.draw-widget-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.draw-widget-time {
  font-size: 0.73rem;
  color: var(--text-muted);
}
.draw-widget-body { display: flex; }
.draw-widget-item {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-right: 1px solid var(--glass-border);
}
.draw-widget-item:last-child { border-right: none; }
.draw-widget-type {
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2px;
}
.draw-widget-day { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px; }
.draw-widget-cd {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.draw-widget-cd.tonight { color: #69f0ae; }
.draw-widget-cd.soon    { color: var(--gold-bright); }

/* ── Feature Showcase Empty State ── */
.empty-dashboard { padding: 0 0 24px; text-align: left; }

.empty-ai-panel {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(249,168,37,0.06));
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.empty-ai-icon { font-size: 2.1rem; line-height: 1.15; flex-shrink: 0; }
.empty-ai-name {
  font-size: 0.92rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.empty-ai-list { display: flex; flex-direction: column; gap: 3px; }
.empty-ai-li {
  font-size: 0.77rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.empty-ai-li::before { content: '✓'; color: #69f0ae; font-weight: 900; font-size: 0.7rem; }

.feature-section-label {
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 9px;
}
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.feature-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.feature-card-icon { font-size: 1.2rem; margin-bottom: 5px; }
.feature-card-name { font-size: 0.84rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.feature-card-desc { font-size: 0.69rem; color: var(--text-muted); line-height: 1.4; }

.empty-cta {
  width: 100%;
  padding: 13px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  color: var(--navy-deep);
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ── 空狀態功能列 ── */
.empty-features {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}
.empty-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text-soft);
}
.empty-feature-icon { font-size: 0.95rem; flex-shrink: 0; width: 22px; text-align: center; }

/* ── 選號策略 ── */
.lucky-strategy-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.lucky-strategy-btn {
  padding: 7px 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  line-height: 1.5;
  transition: all 0.15s;
}
.lucky-strategy-btn.active {
  background: rgba(212,175,55,0.2);
  border-color: rgba(212,175,55,0.5);
  color: var(--gold-bright);
}
.lucky-strategy-btn:active { opacity: 0.7; }

.lucky-ai-reason {
  background: rgba(26,26,46,0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  margin-bottom: 14px;
}
.lucky-ai-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.lucky-ai-text {
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.55;
}


/* Public content for search and review */
.content-guide {
  max-width: 980px;
  margin: 28px auto 72px;
  padding: 24px 20px 8px;
  color: var(--text-main);
  line-height: 1.8;
}
.content-guide h1 {
  font-size: 1.45rem;
  margin: 0 0 10px;
  color: var(--gold-bright);
}
.content-guide h2 {
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--text-main);
}
.content-guide p,
.content-guide li {
  font-size: 0.92rem;
  color: var(--text-soft);
}
.content-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.content-guide article {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  padding: 16px 18px;
}
.content-guide ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
.content-guide a { color: var(--gold-bright); }
@media (max-width: 720px) {
  .content-guide { margin: 18px auto 56px; padding: 20px 16px 4px; }
  .content-guide-grid { grid-template-columns: 1fr; }
}

/* ── 待辦狀態列 ── */
.status-bar {
  display: flex;
  align-items: center;
  background: #1e2433;
  border-radius: 10px;
  margin: 8px 0;
  padding: 8px 12px;
  flex-wrap: wrap;
  gap: 4px;
}
.status-item {
  background: none;
  border: none;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.status-item:hover { background: #2d3748; }
.status-item-warn .status-num { color: #fbbf24; }
.status-num { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.status-label { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.status-sep { width: 1px; height: 32px; background: #334155; margin: 0 4px; }
.status-expiry { font-size: 0.78rem; color: #94a3b8; padding: 4px 8px; }

/* ── 掃描警告 ── */
.scan-warnings { margin: 8px 0 4px; }
.scan-warn-item {
  background: #422006;
  color: #fcd34d;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.83rem;
  margin-bottom: 4px;
  line-height: 1.4;
}

.scan-error-item { background: #4c1d1d; color: #f87171; }

.edit-mode-banner {
  background: #1e3a5f;
  color: #93c5fd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-cancel-edit {
  background: none;
  border: 1px solid #93c5fd;
  color: #93c5fd;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-edit {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  background: none;
  border: 1px solid #4b5563;
  color: #9ca3af;
}
.btn-edit:hover { border-color: #9ca3af; color: #d1d5db; }

/* ── 月度收支 ── */
.stat-monthly-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 0;
  font-size: 0.85rem;
}
.stat-monthly-label { color: #94a3b8; }
.stat-budget-info { color: #94a3b8; }
.stat-budget-info.warn { color: #fbbf24; }
.stat-budget-info.over { color: #f87171; }
.stat-budget-bar-wrap {
  height: 4px;
  background: #334155;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.stat-budget-bar {
  height: 100%;
  background: #3b82f6;
  border-radius: 2px;
  transition: width 0.3s;
}
.stat-budget-bar.warn { background: #fbbf24; }
.stat-budget-bar.over { background: #f87171; }
.no-date-badge { font-size: 0.78rem; color: #fbbf24; margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-refetch-date { background: none; border: 1px solid #fbbf24; color: #fbbf24; border-radius: 4px; padding: 1px 7px; font-size: 0.75rem; cursor: pointer; }
