/* ============================
   Spielzettel – optimized styles.css
   ============================ */

:root{
  color-scheme: dark;

  --bg:#0b1220;
  --text:#eef3ff;
  --muted:#a9b4d6;
  --line:rgba(255,255,255,.10);

  --primary:#2f6bff;
  --danger:#ff3b5c;

  --shadow:0 12px 30px rgba(0,0,0,.35);
  --r:18px;

  --contentMax: 900px;
}

@media (min-width:1200px){ :root{ --contentMax: 1100px; } }
@media (min-width:1600px){ :root{ --contentMax: 1240px; } }

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 30% 0%, rgba(47,107,255,.25), transparent 50%),
    radial-gradient(900px 600px at 100% 30%, rgba(255,59,92,.18), transparent 50%),
    var(--bg);
}

.app--spielzettel{ gap:0; background:transparent; }

/* Topbar */
.topbar{
  position:sticky;
  top:0;
  z-index:80;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display:flex;
  align-items:center;
  gap:12px;

  background:linear-gradient(to bottom, rgba(11,18,32,.92), rgba(11,18,32,.55));
  backdrop-filter: blur(14px);
  border-bottom:1px solid rgba(255,255,255,.08);
}

.brand{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.brand__logo{
  width:30px;
  height:30px;
  border-radius:10px;
  box-shadow:0 8px 20px rgba(0,0,0,.25);
}
.brand__title{
  font-size:20px;
  font-weight:950;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.langSelect{
  height:40px;
  border-radius:16px;
  padding:0 12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-weight:900;
}

/* Tabs */
.tabs{
  position:sticky;
  top:0;
  z-index:70;

  width:calc(100% - 24px);
  max-width: var(--contentMax);
  margin: 0 auto;
  padding: 10px;

  display:flex;
  gap:10px;

  border-radius: 22px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.18);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);

  transform: translateY(-6px);
}
.tabs[hidden]{display:none}

.tab{
  flex:1; min-width:0;
  height:46px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  color:rgba(255,255,255,.86);
  font-weight:950;
  font-size:16px;
  cursor:pointer;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tab--active{
  background:linear-gradient(180deg, rgba(47,107,255,.95), rgba(47,107,255,.70));
  border-color:rgba(47,107,255,.35);
  color:var(--text);
  box-shadow:0 10px 22px rgba(47,107,255,.10);
}

/* Single scroll container */
#appRoot > .main{
  flex:1;
  min-height:0;
  overflow:hidden;     /* main does NOT scroll */
  padding:0;
}

.contentScroll{
  flex:1;
  min-height:0;
  overflow:auto;       /* this scrolls */
  -webkit-overflow-scrolling: touch;

  /* IMPORTANT: remove keyboard padding to eliminate the visible gap on iOS Safari */
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom) + var(--kbd, 0px));
}

/* Center the whole content column consistently */
.tabShell{
  width:100%;
  display:flex;
  justify-content:center;
}

.tab-content{
  width:100%;
  max-width: var(--contentMax);
  margin:0 auto;
  padding:16px;
}
@media (max-width: 980px){ .tab-content{ padding:12px; } }

.screen{ display:none; }
.screen--active{
  display:flex;
  flex-direction:column;
  gap:12px;
}

/* Start */
#screenStart.screen--active{
  align-items:center;
  justify-content:center;
  min-height: calc(100dvh - 220px);
}
.hero{
  border-radius:22px;
  overflow:hidden;
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  background:rgba(255,255,255,.02);
  width:100%;
  max-width: var(--contentMax);
  margin:0 auto;
}
.hero__img{
  width:100%;
  height: min(38vh, 360px);
  object-fit:contain;
  background:rgba(255,255,255,.04);
  display:block;
}
.startActions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  width:100%;
  max-width: var(--contentMax);
  margin:0 auto;
}
.langSelect--start{height:48px}

/* Cards */
.card{
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  width:100%;
}
.card--tight{ padding:10px; gap:10px; }
.card--results{ padding:12px; }

/* Intro text (Players) */
.sectionIntro{
  color:rgba(255,255,255,.80);
  font-weight:850;
  padding:10px 12px;
  border-radius:14px;
  border:1px dashed rgba(255,255,255,.14);
  background:rgba(0,0,0,.10);
}

