/* App-specific overrides on top of Johnny's design styles.css.
   The mockup is a fixed 390×844 frame; the app is fluid and scrolls. */
html, body { width: 100%; height: 100%; overflow: hidden; }
body { background: var(--cream-2); overscroll-behavior: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[role="button"], .tab, .play-pick, .chip, .sw, .vgame, .game { cursor: pointer; -webkit-tap-highlight-color: transparent; }

.phone {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
}
@media (min-width: 520px) {
  .phone { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(28,25,22,0.10); }
}
.stripe { margin-top: env(safe-area-inset-top); }
.appbar { padding-top: 18px; }
.appbar.compact { padding-top: 14px; }
.sheet-bar { padding-top: 12px; }
.boot { padding: 40px 20px; color: var(--muted); font-size: 13px; }

.content {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 18px;
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }
.content > * { flex-shrink: 0; }

/* tabs: no fake home indicator, respect the real safe area */
.tabs { height: auto; padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); }
.tab { background: none; border: 0; }
.tab svg path, .tab svg circle { transition: stroke .15s, fill .15s; }
.dock { padding-top: 8px; }
.dock .cta { margin-bottom: 2px; }
.cta:active, .save:active { transform: translateY(1px); }

/* player colours */
.c-red { --pc: var(--red); --pc-soft: var(--red-soft); --pc-ring: rgba(199,53,46,0.14); }
.c-blue { --pc: var(--blue); --pc-soft: var(--blue-soft); --pc-ring: rgba(31,78,140,0.14); }
.c-black { --pc: var(--black); --pc-soft: var(--black-soft); --pc-ring: rgba(36,34,32,0.12); }
.c-amber { --pc: var(--amber); --pc-soft: var(--amber-soft); --pc-ring: rgba(224,145,18,0.18); }
.hero.c-red::before, .hero.c-blue::before, .hero.c-black::before, .hero.c-amber::before { background: var(--pc); }
.hero .kicker { color: var(--pc, var(--blue)); }
.hero .tile { color: var(--pc); }

/* sync pill states */
.sync { transition: opacity .2s; }
.sync.offline .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(199,53,46,0.16); }
.sync.busy .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(224,145,18,0.18); }

.avatars .tile { margin-right: -8px; }
.meta { min-height: 46px; }

