/* Grundlayout, Buttons, Sheets, Toast, Statistik-Kacheln */
:root { --col: 480px; }
@media (min-width: 1000px) and (min-height: 700px) { :root { --col: 600px; } } /* Desktop: breitere Spalte */
@media (pointer: coarse) and (min-width: 600px) { :root { --col: 100vw; } } /* Tablet: ganze Breite, keine leeren Ränder */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
  transition: background .4s;
}
.app {
  max-width: var(--col); height: 100%; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--felt1);
  padding: max(12px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  transition: background .4s;
}

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo { font-weight: 800; letter-spacing: .5px; font-size: 15px; }
.logo span { color: var(--accent); }
.bank { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bank small { color: var(--muted); font-weight: 600; margin-right: 4px; }
/* Knöpfe rechts in der Kopfzeile, Menü „⋯“ klappt darunter auf (js/render.js) */
.topbtns { position: relative; display: flex; gap: 6px; align-items: center; flex: none; }
.topmenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; min-width: 170px; background: var(--bg); border: 1px solid var(--line-strong); box-shadow: 6px 6px 0 #000; }
.topmenu[hidden] { display: none; }
.topmenu button { text-align: left; padding: 12px 14px; min-height: 44px; background: none; border: 0; color: var(--text); font: 600 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
.topmenu button + button { border-top: 1px solid var(--line); }
.topmenu button:hover { background: var(--surface); }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; cursor: pointer; }

.row { display: flex; gap: 10px; }
.btn {
  flex: 1; height: 54px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform .18s cubic-bezier(.3,1.6,.5,1), opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .3; cursor: default; }
.btn.primary { background: var(--accent); color: #0b0b12; border-color: transparent; }
.btn.hint { box-shadow: 0 0 0 3px #ffd34d; }
.btn small { display: block; font-size: 11px; font-weight: 600; opacity: .6; margin-top: 1px; }

/* Toast */
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: #000000cc; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }

/* Sheets */
.sheet-bg { position: fixed; inset: 0; background: #0009; display: none; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-bg.open { display: flex; }
.sheet { width: 100%; max-width: var(--col); background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); animation: up .25s ease; }
@keyframes up { from { transform: translateY(100%); } }
.sheet h2 { margin: 0 0 14px; font-size: 20px; }
.sheet h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
[hidden] { display: none !important; }

.about { width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.about span { color: var(--muted); }
.log { max-height: 55vh; overflow-y: auto; }
.log .ver { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.log .ver b { font-size: 16px; }
.log .ver small { color: var(--muted); font-size: 12px; }
.log ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.5; font-size: 14px; }
.log .new { color: var(--text); }

/* Gewinnchance-Anzeige (beide Spiele) */
.odds { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.odds .bar { width: 64px; height: 6px; border-radius: 3px; background: #ffffff22; overflow: hidden; }
.odds .bar i { display: block; height: 100%; background: #22a55b; transition: width .3s; }
.odds b { color: var(--text); }
.odds-sub { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Gute Werte in „gut“-Farbe, schlechte in „schlecht“-Farbe (Einstellungen → Farben) */
.stat.good b { color: var(--good); }
.stat.bad b { color: var(--bad); }
.csets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cset { display: flex; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; text-align: left; }
.cset.sel { border-color: var(--text); }
.cset i { width: 14px; height: 14px; flex: none; }
.cpick { display: flex; gap: 10px; margin-top: 8px; }
.cpick label { flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cpick input { width: 36px; height: 26px; border: none; padding: 0; background: none; cursor: pointer; }
.sheet { max-height: 92vh; overflow-y: auto; }

/* Aufgeräumte Einstellungen: Gruppen-Karten, Schalter statt Häkchen */
.setsheet { display: flex; flex-direction: column; gap: 12px; }
.sethead { display: flex; align-items: center; justify-content: space-between; }
.sethead h2 { margin: 0 !important; }
.setgroup { border: 1px solid var(--line); background: var(--surface); padding: 4px 14px 10px; }
.setgroup h3 { margin: 10px 0 4px !important; font-family: var(--mono); font-weight: 500; font-size: 11px !important; letter-spacing: .14em !important; color: var(--faint) !important; }
.setgroup .toggle { font-family: 'Inter', system-ui, sans-serif; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 500; padding: 11px 0; }
.setgroup .toggle:last-child { border-bottom: none; }
.setgroup .about span { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.setgroup .csets { margin-top: 6px; }
.switch { appearance: none; -webkit-appearance: none; width: 42px !important; height: 24px !important; margin: 0; position: relative; background: var(--sunken); border: 1px solid var(--line-strong); cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: var(--muted); transition: transform .25s cubic-bezier(.3,1.6,.5,1), background .2s; }
.switch:checked { background: var(--accent-fill); border-color: var(--accent-fill); }
.switch:checked::after { transform: translateX(18px); background: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.devgate { display: flex; gap: 8px; margin: 10px 0; } .devgate .field { flex: 1; } .devgate .btn { flex: 0 0 80px; height: 46px; }
/* Keine Scrollbalken in der ganzen App, Scrollen geht weiter */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
