/* 光南大批發 QR 登錄抽獎 — 消費者端樣式（手機優先，320px 起） */
:root {
  --brand-blue: #0870AF;
  --brand-blue-dark: #055482;
  --brand-blue-50: #e8f2f9;
  --brand-yellow: #FFEA00;
  --brand-yellow-soft: #fff8b3;
  --ink: #1b2430;
  --ink-2: #4a5a6a;
  --line: #d5dee7;
  --bg: #ffffff;
  --bg-soft: #f4f7fa;
  --ok: #1a7f37;
  --ok-bg: #e7f6ec;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(8, 40, 70, .08);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg-soft);
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-blue); }
a:hover { color: var(--brand-blue-dark); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; }
p { margin: 0 0 1em; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand-yellow); color: var(--ink); padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

:focus-visible { outline: 3px solid var(--brand-yellow); outline-offset: 2px; box-shadow: 0 0 0 5px var(--brand-blue); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- header / footer ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 4px solid var(--brand-yellow);
}
.site-header .inner {
  max-width: 960px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.site-header .logo img { display: block; height: 44px; width: auto; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  text-decoration: none; color: var(--brand-blue-dark); font-weight: 600; font-size: 15px;
  padding: 6px 10px; border-radius: 8px;
}
.site-nav a[aria-current="page"], .site-nav a:hover { background: var(--brand-blue-50); }

.site-footer {
  margin-top: 40px; background: var(--brand-blue-dark); color: #fff; font-size: 14px;
}
.site-footer .inner { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.site-footer a { color: #fff; }
.site-footer .todo { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- layout ---------- */
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 0 16px; }
main { display: block; padding-top: 20px; }

.card {
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; margin-bottom: 18px; border: 1px solid var(--line);
}
.card-title { font-size: 20px; color: var(--brand-blue-dark); display: flex; align-items: center; gap: 8px; }
.card-title::before {
  content: ""; width: 6px; height: 22px; border-radius: 3px; background: var(--brand-yellow);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

/* ---------- hero ---------- */
.hero {
  background: var(--brand-blue); color: #fff; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -60px; width: 220px; height: 220px;
  border-radius: 50%; background: var(--brand-yellow); opacity: .95;
}
.hero .inner { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 28px 16px 36px; }
.hero .eyebrow {
  display: inline-block; background: var(--brand-yellow); color: var(--ink); font-weight: 700;
  border-radius: 999px; padding: 2px 12px; font-size: 14px; margin-bottom: 12px;
}
.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero .period { font-size: 17px; margin-bottom: 18px; }
.hero-visual {
  margin: 0 0 18px; border: 2px dashed rgba(255,255,255,.6); border-radius: var(--radius);
  min-height: 120px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 12px; font-size: 14px; color: #e6f0f7; max-width: 520px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 12px; border: 2px solid transparent;
  font: inherit; font-weight: 700; font-size: 17px; cursor: pointer; text-decoration: none;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-dark); color: #fff; }
.btn-accent { background: var(--brand-yellow); color: var(--ink); border-color: #e0cd00; }
.btn-accent:hover { background: #ffe100; color: var(--ink); }
.btn-outline { background: #fff; color: var(--brand-blue-dark); border-color: var(--brand-blue); }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row .btn { flex: 1 1 200px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .req { color: var(--err); margin-left: 2px; }
.field .hint { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.input {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit; font-size: 18px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.input:focus { border-color: var(--brand-blue); outline: none; box-shadow: 0 0 0 3px var(--brand-blue-50); }
.input[aria-invalid="true"] { border-color: var(--err); background: #fffafa; }
.input.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.field-error { color: var(--err); font-size: 15px; margin-top: 6px; font-weight: 600; }
.field-error:empty { display: none; }

.check {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px;
  background: var(--bg-soft); border: 2px solid var(--line); cursor: pointer;
}
.check input { width: 24px; height: 24px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--brand-blue); }

/* ---------- serial display ---------- */
.serial-box {
  background: var(--brand-yellow-soft); border: 2px solid var(--brand-yellow); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 18px;
}
.serial-box .label { font-size: 14px; color: var(--ink-2); }
.serial-box .value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 22px; font-weight: 700;
  letter-spacing: .06em; word-break: break-all;
}

/* ---------- alerts / states ---------- */
.alert { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; border-left: 6px solid; }
.alert-info { background: var(--brand-blue-50); border-color: var(--brand-blue); }
.alert-ok { background: var(--ok-bg); border-color: var(--ok); }
.alert-warn { background: var(--warn-bg); border-color: #e0a100; color: #4d3500; }
.alert-err { background: var(--err-bg); border-color: var(--err); color: #5c0f0a; }
.alert h2, .alert h3 { font-size: 18px; margin-bottom: 4px; }
.alert p:last-child { margin-bottom: 0; }

.state { text-align: center; padding: 28px 12px; }
.state .icon {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: flex;
  align-items: center; justify-content: center; font-size: 36px; font-weight: 700;
}
.state.ok .icon { background: var(--ok-bg); color: var(--ok); }
.state.err .icon { background: var(--err-bg); color: var(--err); }
.state.warn .icon { background: var(--warn-bg); color: var(--warn); }

.loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 24px; color: var(--ink-2); }

.todo {
  display: inline-block; background: var(--warn-bg); color: #6b4500; border: 1px dashed #d79a00;
  border-radius: 6px; padding: 0 6px; font-size: .9em; font-weight: 600;
}

/* ---------- definition list ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--ink-2); font-size: 15px; }
.kv dd { margin: 0; font-weight: 700; word-break: break-all; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center;
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.timeline .no {
  background: var(--brand-blue); color: #fff; border-radius: 10px; text-align: center;
  font-weight: 700; padding: 6px 0; font-size: 15px;
}
.timeline .range { font-weight: 700; }
.timeline .draw { font-size: 15px; color: var(--ink-2); }
.timeline li.current { border-color: var(--brand-blue); background: var(--brand-blue-50); }
.timeline li.current .no { background: var(--brand-yellow); color: var(--ink); }
.timeline li.past { opacity: .7; }
.badge {
  display: inline-block; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 1px 10px;
  margin-left: 6px; vertical-align: middle;
}
.badge-now { background: var(--brand-yellow); color: var(--ink); }
.badge-done { background: #e5e9ee; color: var(--ink-2); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 16px; }
table.data th, table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { background: var(--brand-blue-50); color: var(--brand-blue-dark); white-space: nowrap; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tabs [role="tab"] {
  flex: 0 0 auto; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; font: inherit; font-weight: 700; cursor: pointer; color: var(--brand-blue-dark);
}
.tabs [role="tab"][aria-selected="true"] { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 25, 40, .55); display: none;
  align-items: flex-end; justify-content: center; z-index: 50; padding: 0;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 22px 18px;
  max-height: 92vh; overflow-y: auto;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 16px; }
  .modal { border-radius: 18px; }
}

/* ---------- rules ---------- */
.rules h2 { font-size: 20px; color: var(--brand-blue-dark); margin-top: 8px; }
.rules ol, .rules ul { padding-left: 1.3em; }
.rules li { margin-bottom: .4em; }

/* ---------- responsive ---------- */
@media (min-width: 720px) {
  body { font-size: 17px; }
  .hero h1 { font-size: 38px; }
  .hero .inner { padding: 44px 16px 52px; }
  .hero::after { width: 320px; height: 320px; right: -40px; bottom: -120px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .timeline { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .card { padding: 26px 26px; }
}
@media (max-width: 360px) {
  body { font-size: 16px; }
  .site-header .logo img { height: 36px; }
  .site-nav a { padding: 6px 6px; font-size: 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 480px) {
  .site-header .logo img { height: 34px; }
  .site-nav { gap: 0; flex-wrap: nowrap; }
  .site-nav a { padding: 6px 7px; font-size: 14px; white-space: nowrap; }
}
