/* =========================================================
   BillyyG – Handy & Tablet
   Wird nach style.css + design.css geladen und passt nur
   kleine Bildschirme an. Am PC aendert sich hier nichts.
   ========================================================= */

/* Nie seitlich wegscrollen; Inhalte in Rastern duerfen schrumpfen */
html, body { overflow-x: clip; }
img, video, canvas, iframe { max-width: 100%; }
[class*="-grid"] > *, [class*="-row"] > .panel, .panel { min-width: 0; }
.nav-burger { display: none; }
.nav-burger .i-close { display: none; }

/* Touch-Geraete: kein Hover-Wackeln, keine blaue Tipp-Markierung */
@media (hover: none) {
  * { -webkit-tap-highlight-color: transparent; }
  .menu-card:hover, .rw-card:hover, .ms-card:hover, .promo-card:hover { transform: none; }
}

/* ============================================ Tablet + Handy (<= 860px) */
@media (max-width: 860px) {
  /* ---------- Kopfzeile: Logo | Sprache Sound Login | Menue ---------- */
  header.nav { flex-wrap: nowrap; padding: 8px 12px; gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
  .nav-brand img { width: 40px; height: 40px; }
  .nav-brand .brand-text { display: inline; font-size: 18px; }
  .nav-tools { gap: 6px; align-items: center; }
  .icon-btn { width: 40px; height: 40px; border-radius: 11px; }
  .lang-btn { height: 40px; }
  .lang-btn span { padding: 6px 8px; }
  #stream-btn { display: none; }
  .user-chip { height: 40px; padding: 0 10px; }
  .user-chip span { display: none; }
  .nav-burger { display: grid; }
  header.nav.open .nav-burger .i-open { display: none; }
  header.nav.open .nav-burger .i-close { display: block; }
  header.nav.open .nav-burger { border-color: var(--purple); box-shadow: var(--shadow-purple); }

  /* Ausklapp-Menue */
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
    grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 12px 16px;
    max-height: calc(100dvh - 70px); overflow-y: auto; overscroll-behavior: contain;
    background: rgba(9, 6, 19, 0.97); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--panel-border); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.65);
  }
  header.nav.open .nav-links { display: grid; animation: fade-in 0.18s; }
  header.nav .nav-links a {
    padding: 12px 14px; font-size: 15px; letter-spacing: 0.3px; gap: 10px; border-radius: 12px;
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--panel-border); min-height: 48px;
  }
  header.nav .nav-links a > span,
  header.nav .nav-links a:not(.active) > span,
  header.nav .nav-links a.active > span { display: inline !important; font-size: 15px; }
  header.nav .nav-links a .ic { width: 20px; height: 20px; flex: none; }
  header.nav .nav-links a::after { display: none; }
  body.nav-open { overflow: hidden; }

  /* ---------- Code-Leiste: kompakt, nicht klebend ---------- */
  .promo-bar:not(.in-show) { position: relative; top: auto; flex-wrap: nowrap; gap: 8px; padding: 8px 10px; justify-content: stretch; }
  .promo-bar:not(.in-show) .promo-sep { display: none; }
  .promo-bar:not(.in-show) .promo-card { flex: 1 1 0; min-width: 0; justify-content: center; gap: 7px; padding: 6px 10px; border-radius: 12px; }
  .promo-bar:not(.in-show) .pc-use, .promo-bar:not(.in-show) .pc-on, .promo-bar:not(.in-show) .pc-copy { display: none; }
  .promo-bar:not(.in-show) .pc-code { font-size: 16px; letter-spacing: 1px; padding: 1px 7px; }
  .promo-bar:not(.in-show) .pc-site { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

  /* ---------- Allgemein ---------- */
  main { padding: 20px 12px 50px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: clamp(26px, 7.5vw, 40px); letter-spacing: 1px; line-height: 1.15; }
  .page-head p { font-size: 15px; }
  .panel { border-radius: 16px; }
  .btn:not(.small) { min-height: 40px; }
  input, select, textarea { font-size: 16px; } /* iPhone zoomt sonst beim Tippen rein */
  .warn-banner { flex-wrap: wrap; text-align: center; margin: -6px auto 18px; padding: 10px 14px; font-size: 14px; }
  .warn-banner a { white-space: normal; }
  .admin-tabs, .ga-tabs, .hu-tabs, .seg, .cal-switch { flex-wrap: wrap; }
  .modal { width: calc(100vw - 20px) !important; max-height: calc(100dvh - 20px); overflow-y: auto; }
  .modal-body { padding: 8px 16px 18px; }
  #toasts { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
  #toasts .toast { max-width: none; }

  /* ---------- Startseite ---------- */
  .hero-logo { width: 190px; height: 190px; }
  .hero h1, .hero .hero-title { font-size: clamp(34px, 11vw, 56px); }
  .hero-actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 340px; margin-inline: auto; }
  .hero-actions .btn { justify-content: center; }
  .tips-hero { gap: 12px; padding: 18px 14px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 26px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 26px; }
  .stat .l { font-size: 11px; letter-spacing: 0.5px; position: relative; z-index: 1; }
  .stat .ico .ic { width: 30px; height: 30px; opacity: 0.22; }
  .stat .ico { top: 12px; right: 10px; transform: none; }
  .stat .ring { width: 54px; height: 54px; right: 10px; top: 12px; transform: none; }
  .stat .ring text { font-size: 13px; }
  .menu-cards { grid-template-columns: 1fr; gap: 12px; margin-bottom: 30px; }
  .menu-card { display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; align-items: start; padding: 16px; border-radius: 16px; }
  .menu-card .glow { display: none; }
  .menu-card .big-ico { grid-row: 1 / span 3; }
  .menu-card .ic-tile { width: 54px; height: 54px; border-radius: 15px; }
  .menu-card .ic-tile .ic { width: 26px; height: 26px; }
  .menu-card h3 { margin: 2px 0 4px; font-size: 18px; }
  .menu-card p { margin: 0 0 8px; font-size: 14px; }
  .menu-card .go { font-size: 13px; }
  .about-grid, .rules-grid, .preview-grid { grid-template-columns: 1fr; }
  .home-clips .cl-grid { grid-template-columns: 1fr; }
  .ticker .track { font-size: 13px; }

  /* ---------- Infos / Verantwortungsvoll spielen ---------- */
  .steps { grid-template-columns: 1fr; }
  .rg-box { flex-direction: column; align-items: flex-start; }
  .rg-links { flex-direction: column; align-items: stretch; }
  .rg-links a { flex-wrap: wrap; white-space: normal; row-gap: 4px; }
  .faq a, .faq-a a, details a { word-break: break-all; }

  /* ---------- Leaderboard ---------- */
  .lb-top { grid-template-columns: 1fr; gap: 10px; }
  .lb-podium { gap: 6px; grid-template-columns: 1fr 1.12fr 1fr; margin: 8px auto 20px; }
  .lb-pod, .lb-pod-card { min-width: 0; }
  .lb-pod-card { padding: 12px 6px 10px; }
  .lb-pod-av, .lb-pod-av .lb-avatar { width: 50px; height: 50px; font-size: 21px; }
  .lb-pod-av { margin-bottom: 8px; }
  .lb-medal { width: 22px; height: 22px; font-size: 12px; }
  .lb-pod-name, .lb-pod.p1 .lb-pod-name { font-size: 13px; }
  .lb-pod-wager { font-size: 13px; }
  .lb-pod-wager small { font-size: 11px; }
  .lb-pod-prize { font-size: 15px; padding: 5px 10px; margin-top: 8px; }
  .lb-pod.p1 .lb-step { height: 70px; } .lb-pod.p2 .lb-step { height: 48px; } .lb-pod.p3 .lb-step { height: 34px; }
  .lb-step { font-size: 30px; }
  .lb-table-wrap { padding: 4px 4px 0; }
  .lb-table th { padding: 6px 8px; font-size: 11px; letter-spacing: 1px; }
  .lb-table td { padding: 8px 8px; }
  .lb-table td:first-child { width: 40px; }
  .lb-table .w { width: auto; }
  .lb-table .p { width: 64px; }
  .lb-name { gap: 8px; }
  .lb-name b { font-size: 15px; }
  .lb-name .lb-avatar { width: 30px; height: 30px; font-size: 14px; flex: none; }
  .lb-bar { display: none; }
  .lb-wcell span { min-width: 0; font-size: 14px; }
  .lb-prize { font-size: 14px; }
  .lb-foot { font-size: 13px; padding: 10px; }
  .lb-clock > div { min-width: 0; }

  /* ---------- Hall of Fame ---------- */
  .hof-grid, .hof-top { grid-template-columns: 1fr !important; }

  /* ---------- Shop ---------- */
  .rw-top { grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
  .rw-wallet { padding: 16px; gap: 12px 14px; }
  .rw-coin { width: 58px; height: 58px; }
  .rw-balance { font-size: 34px; }
  .rw-login .btn { flex: 1 1 100%; justify-content: center; }
  .rw-earn { padding: 16px; }
  .rw-earn-steps { grid-template-columns: 1fr; gap: 8px; }
  .rw-earn-steps > div { grid-template-columns: 40px 1fr; column-gap: 12px; align-items: center; padding: 10px 12px; }
  .rw-earn-steps .rw-step-ico { grid-row: span 2; margin: 0; }
  .rw-bar { flex-direction: column; align-items: stretch; }
  .rw-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-inline: -12px; padding-inline: 12px; }
  .rw-cats::-webkit-scrollbar { display: none; }
  .rw-cats button { flex: none; padding: 8px 13px; font-size: 14px; }
  .rw-sort select { width: 100%; }
  .rw-grid, .ms-grid { grid-template-columns: 1fr; gap: 12px; }
  .ms-head h2 { font-size: 20px; }
  .ms-head p { font-size: 14px; }
  .ms-art { aspect-ratio: 460 / 170; }
  .ms-box { width: 72px; height: 72px; border-radius: 20px; }
  .ms-box b { font-size: 40px; }
  .rw-img { aspect-ratio: 460 / 170; }
  .ms-win-cover { height: 170px; }
  .ms-win-body { padding: 0 16px 18px; }
  .ms-key code { font-size: 17px; }
  .ms-overlay { padding: 12px; }
  .roulette-wrap { height: 200px; }
  .roulette-wrap .r-card { width: 170px; }

  /* ---------- Kalender / Reveal ---------- */
  .doors-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .door, .door-inside, .door-front { border-radius: 10px; }
  .door-front .num { font-size: clamp(22px, 7vw, 34px); }
  .door-front .ribbon { font-size: 7px; letter-spacing: 1px; }
  .door-front .knob { width: 7px; height: 7px; }
  .door-inside .info { padding: 6px; }
  .door-inside .g-name { font-size: 11px; line-height: 1.15; }
  .door-inside .g-price { font-size: 12px; }
  .door-inside .g-winner, .door-inside .num-small { font-size: 10px; }
  .door-inside .sent-badge, .door-inside .shop-badge { font-size: 8px; padding: 1px 4px; top: 4px; right: 4px; }
  .door-inside .sent-badge + .shop-badge { top: 20px; }
  .big-door { width: 220px; height: 293px; }
  .big-door .leaf .half-num { font-size: 90px; }
  .win-card { width: calc(100vw - 24px); }
  .win-card .wc-cover { height: 180px; }
  .win-card .wc-body { padding: 4px 16px 18px; }
  .win-card .wc-actions { flex-wrap: wrap; }
  .reveal-title { font-size: clamp(22px, 6.5vw, 34px) !important; padding: 0 10px; text-align: center; }
  .rev-controls, .reveal-controls { flex-wrap: wrap; justify-content: center; }

  /* ---------- Gewinnspiel / Gluecksrad ---------- */
  .ga-grid, body.stream-mode .ga-grid { grid-template-columns: 1fr; }
  .ga-hero { grid-template-columns: 1fr; text-align: center; padding: 18px 14px; gap: 14px; }
  .ga-modes { justify-content: center; }
  .ga-modes button { padding: 9px 12px; font-size: 13px; }
  .wh-grid, body.stream-mode .wh-grid { grid-template-columns: 1fr; }
  .wh-stage { max-width: 100%; }

  /* ---------- Hunt / Turnier ---------- */
  .hu-grid, .tu-grid { grid-template-columns: 1fr; }
  .hu-list, .hu-gtb { overflow-x: auto; }
  .hu-stats { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .hu-stat { padding: 12px; }
  .hu-stat .v { font-size: 20px; }
  .hu-stat .l { font-size: 10px; letter-spacing: 0.5px; position: relative; z-index: 1; }
  .hu-stat .ico { font-size: 22px; }
  .hu-head { padding: 12px; gap: 10px; }
  .hu-head input.hu-name { min-width: 0; width: 100%; flex-basis: 100%; font-size: 18px; }
  .hu-head select#h-history { width: 100%; }
  .hu-stage-input { flex-wrap: wrap; }
  .hu-stage-input input#st-payout { width: 160px; }
  .hu-add { flex-wrap: wrap; }

  /* ---------- Admin ---------- */
  .admin-tabs { gap: 6px; }
  .admin-tabs button { flex: 1 1 calc(50% - 6px); justify-content: center; font-size: 13px; padding: 9px 8px; }
  .admin-bar { flex-direction: column; align-items: stretch; }
  .admin-bar > * { width: 100%; }
  .admin-table-wrap { margin-inline: -12px; padding-inline: 12px; -webkit-overflow-scrolling: touch; }
  .settings-box { padding: 16px; }
  .admins-grid, .lb-admin-grid, .pl-lower, .rw-admin-grid { grid-template-columns: 1fr; }
}