/* Buttons */
.btn{
  border-radius:14px;
  border:1px solid var(--line);
  padding:10px 12px;
  font-weight:800;
  color:var(--text);
  background:rgba(255,255,255,.04);
  cursor:pointer;
}
.btn--primary{
  background:linear-gradient(180deg, rgba(47,107,255,1), rgba(47,107,255,.78));
  border-color:rgba(47,107,255,.35);
}
.btn--ghost{ background:rgba(255,255,255,.02); }
.btn--xl{ padding:14px 18px; font-size:16px; border-radius:16px; }
.btn--wide{ min-width: 140px; }

@media (max-width: 520px){
  .btn--wide{ min-width: 0; flex:1; }
}

/* Toolbar */
.toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.toolbar__spacer{ flex:1; min-width:12px; }
.toolbar--bottom{
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.toolbar--nice{
  padding: 10px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.14);
  backdrop-filter: blur(10px);
}
.toolbar__group{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.toolbar__group--right{
  margin-left:auto;
}

/* Selects: same size & style */
.selectLabel{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  color:rgba(255,255,255,.86);
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  border-radius:999px;
  padding:8px 10px;
}
.selectLabel--nice{
  height: 46px;
  padding: 0 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.03);
}
.selectControl{
  border:0;
  background:transparent;
  color:var(--text);
  font-weight:900;
  outline:none;
  font-size:16px !important;
  min-width: 150px;
}
@media (max-width: 520px){
  .selectControl{ min-width: 120px; }
}

/* Players */
.players{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-top:4px;
  width:100%;
}
.playerRow{
  display:grid;
  grid-template-columns: 84px minmax(0, 1fr);
  grid-template-rows:auto auto;
  gap:14px;
  align-items:stretch;
  padding:14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
}
.avatarBtn{
  width:72px;
  height:72px;
  border-radius:18px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  overflow:hidden;
  display:grid;
  place-items:center;
  box-shadow:0 10px 25px rgba(0,0,0,.18);
  cursor:pointer;
  grid-column:1;
  grid-row:1 / span 2;
  position:relative;
}
.avatarBtn__img{width:100%;height:100%;object-fit:cover;display:block}
.avatarBtn__txt{font-weight:950;color:var(--text);opacity:.9}

.playerNameInput{
  min-width:0;
  width:100% !important;
  height:56px !important;
  font-size:18px !important;
  padding:0 14px !important;
  border-radius:16px !important;
  border:1px solid var(--line);
  background:rgba(0,0,0,.14);
  outline:none;
  color:var(--text);
  font-weight:900;
}
.playerNameInput:focus{
  border-color:rgba(47,107,255,.60);
  box-shadow:0 0 0 3px rgba(47,107,255,.18);
}

.playerRow__actions{
  grid-column:2;
  grid-row:2;
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.pBtn{
  width:44px;height:44px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  display:grid;
  place-items:center;
  font-weight:950;
  cursor:pointer;
}

/* Game table */
.gameGridCard{ width:100%; min-height:0; }
.gridWrap{
  width:100%;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.10);

  /* keep it tall but not absurd; avoid bottom blank areas */
  max-height: 70dvh;
}
@media (max-width:980px){
  .gridWrap{ max-height: 62dvh; }
}

/* Desktop grid */
.grid{
  min-width: 720px;
  width:100%;
  display:grid;
  grid-auto-rows:minmax(48px, auto);
}
.gridRow{
  display:grid;
  grid-template-columns: 120px repeat(var(--cols), minmax(96px, 1fr));
}
.cell{
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  padding:6px 8px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:var(--text);
}
.cell--hdr{
  position:sticky;
  top:0;
  z-index:3;
  background:rgba(16,26,46,.92);
  backdrop-filter: blur(10px);
}
.cell--left{
  position:sticky;
  left:0;
  z-index:4;
  background:rgba(16,26,46,.92);
  backdrop-filter: blur(10px);
  justify-content:flex-start;
  padding-left:12px;
}
.cell--total{
  background:rgba(255,255,255,.03);
  font-weight:950;
}

.cellInput{
  width:100%;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  color:var(--text);
  font-weight:950;
  font-size:16px !important;
  text-align:center;
  outline:none;
}
.cellInput:focus{
  border-color:rgba(47,107,255,.60);
  box-shadow:0 0 0 3px rgba(47,107,255,.18);
  background:rgba(47,107,255,.10);
}

/* Mobile: narrower columns */
@media (max-width: 980px){
  .grid{ min-width: 520px; }
  .gridRow{ grid-template-columns: 92px repeat(var(--cols), minmax(72px, 1fr)); }
  .cell{ padding:6px; }
  .cellInput{ height:38px; font-size:16px !important; }
}