/* stand: ranks */
.rank, .hero { width: 100%; }
.rank .placeholder, .hero .placeholder { margin-top: 3px; }
.empty-card {
  background: var(--ivory);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.8);
  text-align: center;
  margin-bottom: 10px;
}
.empty-card .tiles { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.empty-card h3 { font-family: "Fraunces", serif; font-weight: 600; font-size: 20px; letter-spacing: -0.03em; }
.empty-card p { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.45; margin-top: 4px; }

/* erfassen */
.sheet-bar h1 { flex: 1; }
.sheet-bar .spacer { width: 44px; flex-shrink: 0; }
.icon-btn { cursor: pointer; padding: 0; }
.date-row { position: relative; cursor: pointer; }
.date-row input[type="date"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: 0; font-size: 16px;
}
.date-row input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.play-pick { position: relative; }
.play-pick.add { background: transparent; border-style: dashed; box-shadow: none; justify-content: center; color: var(--muted); }
.play-pick.add .plus { width: 28px; height: 36px; display: flex; align-items: center; justify-content: center; }
.play-pick .tile { color: var(--pc); }
.chip { position: relative; }
.chip .tile { color: var(--pc); }
.chip.selected { border-color: var(--pc); box-shadow: 0 0 0 3px var(--pc-ring), var(--shadow-sm); }
.chip.selected .check { background: var(--pc); }
.chips.two .chip { min-height: 92px; }
.chips.three, .chips.four { display: grid; margin-bottom: 14px; }
.chips.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chips.two { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.chips.two .chip, .chips.four .chip {
  flex-direction: column; justify-content: center; text-align: center;
  padding: 10px 6px 8px; min-height: 102px; gap: 5px;
}
.chips.two .chip .who, .chips.four .chip .who { flex: none; }
.chips.two .chip .check, .chips.two .chip .empty-check,
.chips.four .chip .check, .chips.four .chip .empty-check { position: absolute; top: 8px; right: 8px; }
.chips.four .chip .check, .chips.four .chip .empty-check { top: 6px; right: 6px; width: 18px; height: 18px; }
.chips.four .chip .who .name { font-size: 13px; }
.chip .who .name, .loser .who .name, .play-pick .pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.loser .tile { color: var(--pc); }
.step { cursor: pointer; padding: 0; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.step:active { background: var(--line-2); }
.points { display: flex; align-items: baseline; justify-content: center; width: 64px; }
.points input {
  width: 44px; border: 0; background: transparent; outline: none; padding: 0;
  font: inherit; color: inherit; text-align: left; letter-spacing: inherit;
  font-variant-numeric: tabular-nums;
}
.points input:focus { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.pick-hint {
  font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.45;
  background: var(--ivory-2); border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 12px 14px;
}
.note-field {
  margin-top: 12px;
  background: var(--ivory); border-radius: 14px; padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.7); box-shadow: var(--shadow-sm);
}
.note-field label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.note-field input { width: 100%; border: 0; outline: none; background: transparent; font-size: 16px; font-weight: 550; letter-spacing: -0.01em; padding: 2px 0; }
.save:disabled { opacity: .45; box-shadow: none; cursor: default; }
.save-wrap { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.danger-link {
  display: block; width: 100%; margin-top: 16px; padding: 12px; border: 0; background: transparent;
  color: var(--red); font-size: 14px; font-weight: 650;
}

/* verlauf */
.vgames { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.vgame {
  background: var(--ivory); border-radius: 16px; padding: 10px 10px 10px 12px;
  display: flex; align-items: center; gap: 11px; box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.7); min-height: 68px; text-align: left; width: 100%;
}
.vgame .vdate { width: 34px; flex-shrink: 0; text-align: center; }
.vgame .vdate b { display: block; font-family: "Fraunces", serif; font-weight: 600; font-size: 20px; letter-spacing: -0.03em; line-height: 1; }
.vgame .vdate small { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px; }
.vgame .tile { color: var(--pc); }
.vgame .vbody { flex: 1; min-width: 0; }
.vgame .vwin { font-size: 14px; font-weight: 650; letter-spacing: -0.02em; }
.vgame .vsub { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; line-height: 1.35; }
.vgame .vnote { font-size: 11px; color: var(--ink-2); font-style: italic; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vgame .chev { flex-shrink: 0; opacity: .5; }
.month-h { margin-top: 6px; }

/* statistik */
.chart-card .empty { font-size: 12px; color: var(--muted); padding: 18px 0 14px; text-align: center; }
.bar-row .lab { width: auto; min-width: 58px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { width: 46px; }
.game .tile { color: var(--pc); }
.section-h a, .section-h .link { font-size: 11.5px; color: var(--muted-2); font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.kpi .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* spieler */
.prow .tile { color: var(--pc); }
.sw { border: 0; padding: 0; width: 22px; height: 22px; }
.swatches { gap: 8px; }
.sw.on { box-shadow: 0 0 0 2px var(--ivory), 0 0 0 3.5px currentColor; }
.prow.archived { opacity: .7; }
.icon-btn.sm { cursor: pointer; }
.logout { display: block; margin: 18px auto 0; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.app-foot { text-align: center; font-size: 10.5px; color: var(--muted-2); margin-top: 14px; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(28,25,22,0.38); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-width: 480px; background: var(--ivory); border-radius: 22px 22px 0 0;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(28,25,22,0.18);
  animation: up .18s ease-out;
}
.modal h2 { font-family: "Fraunces", serif; font-weight: 600; font-size: 21px; letter-spacing: -0.03em; margin-bottom: 6px; }
.modal p { font-size: 13px; color: var(--ink-2); line-height: 1.45; font-weight: 500; }
.modal .field { margin-top: 12px; }
.modal .field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.modal .field input {
  width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff;
  padding: 0 14px; font-size: 17px; font-weight: 600; outline: none;
}
.modal .field input:focus { border-color: var(--ink); }
.modal .swatches { margin-top: 2px; gap: 12px; }
.modal .sw { width: 30px; height: 30px; }
.modal .actions { display: flex; gap: 8px; margin-top: 18px; }
.modal .actions button {
  flex: 1; height: 50px; border-radius: 14px; border: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.02em;
}
.btn-primary { background: var(--ink); color: #F7F1E6; }
.btn-ghost { background: var(--cream-2); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.modal .err { color: var(--red); font-size: 12px; font-weight: 600; margin-top: 8px; min-height: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px);
  background: var(--ink); color: #F7F1E6; font-size: 13px; font-weight: 600; padding: 10px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 86vw; text-align: center;
  box-shadow: 0 8px 20px rgba(28,25,22,0.22);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* login */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 28px 80px; }
.login .wordmark { font-size: 40px; }
.login .brand-sub { font-size: 13px; margin-top: 8px; }
.login .tiles { display: flex; gap: 6px; margin-bottom: 22px; }
.login form { margin-top: 28px; }
.login input {
  width: 100%; height: 56px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--ivory);
  padding: 0 16px; font-size: 22px; font-weight: 650; letter-spacing: 0.3em; text-align: center; outline: none;
}
.login input:focus { border-color: var(--ink); }
.login .save { margin-top: 12px; }
.login .err { color: var(--red); font-size: 12.5px; font-weight: 600; margin-top: 10px; min-height: 18px; text-align: center; }
.add-link { display: inline-flex; align-items: center; gap: 5px; margin: -8px 0 14px; border: 0; background: none; padding: 4px 2px; font-size: 12px; font-weight: 650; color: var(--muted); }
