[hidden] { display: none !important; }   /* the hidden attribute always wins over component display rules */
/* Mobile first: designed at 320–430px portrait; wider screens only center the same column. */
:root {
  --ink: #102010; --muted: #3d4a3d; --bg: #fffdf5; --card: #ffffff; --line: #c9d3c3;
  --primary: #1b5e20; --primary-ink: #ffffff; --ok: #1b5e20; --warn: #8a4b00; --err: #b00020;
  --radius: 16px; --tap: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.5 -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  overflow-x: hidden; min-height: 100dvh;
}
#app { max-width: 480px; margin: 0 auto; padding: 16px 16px calc(112px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 12px; text-align: center; }
h2 { font-size: 24px; margin: 4px 0 12px; }
p { margin: 0 0 12px; }
.lead { font-size: 20px; text-align: center; color: var(--muted); }
.page[hidden] { display: none; }
.cover { text-align: center; padding-top: 24px; }
.cover-art { font-size: 64px; line-height: 1.3; margin: 16px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); min-width: 44px; padding: 12px 20px; border-radius: var(--radius);
  border: 2px solid var(--primary); background: var(--card); color: var(--primary);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.big { font-size: 22px; min-height: 64px; width: 100%; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 4px solid #ffb300; outline-offset: 2px; }

/* primary actions sit at the bottom: reachable with one thumb */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 75%, rgba(255,253,245,0));
}
.actions > * { max-width: 448px; margin: 0 auto; display: flex; }
.actions .row { display: flex; gap: 12px; }
.actions .row .btn { flex: 1; }

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.topbar .btn { padding: 8px 16px; }
.progress-text { font-weight: 700; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 140px; padding: 12px 8px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; text-align: center; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
.stage-card .emoji { font-size: 48px; line-height: 1; }
.stage-card .name { font-size: 20px; font-weight: 700; }
.stage-card .status { font-size: 15px; color: var(--muted); }
.stage-card.done { border-color: var(--ok); background: #e8f5e9; }
.stage-card.done .status { color: var(--ok); font-weight: 700; }
.stage-card.pending { border-color: var(--warn); background: #fff3e0; }
.stage-card.pending .status { color: var(--warn); font-weight: 700; }
.stage-card img { width: 100%; max-height: 72px; object-fit: cover; border-radius: 10px; }

.stage-hero { text-align: center; font-size: 72px; line-height: 1.1; }
.task { font-size: 20px; text-align: center; }
.pick { display: grid; gap: 12px; margin: 16px 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.preview { margin: 12px 0; text-align: center; }
.preview img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--radius); background: #eee; }
.preview .note { color: var(--muted); font-size: 16px; }
.bar { height: 14px; border-radius: 7px; background: #e0e0e0; overflow: hidden; margin: 8px 0; }
.bar > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.msg { font-weight: 700; padding: 10px 12px; border-radius: 12px; margin: 8px 0; }
.msg.ok { background: #e8f5e9; color: var(--ok); }
.msg.err { background: #fde7ea; color: var(--err); }
.msg.warn { background: #fff3e0; color: var(--warn); }

.banner { position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: #fff3e0; color: var(--warn);
  font-weight: 700; text-align: center; border-bottom: 2px solid var(--warn); }

dialog { border: none; border-radius: var(--radius); padding: 20px; width: min(92vw, 420px); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .row { display: grid; gap: 12px; margin-top: 16px; }

.celebrate { text-align: center; }
.celebrate .party { font-size: 64px; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #eee; }
.photos figcaption { font-size: 15px; }
.phase { font-weight: 700; margin: 8px 0 0; min-height: 1.5em; }
.phase[data-phase="UPLOADED"] { color: var(--ok); }
.phase[data-phase="FAILED"] { color: var(--err); }
.phase[data-phase="UPLOADING"], .phase[data-phase="VERIFYING"] { color: var(--warn); }
.share-box { display: grid; justify-items: center; gap: 10px; }
.share-box .link { width: 100%; font: inherit; font-size: 14px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; }
.center { text-align: center; }
