/* Banka — mobil öncelikli (375 px), güvenli alan, açık/koyu tema */
:root {
  --bg: #f3efe4; --card: #fffdf7; --ink: #1d2a22; --mute: #6b7a70; --line: #e2dccb;
  --brand: #17803f; --brand-2: #0f6b35; --on-brand: #fff; --tint: #e3f1e7;
  --in: #17803f; --out: #c0392b; --warn: #b7791f;
  --shadow: 0 1px 2px rgba(30,40,30,.06), 0 6px 18px rgba(30,40,30,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1511; --card: #17211b; --ink: #e8efe9; --mute: #8da095; --line: #263229;
    --brand: #2fae65; --brand-2: #1f8f4f; --on-brand: #06130b; --tint: #19301f;
    --in: #4cc77f; --out: #ff6b5b; --warn: #e0a64a;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100dvh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- üst çubuk + alt gezinme ---------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg);
}
.top h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; flex: 1; }
.pill { padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--card); box-shadow: var(--shadow); }
.pill.on { background: var(--tint); color: var(--brand); }
.pill.off { background: var(--card); color: var(--warn); }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-size: 20px; line-height: 1; }
main { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
}
nav.tabs button { flex: 1; padding: 8px 4px; border-radius: 12px; font-size: 12px; font-weight: 700; color: var(--mute); display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav.tabs button span { font-size: 22px; line-height: 1.1; }
nav.tabs button.on { color: var(--brand); background: var(--tint); }

/* ---------- ortak ---------- */
.card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; }
.btn { display: block; width: 100%; padding: 15px 18px; border-radius: 16px; font-weight: 800; font-size: 17px; background: var(--brand); color: var(--on-brand); text-align: center; }
.btn:active { background: var(--brand-2); transform: scale(.99); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.btn.danger { background: var(--card); color: var(--out); box-shadow: var(--shadow); }
.btn.small { width: auto; display: inline-block; padding: 9px 14px; font-size: 14px; border-radius: 12px; }
.muted { color: var(--mute); }
.h2 { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin: 18px 4px 8px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.in { color: var(--in); } .out { color: var(--out); }
input.field { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-size: 17px; outline: none; }
input.field:focus { border-color: var(--brand); }
label.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--mute); margin: 12px 2px 6px; }

/* ---------- öde ekranı ---------- */
.seg { display: flex; gap: 6px; background: var(--card); padding: 5px; border-radius: 16px; box-shadow: var(--shadow); }
.seg button { flex: 1; padding: 10px 4px; border-radius: 12px; font-size: 13.5px; font-weight: 800; color: var(--mute); }
.seg button.on { background: var(--brand); color: var(--on-brand); }
.slots { display: flex; align-items: stretch; gap: 8px; margin-top: 12px; }
.slot { flex: 1; min-width: 0; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 11px 12px; text-align: left; border: 2px dashed var(--line); min-height: 76px; display: flex; flex-direction: column; justify-content: center; }
.slot small { font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); }
.slot b { font-size: 17px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .bal { font-size: 13px; color: var(--mute); }
.slot.empty { animation: pulse 1.6s ease-in-out infinite; }
.slot.filled { border: 2px solid var(--brand); background: var(--tint); }
.slot.bank { border: 2px solid var(--line); }
@keyframes pulse { 50% { border-color: var(--brand); } }
.arrow { align-self: center; font-size: 22px; color: var(--mute); }
.amount { text-align: center; font-size: 52px; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 4px; min-height: 64px; }
.amount.zero { color: var(--line); }
.chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; font-size: 14px; }
.chip:active { background: var(--tint); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button { padding: 15px 0; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-size: 24px; font-weight: 700; }
.pad button:active { background: var(--tint); }
.pad .alt { color: var(--mute); font-size: 20px; }

/* ---------- oyuncular + geçmiş ---------- */
.prow { display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; width: 100%; }
.av { width: 44px; height: 44px; border-radius: 50%; background: var(--tint); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 19px; flex: none; }
.prow b { display: block; font-size: 17px; }
.prow small { color: var(--mute); }
.prow .money { font-weight: 800; font-size: 18px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--brand); }
.tag.warn { background: transparent; color: var(--warn); padding: 0; }
.tx { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: 0; }
.tx.undone { opacity: .45; text-decoration: line-through; }
.tx .amt { font-weight: 800; }
.empty-note { text-align: center; color: var(--mute); padding: 26px 10px; }

/* ---------- açılış + oyuncu ekranı ---------- */
.welcome { max-width: 420px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top)) 20px 40px; text-align: center; }
.welcome img { width: 96px; height: 96px; border-radius: 24px; box-shadow: var(--shadow); }
.welcome h1 { font-size: 30px; margin: 16px 0 4px; letter-spacing: -.02em; }
.player { min-height: 100dvh; max-width: 520px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 16px 30px; transition: background .5s; }
.hero { text-align: center; padding: 34px 16px 28px; background: var(--brand); color: var(--on-brand); border-radius: 26px; box-shadow: var(--shadow); transition: background .4s; }
.hero .who { font-size: 17px; font-weight: 700; opacity: .85; }
.hero .big { font-size: 60px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 0; }
.hero.up { background: #12a150; } .hero.down { background: #b8372a; }
.hero small { opacity: .8; }

/* ---------- alt panel (sheet) + toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(10,15,12,.5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.sheet h3 { margin: 0 0 12px; font-size: 20px; }
.qr { background: #fff; border-radius: 16px; padding: 12px; width: 220px; margin: 8px auto; }
.qr svg { width: 100%; height: auto; display: block; }
.linkbox { font-size: 12.5px; word-break: break-all; padding: 10px 12px; background: var(--card); border-radius: 12px; color: var(--mute); }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(40px); opacity: 0 } }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 30; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--out); color: #fff; }
.success { text-align: center; padding: 10px 0; }
.success .tick { font-size: 64px; }