/* Results */
.podiumWrap{
  width:100%;
  max-width: 980px;
  margin:4px auto 0;

  /* Make podium area fit the window height (no excessive scrolling) */
  flex: 1;
  min-height: 0;
}
.podium{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  cursor:pointer;
  user-select:none;

  /* keep the image within visible window */
  max-height: 76dvh;
}
.podium__img{
  width:100%;
  height:100%;
  max-height: 76dvh;
  object-fit: contain;     /* IMPORTANT: enables predictable image box */
  object-position: center;
  display:block;
}


@media (max-width:980px){
  .podium, .podium__img{ max-height: 72dvh; }
}

.podiumLabels{ position:absolute; inset:0; pointer-events:none; }

.podiumLabel{
  position:absolute;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:10px 10px;
  color:rgba(11,18,32,.92);
  text-shadow:0 2px 12px rgba(0,0,0,.18);
  gap: 6px;
}

.podiumAvatar{
  width: 58px;            /* was 44 */
  height: 58px;           /* was 44 */
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 10px 22px rgba(0,0,0,.15);
  display:none;
}
@media (max-width:980px){
  .podiumAvatar{ width:52px; height:52px; border-radius:16px; }
}


.podiumLabel__name{ font-weight:1000; line-height:1.05; font-size:clamp(14px, 2.2vw, 26px); }
.podiumLabel__score{ font-weight:950; margin-top:2px; opacity:.86; font-size:clamp(12px, 1.8vw, 20px); }

/* Higher into white area */
.podiumLabel--first  { left:51.4%; top:12.0%; width:44%; transform:translateX(-50%); }
.podiumLabel--second { left:22.7%; top:20.0%; width:38%; transform:translateX(-50%); }
.podiumLabel--third  { left:83.7%; top:20.0%; width:40%; transform:translateX(-50%); }

.podiumLabel__name{
  max-width: 100%;
  padding: 0 6px;
  word-break: break-word;
}


.resultsHint{
  margin-top:10px;
  color:rgba(255,255,255,.72);
  font-weight:800;
  text-align:center;
  padding:10px 12px;
  border-radius:14px;
  border:1px dashed rgba(255,255,255,.14);
  background:rgba(0,0,0,.10);
}

.confetti{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:9999;
  display:none;
}
.confetti.show{ display:block; }

/* Toast */
.toast{
  left:50%;
  right:auto;
  transform:translateX(-50%);
  bottom:calc(14px + env(safe-area-inset-bottom));
  background:rgba(16,26,46,.96);
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  padding:10px 14px;
  border-radius:999px;
  font-weight:900;
  max-width:min(92vw, 720px);
}

/* ===== Hard centering fix (place at END of styles.css) ===== */

/* Make the scroll area the centered column container (like original) */
.contentScroll{
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
}

/* Ensure children can still be full-width, but centered within max width */
.contentScroll > *{
  width:100% !important;
}

/* Center the actual tab content column */
.tabShell{
  width:100% !important;
  display:flex !important;
  justify-content:center !important;
}

.tab-content{
  width:100% !important;
  max-width: var(--contentMax) !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

/* Keep tabs centered too */
.tabs{
  margin-left:auto !important;
  margin-right:auto !important;
  max-width: var(--contentMax) !important;
}
/* ===== FORCE Spielzettel to be single-column (override drfriedels-layout.css) ===== */
#appRoot.app--spielzettel > .main{
  display:flex !important;
  flex-direction:column !important;
  grid-template-columns:none !important;
  gap:0 !important;
  padding:0 !important;
  overflow:hidden !important;
  flex:1 !important;
  min-height:0 !important;
}

/* keep ONE scroll container */
#appRoot.app--spielzettel .contentScroll{
  flex:1 !important;
  min-height:0 !important;
  overflow:auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* center the column */
#appRoot.app--spielzettel .tab-content,
#appRoot.app--spielzettel .hero,
#appRoot.app--spielzettel .startActions,
#appRoot.app--spielzettel .tabs{
  max-width: var(--contentMax) !important;
  margin-left:auto !important;
  margin-right:auto !important;
}
/* When keyboard is open, let the grid area grow; scrolling happens in contentScroll */
#appRoot.keyboard-open .gridWrap{
  max-height: none !important;
}

