:root {
  --saffron: #FF9933;
  --saffron-d: #e07a10;
  --green: #138808;
  --navy: #0b1f5c;
  --bg: #fffaf3;
  --card: #ffffff;
  --ink: #1b1b1f;
  --muted: #5d5f6b;
  --line: #ece4d8;
  --danger: #c62828;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131a;
    --card: #1c1e28;
    --ink: #f2f2f5;
    --muted: #a3a6b4;
    --line: #2c2f3d;
    --navy: #9db2ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
img { max-width: 100%; }

.tricolor { display: flex; height: 5px; position: sticky; top: 0; z-index: 10; }
.tricolor span { flex: 1; }
.tricolor span:nth-child(1) { background: var(--saffron); }
.tricolor span:nth-child(2) { background: #fff; }
.tricolor span:nth-child(3) { background: var(--green); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 560px; margin: 0 auto; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.brand { font-size: 20px; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0; }
.link-btn { background: none; border: 0; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 0; }
.pill { background: var(--saffron); color: #fff; border-radius: 99px; padding: 0 8px; font-size: 13px; margin-left: 4px; }

main { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }

.hero { font-size: clamp(30px, 8vw, 42px); line-height: 1.1; margin: 16px 0 8px; letter-spacing: -0.02em; }
.saffron { color: var(--saffron-d); }
.sub { color: var(--muted); margin: 0 0 24px; }
.fine { color: var(--muted); font-size: 13px; text-align: center; }

.issue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 360px) { .issue-grid { grid-template-columns: 1fr; } }
.issue-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; cursor: pointer; color: var(--ink); font: inherit;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.issue-card:hover, .issue-card:focus-visible { border-color: var(--saffron); box-shadow: 0 6px 20px rgba(255,153,51,.18); outline: none; }
.issue-card:active { transform: scale(.97); }
.issue-card .emoji { font-size: 40px; }
.issue-card .t { font-weight: 800; font-size: 18px; }
.issue-card .d { color: var(--muted); font-size: 13px; line-height: 1.35; }

.how { display: flex; justify-content: space-between; gap: 8px; list-style: none; padding: 0; margin: 28px 0 12px; }
.how li { flex: 1; text-align: center; font-size: 13px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; }
.how b { display: block; color: var(--ink); font-size: 14px; }

/* wizard */
.wiz-head { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.progress { flex: 1; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
#progressBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--saffron), var(--green)); transition: width .3s; }
.step-label { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
h2 { font-size: 24px; margin: 20px 0 8px; letter-spacing: -0.01em; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.label { font-weight: 700; margin: 18px 0 8px; }
.opt { color: var(--muted); font-weight: 400; }

.photo-drop {
  display: grid; place-items: center; min-height: 240px; margin-bottom: 16px;
  border: 2px dashed var(--saffron); border-radius: var(--radius); background: var(--card);
  cursor: pointer; text-align: center; color: var(--muted); overflow: hidden;
}
.photo-drop .big { font-size: 56px; }
.photo-drop img { width: 100%; max-height: 420px; object-fit: cover; }

.field { display: block; font-weight: 700; margin: 14px 0; }
.field input, .field textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; color: var(--ink);
  background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.field input:focus, .field textarea:focus { border-color: var(--saffron); outline: none; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 18px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 15px; padding: 9px 14px; border-radius: 99px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
.chip.on { background: var(--saffron); border-color: var(--saffron); color: #fff; font-weight: 600; }

.btn {
  display: block; width: 100%; text-align: center; text-decoration: none; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 17px; padding: 15px 18px; margin: 10px 0;
  border-radius: 14px; border: 2px solid transparent; background: var(--card); color: var(--ink);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--saffron); color: #fff; box-shadow: 0 6px 18px rgba(255,153,51,.35); }
.btn.primary:hover { background: var(--saffron-d); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.big-loc { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.big-loc { color: #0b1020; } }
.btn.x { background: #000; color: #fff; }
.btn.wa { background: #25D366; color: #fff; }
.btn.mail { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.mail { color: #0b1020; } .btn.x { border-color: #444; } }
.btn.small { font-size: 14px; padding: 9px 12px; margin: 0; width: auto; display: inline-block; }
.step .btn.primary { margin-top: 20px; }

/* result */
.success { text-align: center; margin: 16px 0; }
.success .big { font-size: 56px; }
.success h2 { margin: 4px 0; }
.success p { color: var(--muted); margin: 0; }
.stamped { display: block; border-radius: var(--radius); margin: 16px 0; border: 1px solid var(--line); }
.actions .hint { text-align: center; }
.letter { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
.letter summary { font-weight: 700; cursor: pointer; }
.letter pre { white-space: pre-wrap; word-break: break-word; font: 14px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; margin: 12px 0; max-height: 360px; overflow: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.card h3 { margin: 0 0 4px; }
.portal { display: block; text-decoration: none; color: var(--ink); padding: 10px 0; border-top: 1px solid var(--line); }
.portal b { color: var(--navy); display: block; }
.portal span { color: var(--muted); font-size: 14px; }
.accountability { border-left: 5px solid var(--green); }

/* my complaints */
.scoreboard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.scoreboard div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; }
.scoreboard b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.scoreboard span { font-size: 11px; color: var(--muted); }
.complaint { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--saffron); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.complaint.overdue { border-left-color: var(--danger); }
.complaint.fixed { border-left-color: var(--green); opacity: .85; }
.complaint .row { display: flex; align-items: center; gap: 10px; }
.complaint .btns { margin-top: 10px; flex-wrap: wrap; gap: 8px; }
.complaint .emoji { font-size: 28px; }
.complaint .grow { flex: 1; min-width: 0; }
.complaint .meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 12px; font-weight: 700; white-space: nowrap; }
.overdue .badge { color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* live camera */
.no-scroll { overflow: hidden; }
.camera {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-note {
  position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  margin: 0; padding: 6px 14px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; white-space: nowrap;
}
.cam-bar {
  position: relative; display: flex; justify-content: space-around; align-items: center;
  padding: 24px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, rgba(0,0,0,.7));
}
.cam-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 22px; cursor: pointer; }
.shutter {
  width: 78px; height: 78px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 6px solid var(--saffron); box-shadow: 0 0 0 4px rgba(255,255,255,.5);
}
.shutter:active { transform: scale(.92); }
.error { color: var(--danger); font-weight: 600; font-size: 14px; }
.photo-drop { width: 100%; font: inherit; padding: 0; }

/* official channels */
.official { border: 2px solid var(--saffron); }
.authority + .authority { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.who { margin: 8px 0; }
.who span { color: var(--muted); font-size: 13px; }
.channel {
  display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: var(--ink);
  border: 2px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0;
}
.channel:hover { border-color: var(--saffron); }
.channel.first { border-color: var(--green); background: rgba(19,136,8,.07); }
.channel .ic { font-size: 24px; line-height: 1.2; }
.channel .txt { display: flex; flex-direction: column; min-width: 0; }
.channel .val { color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.channel .tip { color: var(--muted); font-size: 13px; }
h3.section { margin: 24px 0 4px; }

#toast {
  z-index: 60;
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-weight: 600; transition: all .25s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