/* ===================================================== Handy (<= 520px) */
@media (max-width: 520px) {
  .nav-brand .brand-text { display: none; }
  .promo-bar:not(.in-show) .pc-code { font-size: 15px; }
  .stats-row { gap: 8px; }
  .stat .v { font-size: 22px; }
  .doors-grid { gap: 7px; }
  .lb-pod-prize { font-size: 13px; padding: 4px 8px; }
  .lb-table th:first-child, .lb-table td:first-child { padding-left: 10px; }
  .rw-form-row { grid-template-columns: 1fr 1fr; }
  .ms-tier-row { grid-template-columns: 24px 1fr 0.7fr 0.9fr 30px 26px; gap: 4px; }
  .ms-tier-row input:not([type="checkbox"]) { padding: 7px 6px; font-size: 14px; }
}

/* Sehr kleine Handys (iPhone SE / Mini) */
@media (max-width: 370px) {
  header.nav { gap: 5px; padding-inline: 8px; }
  .icon-btn { width: 36px; height: 36px; }
  .lang-btn { height: 36px; }
  .lang-btn span { padding: 5px 6px; font-size: 12px; }
  .doors-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-links { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .rw-bar { width: 100%; min-width: 0; }
  .rw-cats { width: calc(100% + 24px); max-width: calc(100% + 24px); }
}
@media (max-width: 860px) {
  .tips-hero .ico ~ .ico { display: none; }
}
.ms-key[hidden] { display: none !important; }
@media (max-width: 860px) {
  .nav-links { grid-template-columns: repeat(2, minmax(0, 1fr)); box-sizing: border-box; width: auto; margin: 0; }
  header.nav .nav-links a { min-width: 0; }
  header.nav .nav-links a > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
}
/* Tablet: zwei Spalten, Handy: eine */
@media (min-width: 521px) and (max-width: 860px) {
  .menu-cards, .rw-grid, .ms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hof-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .doors-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 860px) {
  .nav-links .nav-pill { display: none !important; }
  header.nav .nav-links a { background: rgba(255, 255, 255, 0.035) !important; }
  header.nav .nav-links a.active { color: #fff; background: linear-gradient(135deg, rgba(157, 77, 255, 0.4), rgba(106, 27, 214, 0.2)) !important;
    border-color: rgba(157, 77, 255, 0.6); box-shadow: 0 0 16px rgba(157, 77, 255, 0.3) !important; }
}
/* Shop-Admin: Stufen auf dem Handy zweizeilig */
@media (max-width: 520px) {
  .ms-tier-row { grid-template-columns: 26px 1fr 1fr 34px; grid-template-areas: "dot name name on" "dot min cost keys"; row-gap: 6px; }
  .ms-tier-row > :nth-child(1) { grid-area: dot; }
  .ms-tier-row > :nth-child(2) { grid-area: name; }
  .ms-tier-row > :nth-child(3) { grid-area: min; }
  .ms-tier-row > :nth-child(4) { grid-area: cost; }
  .ms-tier-row > :nth-child(5) { grid-area: keys; }
  .ms-tier-row > :nth-child(6) { grid-area: on; }
  .ms-tier-row:not(.head) { padding: 8px; }
}

/* ===================================================== Handy-Vorschau (Admin) */
.pv-overlay { position: fixed; inset: 0; z-index: 2000; display: grid; grid-template-rows: auto 1fr auto;
  background: radial-gradient(circle at 50% 40%, rgba(60, 25, 120, 0.55), rgba(5, 3, 10, 0.97) 70%); backdrop-filter: blur(8px); animation: fade-in 0.2s; }
body.pv-open { overflow: hidden; }
.pv-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--panel-border); background: rgba(7, 5, 13, 0.85); }
.pv-title { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); letter-spacing: 1px; text-transform: uppercase; font-size: 15px; }
.pv-title .ic { width: 20px; height: 20px; color: var(--green); }
.pv-devs { display: flex; gap: 6px; flex-wrap: wrap; }
.pv-devs button { display: grid; gap: 1px; padding: 6px 12px; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: 13px; color: var(--muted);
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--panel-border); transition: all 0.15s; text-align: center; }
.pv-devs button small { font-size: 10px; font-weight: 700; opacity: 0.7; }
.pv-devs button:hover { color: #fff; border-color: var(--purple); }
.pv-devs button.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--purple), var(--purple-2)); box-shadow: var(--shadow-purple); }
.pv-sp { flex: 1; }
.pv-bar .icon-btn .ic { width: 18px; height: 18px; }
.pv-x { font-size: 16px; }
.pv-x:hover { background: var(--red); border-color: var(--red); }
.pv-stage { position: relative; overflow: hidden; min-height: 0; }
.pv-phone { position: absolute; left: 50%; top: 50%; flex: none; box-sizing: content-box; padding: 18px; border-radius: 46px; transform-origin: center;
  background: linear-gradient(145deg, #2a2340, #0d0a18); box-shadow: 0 0 0 2px #3d3360, 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 60px rgba(157, 77, 255, 0.25);
  transition: width 0.3s, height 0.3s, transform 0.3s; }
.pv-phone iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 30px; background: #07050d; max-width: none; }
.pv-notch { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 70px; height: 9px; border-radius: 6px; background: #000; z-index: 2; pointer-events: none; }
.pv-phone.land .pv-notch { top: 50%; left: 5px; transform: translateY(-50%); width: 9px; height: 70px; }
.pv-hint { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 12px 12px; }
html.in-preview .pv-btn { display: none !important; }
html.in-preview body { scrollbar-width: none; }
html.in-preview ::-webkit-scrollbar { display: none; }
@media (max-width: 860px) { .pv-btn { display: none !important; } }
