html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  --ca-green: #018a3d;
  --cream: #f1e89d;
  --cue-gold: #f3b532;
  --ball-red: #e62a19;
  --ball-yellow: #fad61d;
  --ivory: #f0f2b0;
  --navy: #121620;
  --header-green: #14462d;
  --frame-gold: #d3ae37;
  --sans: "Noto Sans TC", "Noto Sans", "Noto Sans CJK TC", sans-serif;
  --space: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ivory);
  color: var(--navy);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

button, input, textarea, select { font: inherit; color: inherit; font-size: 16px; }

.top { background: var(--navy); }

.brand-lockup {
  max-width: 32rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space);
  padding: var(--space);
}

.brand-icon { height: 48px; width: auto; display: block; }
.brand-word { height: 28px; width: auto; display: block; }

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) calc(128px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

body:has(#tabs[hidden]) main { padding-bottom: 32px; }

.tabs {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(32rem, 100%);
  background: var(--navy);
  border-top: 2px solid var(--frame-gold);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs[hidden] { display: none !important; }

.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cream);
  min-height: 52px;
  cursor: pointer;
}

.tabs button[aria-current="true"] {
  background: var(--header-green);
  color: var(--cream);
}

.master-wrap { display: flex; justify-content: center; margin: 8px 0 16px; }
.brand-master { width: 168px; height: auto; display: block; }

h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0;
}

.sub { margin: 4px 0 0; color: var(--header-green); font-weight: 600; }
.quiet { color: var(--header-green); font-size: 0.92rem; }
.screen-kicker {
  margin: 0 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--header-green);
}

.card, .balance, .row, .split {
  border: 1px solid var(--frame-gold);
  border-radius: 12px;
  background: var(--ivory);
}

.balance { padding: 16px; margin: 16px 0; }
.balance .label { font-size: 0.85rem; color: var(--header-green); }
.balance .figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.balance .amount { font-size: clamp(1.5rem, 8vw, 1.8rem); font-weight: 700; line-height: 1.1; }
.balance-total { margin: 12px 0 0; }
.balance .hint { margin: 10px 0 0; font-size: 0.85rem; }

.banner {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--frame-gold);
  background: var(--cream);
  margin: 12px 0;
}

.banner.error {
  border-color: var(--ball-red);
  background: var(--ivory);
  color: var(--ball-red);
}

.packages { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.packages button, .btn {
  appearance: none;
  border-radius: 12px;
  min-height: 48px;
  cursor: pointer;
}

.packages button {
  flex: 1 1 30%;
  border: 1px solid var(--frame-gold);
  background: var(--ivory);
  font-weight: 600;
}

.packages button[aria-pressed="true"] {
  border: 2px solid var(--ca-green);
  background: var(--cream);
}

.btn {
  width: 100%;
  border: 0;
  background: var(--ca-green);
  color: var(--cream);
  font-weight: 700;
  padding: 12px 16px;
}

.btn.secondary {
  background: transparent;
  color: var(--ca-green);
  border: 1px solid var(--ca-green);
}

.btn.danger {
  background: var(--ball-red);
  color: var(--cream);
}

.btn:disabled, .btn.is-disabled, .packages button:disabled, input:disabled, textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; align-items: flex-start; }
.row .grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill.pending { background: var(--ball-yellow); color: var(--navy); }
.pill.confirmed { background: var(--ca-green); color: var(--cream); }
.pill.rejected { background: var(--ball-red); color: var(--cream); }

.thumb {
  width: 44px;
  height: 56px;
  border: 1px solid var(--frame-gold);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  text-align: center;
  flex: none;
  color: var(--header-green);
  text-decoration: none;
  background: var(--ivory);
}

.split { margin-top: 8px; padding: 8px 10px; }
.line { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; margin-top: 4px; }
.line strong { font-weight: 700; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="tel"], input[type="text"], input[type="password"], textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--frame-gold);
  background: var(--ivory);
}

textarea { min-height: 72px; }

.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { width: auto; min-height: 0; margin-top: 4px; }

.links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
a { color: var(--ca-green); }

details { margin-top: 16px; font-size: 0.85rem; }
details summary { cursor: pointer; color: var(--header-green); }

.file { position: relative; display: block; width: 100%; }
.file .btn { display: grid; place-items: center; width: 100%; }
.file input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 48px;
  opacity: 0;
  cursor: pointer;
}
.file .btn { pointer-events: none; }
.preview-flag {
  background: var(--navy);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 1rem;
  line-height: 1.45;
}

.account-line { margin: 8px 0 0; font-size: 0.92rem; }
.wallet-identity {
  display: grid;
  gap: 6px;
  margin: 12px 0 8px;
  padding: 12px;
  border: 1px solid var(--frame-gold);
  border-radius: 12px;
  background: var(--ivory);
}
.identity-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-size: 16px;
}
.identity-line strong { font-size: 1.25rem; font-weight: 700; }
.terms-text { margin: 16px 0; }
.terms-pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
}
.noscript { padding: 16px; }
.section-title { margin: 20px 0 8px; font-size: 1rem; }
.amount-pos { color: var(--ca-green); font-weight: 700; }
.amount-neg { color: var(--ball-red); font-weight: 700; }
.text-btn {
  border: 0;
  background: transparent;
  color: var(--ca-green);
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}
.session-photo {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 12px;
  border: 1px solid var(--frame-gold);
  border-radius: 12px;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.actions .btn { width: auto; flex: 1; }

:focus-visible { outline: 3px solid var(--cue-gold); outline-offset: 2px; }
