/* ═══════════════════════════════════════════════════════════════════════════
   TUNANEPAL · base + components
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4, .display {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: .005em;
}
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--ink-3); }
.small { font-size: var(--t-sm); }
.xs { font-size: var(--t-xs); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

.eyebrow {
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 3px; }

/* ─────────────────────────────────────────────────────── signature: pennant
   Nepal flies the only non-rectangular national flag — two stacked pennants.
   Every status tag in Tunanepal is cut to that silhouette. It is the one
   ornament in the app; everything else stays flat and quiet.               */
.pennant {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 20px 3px 10px;
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--crimson);
  clip-path: polygon(0 0, 100% 0, 74% 50%, 100% 100%, 0 100%);
}
.pennant--indigo   { background: var(--indigo); }
.pennant--marigold { background: var(--marigold); color: #2A1B00; }
.pennant--win      { background: var(--win); }
.pennant--quiet    { background: var(--card-sunk); color: var(--ink-3); }

/* ───────────────────────────────────────────────────────────────── surfaces */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.card--flush { padding: 0; overflow: hidden; }
.card--quiet { background: transparent; box-shadow: none; }

.divider { height: 1px; background: var(--line-soft); border: 0; margin: 14px 0; }

/* ─────────────────────────────────────────────────────────────────── forms */
.field { display: block; margin-bottom: 14px; }
.field > .label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field > .hint { display: block; font-size: var(--t-xs); color: var(--ink-3); margin-top: 5px; }

input[type=text], input[type=tel], input[type=number],
input[type=password], select, textarea {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--body);
  font-size: 16px;               /* 16px keeps iOS from zooming on focus */
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-sk);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input.mono, .field input.mono { font-family: var(--mono); letter-spacing: .03em; }
textarea { min-height: 88px; resize: vertical; font-size: 15px; }
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* segmented choice — used for 1v1/2v2/4v4, gun type, yes/no toggles */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto;
  min-width: 62px;
  padding: 9px 12px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .14s var(--ease);
}
.seg button:hover { border-color: var(--ink-3); }
.seg button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.seg--yn button[aria-pressed="true"] { background: var(--indigo); border-color: var(--indigo); color: #fff; }

/* ────────────────────────────────────────────────────────────────── buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--crimson);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: transform .1s var(--ease), filter .14s, background .14s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }

.btn--ghost   { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-3); filter: none; }
.btn--indigo  { background: var(--indigo); }
.btn--marigold{ background: var(--marigold); color: #2A1B00; }
.btn--win     { background: var(--win); }
.btn--sm      { width: auto; padding: 8px 14px; font-size: 14px; }
.btn--wide    { width: 100%; }

/* ───────────────────────────────────────────────────────────────── feedback */
.alert {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  margin-bottom: 12px;
  border: 1px solid;
}
.alert--bad  { background: var(--crimson-sk); border-color: #F0BEC4; color: var(--crimson-dk); }
.alert--good { background: var(--win-sk); border-color: #B6DEC7; color: var(--win); }
.alert--info { background: var(--indigo-sk); border-color: #C6CFE6; color: var(--indigo); }
[data-theme="dark"] .alert--bad  { border-color: #5A2530; color: #FF8095; }
[data-theme="dark"] .alert--good { border-color: #1F4D33; }
[data-theme="dark"] .alert--info { border-color: #303A5C; }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--card-sunk);
  color: var(--ink-3);
}
.pill--win   { background: var(--win-sk); color: var(--win); }
.pill--wait  { background: var(--marigold-sk); color: #9A6200; }
.pill--bad   { background: var(--crimson-sk); color: var(--crimson-dk); }
.pill--info  { background: var(--indigo-sk); color: var(--indigo); }
[data-theme="dark"] .pill--wait { color: var(--marigold); }
[data-theme="dark"] .pill--bad  { color: var(--crimson); }

.empty { text-align: center; padding: 44px 20px; }
.empty .display { font-size: var(--t-h2); margin-bottom: 4px; }
.empty p { color: var(--ink-3); font-size: var(--t-sm); }

.skeleton {
  background: linear-gradient(90deg, var(--card-sunk), var(--line-soft), var(--card-sunk));
  background-size: 200% 100%;
  border-radius: var(--r);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────────────────────────────────────────────────────────────── avatars */
.avatar {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--card-sunk);
  color: var(--ink-3);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  border: 2px solid var(--crimson);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 94px; height: 94px; font-size: 36px; border-width: 3px; }
.avatar--sm { width: 28px; height: 28px; font-size: 12px; border-width: 1.5px; }

/* ─────────────────────────────────────────────────────────── bottom sheet */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(28, 24, 19, .5);
  backdrop-filter: blur(2px);
  animation: fade .18s ease both;
}
.sheet {
  width: 100%; max-width: var(--shell);
  max-height: 90dvh; overflow-y: auto;
  padding: 20px var(--pad) max(22px, env(safe-area-inset-bottom));
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 3px solid var(--crimson);
  box-shadow: var(--shadow-lg);
  animation: slideUp .26s var(--ease) both;
}
.sheet__grip {
  width: 38px; height: 4px; border-radius: 3px;
  background: var(--line); margin: -8px auto 14px;
}
.sheet h2 { margin-bottom: 3px; }
.sheet .sheet__sub { color: var(--ink-3); font-size: var(--t-sm); margin-bottom: 16px; }

@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }

/* ──────────────────────────────────────────────────────────────── toast */
.toast {
  position: fixed; left: 50%; bottom: 88px;
  transform: translateX(-50%);
  z-index: 90;
  width: calc(100% - 40px); max-width: 340px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s var(--ease) both;
}
.toast--bad  { background: var(--crimson); color: #fff; }
.toast--good { background: var(--win); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ─────────────────────────────────────────────────────── key/value rows */
.kv {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--ink-3); font-size: var(--t-sm); }
.kv > b { color: var(--ink); font-weight: 600; text-align: right; }

.listrow {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.listrow:last-child { border-bottom: 0; }
.listrow b { display: block; color: var(--ink); font-weight: 600; }
.listrow small { display: block; color: var(--ink-3); font-size: var(--t-sm); }

.amount { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.amount--up { color: var(--win); }
.amount--down { color: var(--loss); }
[data-theme="dark"] .amount--down { color: var(--crimson); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ─────────────────────────────────────────────────── auth: link buttons ── */
.linkbtn {
  background: none; border: 0; padding: 0;
  color: var(--indigo); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--crimson); }

/* the 6-digit code field: wide tracking so digits read as separate boxes */
input.otp {
  text-align: center;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: .42em;
  padding-left: .42em;          /* balances the trailing letter-space */
}
