:root {
  color-scheme: dark;
  --bg: #090806; --surface: #14100c; --surface-2: #1d1711; --surface-3: #251c13;
  --gold: #f3bd46; --gold-soft: #d9a94d; --gold-dim: #76542a; --text: #f4dfb4;
  --muted: #b9a88b; --danger: #7d2929; --danger-border: #b24b4b; --line: #4c331c;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 760px; background: radial-gradient(circle at 50% -20%, #2d2013 0, var(--bg) 44%); color: var(--text); font-family: "Microsoft JhengHei UI", "Noto Sans TC", sans-serif; font-size: 15px; }
button, input { font: inherit; }
button { cursor: pointer; color: var(--text); border: 1px solid var(--gold-dim); border-radius: 7px; padding: 9px 15px; background: linear-gradient(#33271a, #21180f); transition: .15s ease; }
button:hover:not(:disabled) { border-color: var(--gold); filter: brightness(1.12); transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: default; }
.titlebar { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: #211a14; border-top: 2px solid var(--gold-dim); border-bottom: 1px solid #332617; box-shadow: 0 6px 20px #0008; }
.brand { display: flex; gap: 10px; align-items: center; font-size: 18px; color: #ffda8c; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; color: #211307; font: 800 18px Georgia; background: var(--gold); border-radius: 6px; box-shadow: 0 0 15px #f3bd4640; }
.privacy { color: #a99879; font-size: 13px; }
.mobile-only { display: none; }
.shell { width: min(1240px, calc(100% - 28px)); margin: 18px auto 48px; }
.main-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gold-dim); }
.main-tabs .tab { border-radius: 8px 8px 0 0; border-bottom: 0; min-width: 160px; background: #17110d; }
.main-tabs .tab.active { color: #171009; background: var(--gold); font-weight: 700; }
.page { display: none; padding-top: 14px; }
.page.active { display: block; }
.calculator-grid { display: grid; grid-template-columns: minmax(370px, .85fr) minmax(430px, 1.15fr); gap: 14px; }
.panel { background: linear-gradient(140deg, #15110dcf, #0d0b09e8); border: 1px solid var(--line); border-radius: 10px; box-shadow: inset 0 1px #73512d55, 0 8px 28px #0005; }
.input-panel, .image-panel, .prize-panel { padding: 17px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: #ffd47c; font-size: 18px; }
.section-title strong, .status { font-size: 13px; font-weight: 400; color: var(--muted); }
.letter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.letter-field { display: flex; align-items: center; background: #0a0908; border: 1px solid #382919; border-radius: 7px; overflow: hidden; }
.letter-field label { display: grid; place-items: center; width: 39px; height: 38px; background: #261c12; color: var(--gold); font: 700 17px Georgia, serif; border-right: 1px solid #49341e; }
.letter-field input { min-width: 0; width: 100%; height: 38px; padding: 0 8px; text-align: right; color: #fff1d3; background: transparent; border: 0; outline: 0; }
.letter-field:focus-within { border-color: var(--gold); box-shadow: 0 0 0 2px #e4ad3c22; }
.button-row { display: flex; gap: 9px; align-items: center; }
.button-row.compact { margin-top: 14px; justify-content: flex-end; }
.danger { background: linear-gradient(#6a2929, #481919); border-color: var(--danger-border); }
.primary { color: #221406; font-weight: 800; background: linear-gradient(#ffd45d, #eca72e); border-color: #ffd66b; }
.large { min-width: 170px; padding: 12px 22px; font-size: 17px; }
.small { padding: 6px 11px; margin-left: auto; }
.drop-zone { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; background: #080706; border: 1px dashed #825b2f; border-radius: 9px; outline: 0; }
.drop-zone.dragging, .drop-zone:focus { border-color: var(--gold); background: #21180e; }
.drop-zone span { color: var(--muted); font-size: 13px; }
.paste-icon { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid var(--gold-dim); color: var(--gold); border-radius: 50%; font-size: 20px; }
.merge-row { display: flex; align-items: center; gap: 13px; margin-top: 12px; color: var(--muted); }
.merge-row label, .mode-card { cursor: pointer; }
input[type="radio"] { position: absolute; opacity: 0; }
.merge-row label i, .radio-ring { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 4px; border: 2px solid #967044; border-radius: 50%; vertical-align: -3px; }
input[type="radio"]:checked + i::after, .mode-card input:checked + .radio-ring::after { content: ""; width: 7px; height: 7px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 8px var(--gold); }
.warnings { margin-top: 10px; padding: 9px 11px; color: #ffd6a0; background: #49250f; border: 1px solid #9e5d22; border-radius: 6px; white-space: pre-line; }
.previews { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; max-height: 260px; overflow: auto; margin-top: 11px; }
.preview { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 9px; min-height: 82px; padding: 8px; background: #0d0b09; border: 1px solid #392817; border-radius: 7px; }
.preview img { width: 96px; height: 68px; object-fit: contain; background: #050505; border-radius: 4px; }
.preview p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); white-space: pre-line; }
.preview button { position: absolute; top: 5px; right: 5px; padding: 2px 7px; background: #4b1c1c; border-color: #7b3434; }
.mode-panel { margin-top: 14px; padding: 12px 16px 15px; }
.mode-panel legend { padding: 0 9px; color: #ffd27a; font-weight: 700; }
.mode-options { display: grid; grid-template-columns: .7fr .7fr 1.45fr; }
.mode-card { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 58px; padding: 8px 14px; font-size: 16px; border-right: 1px solid #6e4e29; }
.mode-card:last-child { border-right: 0; }
.mode-card:has(input:checked) { color: #ffd268; background: #2a1e10; }
.recommended { padding: 5px 9px; color: #291707; background: var(--gold); border-radius: 5px; font-size: 13px; font-weight: 800; }
.action-row { display: flex; justify-content: center; gap: 12px; margin: 14px 0; }
.results { min-height: 100px; padding: 17px; }
.empty-result { padding: 28px; text-align: center; color: #8e7e68; }
.result-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.result-card { padding: 13px; text-align: center; background: #21170d; border: 1px solid #5c4021; border-radius: 8px; }
.result-card span { display: block; color: var(--muted); font-size: 13px; }
.result-card strong { color: var(--gold); font-size: 26px; }
.result-layout { display: grid; grid-template-columns: minmax(430px, 1fr) minmax(280px, .65fr); gap: 16px; }
table { width: 100%; border-collapse: collapse; }
th { color: #eabe68; background: #281d12; }
th, td { padding: 9px 10px; border-bottom: 1px solid #3b2b1b; text-align: left; }
.result-table th:not(:first-child), .result-table td:not(:first-child) { text-align: right; }
.insight { padding: 13px; background: #0c0a08; border: 1px solid #3a2918; border-radius: 7px; line-height: 1.7; }
.insight h3 { margin: 0 0 6px; color: var(--gold); font-size: 16px; }
.insight p { margin: 0 0 8px; color: var(--muted); white-space: pre-line; }
.prize-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.prize-toolbar h2 { margin: 0; color: var(--gold); }
.prize-toolbar p { margin: 5px 0 0; color: var(--muted); }
.sample-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 16px 0; }
.sample-field { display: flex; align-items: center; gap: 8px; padding: 8px; background: #0c0a08; border: 1px solid #3b2a19; border-radius: 7px; }
.sample-field label { flex: 1; color: var(--muted); font-size: 13px; }
.sample-field input, .wins-input { width: 82px; padding: 7px; text-align: right; color: #ffe9bd; background: #090806; border: 1px solid #5a4125; border-radius: 5px; }
.pool-tabs { display: flex; gap: 5px; margin-bottom: 9px; }
.pool-tabs button.active { color: #241504; background: var(--gold); font-weight: 800; }
.table-scroll { overflow: auto; border: 1px solid #49341e; border-radius: 7px; }
.prize-table { min-width: 860px; }
.prize-table td:nth-child(3), .prize-table td:nth-child(4) { text-align: center; }
.prize-table td:last-child { color: var(--muted); font-size: 13px; }
.footnote { color: #d9be89; }
.toast { position: fixed; right: 22px; bottom: 22px; padding: 11px 16px; color: #1d1206; background: var(--gold); border-radius: 7px; font-weight: 700; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; box-shadow: 0 8px 25px #0008; }
.toast.show { opacity: 1; transform: none; }
@media (max-width: 900px) {
  body { min-width: 0; }
  .privacy { display: none; }
  .calculator-grid, .result-layout { grid-template-columns: 1fr; }
  .letter-grid { grid-template-columns: repeat(3, 1fr); }
  .sample-fields { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .titlebar { height: 44px; padding: 0 12px; }
  .brand { font-size: 16px; }
  .brand-mark { width: 26px; height: 26px; font-size: 16px; }
  .shell { width: calc(100% - 12px); margin-top: 8px; }
  .main-tabs .tab { flex: 1; min-width: 0; padding: 10px 6px; }
  .page { padding-top: 8px; }
  .input-panel, .image-panel, .prize-panel, .results { padding: 11px; }
  .letter-grid { grid-template-columns: repeat(2, 1fr); }
  .letter-field label { width: 34px; }
  .drop-zone { min-height: 132px; padding: 10px; text-align: center; }
  .desktop-only { display: none; }
  .mobile-only { display: inline; }
  .merge-row { flex-wrap: wrap; gap: 9px; }
  .merge-row .small { margin-left: 0; }
  .previews { grid-template-columns: 1fr; max-height: 330px; }
  .mode-panel { padding: 9px 4px 6px; }
  .mode-panel legend { padding: 0 5px; font-size: 12px; line-height: 1.45; }
  .mode-options { grid-template-columns: .72fr .72fr 1.56fr; }
  .mode-card { min-width: 0; min-height: 76px; padding: 6px 3px; gap: 4px; flex-wrap: wrap; align-content: center; text-align: center; font-size: 13px; line-height: 1.25; }
  .radio-ring { flex: 0 0 auto; width: 16px; height: 16px; }
  .recommended { padding: 3px 5px; font-size: 11px; }
  .action-row { margin: 10px 0; }
  .action-row button { flex: 1; min-width: 0; padding: 11px 6px; }
  .result-cards { grid-template-columns: 1fr 1fr; gap: 7px; }
  .result-card { padding: 9px 4px; }
  .result-card strong { font-size: 23px; }
  th, td { padding: 8px 7px; }
  .result-layout { gap: 10px; }
  .prize-toolbar { align-items: stretch; flex-direction: column; }
  .prize-toolbar .button-row { display: grid; grid-template-columns: 1fr 1fr; }
  .prize-toolbar button { padding: 8px 5px; font-size: 13px; }
  .sample-fields { grid-template-columns: 1fr; }
  .pool-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  .pool-tabs button { min-width: 0; padding: 8px 2px; font-size: 12px; }
  .table-scroll { max-height: 62vh; }
  .prize-table th { position: sticky; top: 0; z-index: 1; }
  .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
}
