/* ================================================================
   GameCoins – Pokertisch-Look, Mobile First
   ================================================================ */

:root {
  --felt-dark: #0c3b2e;
  --felt: #14523f;
  --felt-light: #1c6b52;
  --gold: #f2c14e;
  --gold-deep: #d9a02b;
  --cream: #fdf6e3;
  --ink: #23312c;
  --card: #ffffff;
  --muted: #6b7f77;
  --red: #e05252;
  --green: #3fa66a;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Avenir Next', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%)
    fixed var(--felt-dark);
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 12px) 16px calc(env(safe-area-inset-bottom) + 90px);
  min-height: 100vh;
}

h1, h2, h3 { font-weight: 800; margin: 0; }

button {
  font: inherit;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, select {
  font: inherit;
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 2px solid #d8dedb;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--gold-deep); }

/* ---------------- Kopfbereich ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px 18px;
}
.topbar .brand {
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,.35);
  flex: 1;
}
.topbar .who {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--cream);
  padding: 7px 14px 7px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
}
.topbar .who .avatar { font-size: 1.25rem; }

/* ---------------- Karten & Listen ---------------- */

.card {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 {
  font-size: 1.02rem;
  margin-bottom: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eef1ef;
}
.list-row:last-child { border-bottom: none; }
.list-row .emoji { font-size: 1.7rem; width: 40px; text-align: center; flex-shrink: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; }
.list-row .sub { font-size: .82rem; color: var(--muted); }

/* ---------------- Buttons ---------------- */

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
  background: var(--gold);
  color: #4a3608;
  box-shadow: 0 4px 0 var(--gold-deep), 0 8px 18px rgba(0,0,0,.25);
  transition: transform .06s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-deep); }
.btn.secondary {
  background: rgba(255,255,255,.14);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: none;
}
.btn.danger { background: var(--red); color: #fff; box-shadow: 0 4px 0 #b13d3d; }
.btn.small { width: auto; padding: 9px 16px; font-size: .9rem; border-radius: 11px; }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border: 2px solid #d8dedb;
}
.btn + .btn { margin-top: 10px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  background: #eef1ef;
  color: var(--ink);
}
.icon-btn.yes { background: var(--green); color: #fff; }
.icon-btn.no  { background: var(--red); color: #fff; }

/* ---------------- Pokerchip ---------------- */

.chip {
  --chip-color: var(--red);
  --chip-size: 64px;
  width: var(--chip-size);
  height: var(--chip-size);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 50% 42%, #fff2 0 18%, transparent 19%),
    repeating-conic-gradient(var(--chip-color) 0 20deg, #fdf6e3 20deg 40deg);
  box-shadow: inset 0 0 0 calc(var(--chip-size) * .14) var(--chip-color),
              0 3px 8px rgba(0,0,0,.35);
  display: grid;
  place-items: center;
}
.chip::after {
  content: '';
  position: absolute;
  inset: calc(var(--chip-size) * .17);
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.85);
  background: var(--chip-color);
}
.chip .value {
  position: relative;
  z-index: 1;
  color: #fff;
  font-weight: 900;
  font-size: calc(var(--chip-size) * .34);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* Wallet: großer Chip-Stapel */
.wallet {
  text-align: center;
  padding: 26px 18px 22px;
}
.wallet .stack {
  position: relative;
  height: 150px;
  margin: 0 auto 6px;
  width: 130px;
}
.wallet .stack .chip {
  --chip-size: 110px;
  position: absolute;
  left: 10px;
}
.wallet .balance-num {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.1;
}
.wallet .balance-label { color: var(--muted); font-weight: 600; }
.pop { animation: pop .45s ease; }
@keyframes pop {
  0% { transform: scale(.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ---------------- Profilwahl ---------------- */

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.profile-tile {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 12px 16px;
  text-align: center;
  transition: transform .08s ease;
}
.profile-tile:active { transform: scale(.96); }
.profile-tile .avatar { font-size: 3rem; display: block; margin-bottom: 8px; }
.profile-tile .name { font-weight: 800; font-size: 1.05rem; }
.profile-tile .role { font-size: .78rem; color: var(--muted); margin-top: 3px; }

.hero {
  text-align: center;
  padding: 34px 10px 26px;
}
.hero .logo-chip { margin: 0 auto 16px; --chip-size: 96px; --chip-color: var(--gold-deep); }
.hero h1 { font-size: 1.7rem; color: var(--cream); text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.hero p { color: rgba(253,246,227,.75); margin: 8px 0 0; }

/* ---------------- Timer ---------------- */

.timer-card {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(160deg, #1f2a26, #101815);
  color: var(--cream);
}
.timer-card .time {
  font-size: 3.4rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  margin: 8px 0 4px;
}
.timer-card.expired .time { color: var(--red); }
.timer-card .meta { color: rgba(253,246,227,.6); font-size: .9rem; }
.timer-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  margin: 18px 0 20px;
}
.timer-bar > div {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
  transition: width 1s linear;
}
.timer-card.expired .timer-bar > div { background: var(--red); }

/* ---------------- Stepper (Einlösen) ---------------- */

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 16px 0;
}
.stepper button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: 1.7rem;
  font-weight: 900;
  background: #eef1ef;
  color: var(--ink);
}
.stepper .count { font-size: 2.6rem; font-weight: 900; min-width: 70px; text-align: center; }
.redeem-minutes {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---------------- Verlauf ---------------- */

.ledger-delta { font-weight: 900; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ledger-delta.plus { color: var(--green); }
.ledger-delta.minus { color: var(--red); }

/* ---------------- Tab-Leiste (Eltern) & Navigation ---------------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: rgba(10, 30, 24, .92);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  z-index: 20;
}
.tabbar button {
  flex: 1;
  background: none;
  color: rgba(253,246,227,.55);
  font-size: .72rem;
  font-weight: 700;
  padding: 7px 2px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.tabbar button .ico { font-size: 1.45rem; }
.tabbar button.active { color: var(--gold); background: rgba(242,193,78,.12); }

.badge {
  background: var(--red);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------------- Modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: grid;
  place-items: end center;
  z-index: 50;
}
.modal {
  background: var(--card);
  color: var(--ink);
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 22px);
  animation: slideup .22s ease;
  max-height: 88vh;
  overflow-y: auto;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .5; } }
.modal h3 { font-size: 1.2rem; margin-bottom: 16px; }
.modal label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }

.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emoji-row button {
  font-size: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #eef1ef;
  border: 2px solid transparent;
}
.emoji-row button.sel { border-color: var(--gold-deep); background: #fdf2d7; }

.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-row button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
}
.color-row button.sel { border-color: var(--ink); }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%);
  background: #16211d;
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
.toast.error { background: var(--red); color: #fff; }

/* ---------------- PIN-Feld ---------------- */

.pin-input {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: .5em;
  font-weight: 900;
}

.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 18px 8px;
  font-size: .92rem;
}

.section-back {
  background: none;
  color: rgba(253,246,227,.8);
  font-weight: 700;
  padding: 4px 0 14px;
  font-size: .95rem;
}
