/* SPDX-License-Identifier: Apache-2.0
 * Copyright 2026 CLSOFTLAB (씨엘소프트랩), Dr. Lee Il-guk (이일국)
 * Mobile-first (360px), big tap targets (48px), light/dark, high contrast. */

:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f2;
  --fg: #14201e;
  --muted: #566;
  --muted-2: #7a8a88;
  --accent: #0f766e;
  --accent-fg: #ffffff;
  --accent-weak: #d9efeb;
  --ok: #0f766e;
  --ok-bg: #d9efeb;
  --off: #8a5a00;
  --off-bg: #fbeccd;
  --pend: #1e40af;
  --pend-bg: #dbe4ff;
  --danger: #b42318;
  --warn-bg: #fff4e5;
  --warn-bd: #f4c37a;
  --demo-bg: #eef2ff;
  --demo-bd: #b9c4ff;
  --border: #d8e0df;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.05);
  --radius: 14px;
  --tap: 48px;
  --maxw: 560px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1413;
    --surface: #14201e;
    --surface-2: #1c2b28;
    --fg: #e8f0ee;
    --muted: #a9b8b5;
    --muted-2: #859894;
    --accent: #2dd4bf;
    --accent-fg: #06231f;
    --accent-weak: #123c37;
    --ok: #5eead4;
    --ok-bg: #123c37;
    --off: #f0c27a;
    --off-bg: #3a2c12;
    --pend: #a9c0ff;
    --pend-bg: #1c2748;
    --danger: #ff7a70;
    --warn-bg: #2e2413;
    --warn-bd: #6b551f;
    --demo-bg: #171d33;
    --demo-bd: #333f6b;
    --border: #2a3a37;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}
img {
  max-width: 100%;
  display: block;
}
[hidden] {
  display: none !important;
}
h1 {
  font-size: 1.5rem;
  margin: 0.2em 0 0.4em;
}
h2 {
  font-size: 1.15rem;
  margin: 1.1em 0 0.4em;
}
a {
  color: var(--accent);
}
button {
  font: inherit;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 50;
}

/* topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.brand.big {
  font-size: 1.2rem;
  justify-content: center;
}
.brandmark {
  font-size: 1.3rem;
}
.brandname {
  letter-spacing: -0.01em;
}
.langtoggle {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

main {
  padding: 16px;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
main:focus {
  outline: none;
}

/* bottom nav */
.bottomnav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--maxw);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.navbtn {
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.7rem;
}
.navbtn.active {
  color: var(--accent);
  font-weight: 700;
}
.navbtn.active .navico {
  transform: translateY(-1px) scale(1.08);
}
.navico {
  font-size: 1.25rem;
  line-height: 1;
}

/* cards, buttons */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn.ghost {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn.big {
  font-size: 1.05rem;
}
.btn.small {
  min-height: 40px;
  font-size: 0.9rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.camctrls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.camctrls .btn {
  width: auto;
  flex: 1 1 auto;
}

/* banners & notes */
.banner {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 0.92rem;
  border: 1px solid var(--border);
}
.banner.warn {
  background: var(--warn-bg);
  border-color: var(--warn-bd);
}
.banner.demo {
  background: var(--demo-bg);
  border-color: var(--demo-bd);
}
.note {
  color: var(--muted);
  margin: 8px 0;
}
.note.small,
.small {
  font-size: 0.85rem;
}
.muted {
  color: var(--muted);
}
.center {
  text-align: center;
}
.loading,
.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}

/* onboarding */
.onboarding {
  padding-bottom: 40px;
}
.hero {
  text-align: center;
  padding: 20px 8px 4px;
}
.hero h1 {
  font-size: 1.7rem;
}
.lead {
  font-size: 1.1rem;
  font-weight: 600;
}
.roles {
  display: grid;
  gap: 10px;
}
fieldset {
  border: none;
  padding: 0;
  margin: 0 0 14px;
}
legend {
  font-weight: 700;
  margin-bottom: 8px;
  padding: 0;
}
.rolecard {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-height: var(--tap);
  cursor: pointer;
  background: var(--surface);
}
.rolecard:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-weak);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.rolecard input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}
.rolecard-body {
  display: flex;
  flex-direction: column;
}
.privacybox {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}

/* forms */
.field {
  margin: 12px 0;
}
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}
textarea {
  min-height: 90px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* segment control */
.segment {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.segment button {
  min-height: 40px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.segment button.on {
  background: var(--accent);
  color: var(--accent-fg);
}
.rowhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* mission list */
.missionlist,
.claimlist,
.sublist,
.ledger {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.missioncard {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-decoration: none;
  color: var(--fg);
  box-shadow: var(--shadow);
}
.missioncard.dim {
  opacity: 0.62;
}
.thumb {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
  flex: 0 0 auto;
}
.thumb.sm {
  width: 48px;
  height: 48px;
}
.mc-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.mc-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.idxpin {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.mc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.reward {
  color: var(--accent);
  font-weight: 800;
}
.reward.big {
  font-size: 1.5rem;
}
.dot {
  color: var(--muted-2);
}
.statuschip {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.statuschip.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.statuschip.off {
  background: var(--off-bg);
  color: var(--off);
}
.statuschip.pend {
  background: var(--pend-bg);
  color: var(--pend);
}

/* radar */
.radarwrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin: 10px 0;
}
#radar {
  width: 100%;
  height: 240px;
  display: block;
}

/* detail */
.back {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  text-decoration: none;
  font-weight: 600;
}
.refbig {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.reflabel {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 4px 0 0;
}
.rewardline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.facts {
  display: grid;
  gap: 0;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.facts.small {
  font-size: 0.9rem;
}
.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.facts > div:last-child {
  border-bottom: none;
}
.facts dt {
  color: var(--muted);
  margin: 0;
}
.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* camera */
.camstage {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.camview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camplaceholder {
  color: #cbd5e1;
  text-align: center;
  padding: 20px;
}
.camplaceholder span {
  font-size: 2.4rem;
}
.reviewpair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}
.reviewpair figure {
  margin: 0;
}
.reviewpair img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.reviewpair figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

/* result */
.resulthead {
  text-align: center;
  padding: 18px 10px;
  border-radius: var(--radius);
  margin: 6px 0 10px;
}
.resulthead.pass {
  background: var(--ok-bg);
}
.resulthead.uncertain {
  background: var(--pend-bg);
}
.resulthead.fail {
  background: var(--off-bg);
}
.bigicon {
  font-size: 3rem;
}
.chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.reasons {
  padding-left: 20px;
}
.reasons li {
  margin: 6px 0;
}

/* wallet */
.walletcards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.wcard .big {
  font-size: 1.4rem;
}
.claimrow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.cr-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.ledger li {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.amt.pos {
  color: var(--accent);
  font-weight: 700;
}
.amt.neg {
  color: var(--off);
  font-weight: 700;
}

/* poster */
.subcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.subcard .reviewpair {
  grid-template-columns: 1fr;
}
.countpill {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.8rem;
  vertical-align: middle;
}
.refprev {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.escrowline {
  font-size: 1rem;
}

/* toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: #14201e;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 90%;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
@media (min-width: 420px) {
  .navbtn {
    font-size: 0.78rem;
  }
}
