/* ============================================================================
   playSoF.org — sof.css  v3
   Fixes: overlay sizing on desktop + close button behaviour
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@900&family=Cinzel:wght@400;600;700&family=EB+Garamond:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --parch:        #e7d6b0;
  --parch-light:  #f0e3c4;
  --parch-dark:   #d4bd8d;
  --parch-deep:   #c4a972;
  --ink:          #2b1d0e;
  --ink-soft:     #4a3a24;
  --ink-faint:    #6b573a;
  --wood:         #170f08;
  --wood-2:       #271a0d;
  --leather:      #3a2515;
  --gold:         #b9892f;
  --gold-bright:  #e3b252;
  --gold-glow:    rgba(227,178,82,.45);
  --blood:        #7c2020;
  --blood-bright: #a83232;
  --forest:       #4e5f33;
  --arcane:       #3c4a72;
  --radius:       4px;
  --nav-h:        48px;
  --footer-h:     40px;
  --status-h:     0px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(16px, 1.05vw + 12px, 20px);
  line-height: 1.55; color: var(--ink);
  background:
    radial-gradient(ellipse 120% 90% at 50% -10%, #34230f 0%, transparent 60%),
    repeating-linear-gradient(94deg, var(--wood) 0px, var(--wood) 7px,
      var(--wood-2) 8px, var(--wood) 15px), var(--wood);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 200;
  background: radial-gradient(ellipse 90% 80% at 50% 42%,
    transparent 55%, rgba(0,0,0,.52) 100%);
}

/* Status Bar */
#sof-status-bar {
  display: none; background: var(--leather);
  border-bottom: 1px solid var(--gold); color: var(--parch-light);
  font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; align-items: center; justify-content: center;
  text-align: center; padding: 0 1rem; min-height: 32px;
  position: relative; z-index: 300;
}
#sof-status-bar.active { display: flex; }

/* Maintenance warning bar */
#sof-maint-warn {
  display: none; background: #78350f;
  border-bottom: 1px solid #b45309; color: #fde68a;
  font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; align-items: center; justify-content: center;
  text-align: center; padding: 0 1rem; min-height: 30px;
  position: relative; z-index: 300;
}
#sof-maint-warn:not([hidden]) { display: flex; }

/* Nav */
#sof-nav {
  height: var(--nav-h); background: rgba(23,15,8,.92);
  border-bottom: 1px solid rgba(185,137,47,.35);
  display: flex; align-items: center;
  padding: 0 clamp(12px,2vw,28px);
  position: relative; z-index: 300; backdrop-filter: blur(4px);
}
.nav-logo {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(13px,1.4vw,17px); color: var(--gold-bright);
  text-decoration: none; white-space: nowrap;
  text-shadow: 0 0 18px var(--gold-glow); letter-spacing: .04em; flex-shrink: 0;
}
.nav-rule {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(185,137,47,.3), transparent);
  margin: 0 clamp(10px,1.5vw,22px);
}
.nav-links {
  display: flex; align-items: center;
  gap: clamp(6px,1.2vw,20px); list-style: none;
}
.nav-links li { display: flex; align-items: center; }
.nav-links a, .nav-links button {
  font-family: 'Cinzel', serif; font-size: clamp(10px,.9vw,13px);
  letter-spacing: .14em; text-transform: uppercase; color: var(--parch-dark);
  text-decoration: none; background: none; border: none; cursor: pointer;
  padding: 4px 6px; border-radius: var(--radius);
  transition: color .18s, background .18s; white-space: nowrap;
}
.nav-links a:hover, .nav-links button:hover {
  color: var(--gold-bright); background: rgba(185,137,47,.1);
}
.nav-links .nav-sep { width: 1px; height: 16px; background: rgba(185,137,47,.3); }
.nav-links .nav-member-name {
  font-family: 'Cinzel', serif; font-size: clamp(10px,.9vw,12px);
  color: var(--gold); letter-spacing: .12em; text-transform: uppercase; padding: 4px 6px;
}
body.sof-anonymous .nav-member-only { display: none !important; }
body.sof-member    .nav-guest-only  { display: none !important; }

/* Language switcher — nav */
.nav-lang { display: flex; align-items: center; gap: 4px; }
.nav-lang-btn {
  font-family: 'Cinzel', serif; font-size: clamp(9px,.82vw,11px);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--parch-dark); text-decoration: none;
  padding: 3px 5px; border-radius: var(--radius);
  transition: color .18s, background .18s;
}
.nav-lang-btn:hover { color: var(--gold-bright); background: rgba(185,137,47,.1); }
.nav-lang-btn.active { color: var(--gold-bright); font-weight: 700; }
.nav-lang-sep { color: rgba(185,137,47,.4); font-size: 10px; }

/* Language switcher — overlay (top-right, below × button) */
.overlay-lang-switch {
  position: absolute; top: 38px; right: 14px;
  display: flex; align-items: center; gap: 4px; z-index: 3;
}
.overlay-lang-btn {
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); text-decoration: none;
  padding: 2px 5px; border-radius: var(--radius);
  transition: color .18s, background .18s;
}
.overlay-lang-btn:hover { color: var(--gold); background: rgba(185,137,47,.1); }
.overlay-lang-btn.active { color: var(--gold); font-weight: 700; }
.overlay-lang-sep { color: rgba(120,86,40,.4); font-size: 9px; }

/* Main */
#sof-main {
  height: calc(100vh - var(--nav-h) - var(--footer-h) - var(--status-h));
  display: flex; padding: clamp(8px,1.2vw,16px); gap: clamp(6px,1vw,12px);
  position: relative;
}

/* Book */
#sof-book {
  flex: 1; display: grid; grid-template-columns: var(--split, 1fr 1fr);
  gap: 0; background: var(--leather); border-radius: 8px;
  padding: clamp(8px,1.2vw,16px);
  box-shadow: 0 2px 0 #1a0e05, 0 0 0 2px #1d1109,
    0 34px 80px rgba(0,0,0,.7), inset 0 0 60px rgba(0,0,0,.6);
  overflow: hidden; min-height: 0; position: relative;
}
.sof-page {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 30% 18%, var(--parch-light) 0%, transparent 60%),
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 45%, var(--parch-dark) 100%);
  min-height: 0; display: flex; flex-direction: column;
}
.sof-page::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 50px rgba(120,86,40,.45), inset 0 0 110px rgba(90,60,24,.3);
  border-radius: inherit;
}
.sof-page-inner {
  position: relative; z-index: 2; padding: clamp(14px,2vw,32px);
  height: 100%; display: flex; flex-direction: column;
}
#sof-page-video {
  border-radius: var(--radius) 0 0 var(--radius);
  box-shadow: inset -26px 0 38px -22px rgba(60,40,16,.8);
}
#sof-page-card {
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: inset 26px 0 38px -22px rgba(60,40,16,.8);
}

/* Resize handle */
#sof-resize-handle {
  position: absolute; top: 10%; height: 80%; width: 16px;
  left: calc(50% - 8px); cursor: col-resize; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
#sof-resize-handle::before {
  content: ""; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); width: 28px; height: 28px;
  background: var(--leather); border: 1px solid var(--gold);
  border-radius: 50%; opacity: .75; transition: opacity .2s, transform .2s;
}
#sof-resize-handle::after {
  content: "⟺"; font-size: 13px; color: var(--gold);
  position: relative; z-index: 1; opacity: .85; transition: opacity .2s;
}
#sof-resize-handle:hover::before { opacity: 1; transform: translate(-50%,-50%) scale(1.1); }
#sof-resize-handle:hover::after  { opacity: 1; }

/* Video */
#sof-video-wrap { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.sof-section-label {
  font-family: 'Cinzel', serif; font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px;
}
#sof-yt-container {
  flex: 1; background: #000; border-radius: var(--radius);
  border: 1px solid rgba(120,86,40,.4);
  overflow: hidden; position: relative; min-height: 0;
}
#sof-yt-player { width: 100%; height: 100%; position: absolute; inset: 0; }
/* Transparent shield — sits above the YT player to block ad clicks/hovers.
   Matches container size automatically via inset:0; no JS resize needed.
   z-2: above player; placeholder z-3 and dev panel z-4 sit above it. */
#sof-yt-shield {
  position: absolute; inset: 0; z-index: 2; display: none;
}
#sof-yt-placeholder {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 12px;
  background: #000; /* opaque — must fully hide the previous section's video */
  color: var(--parch-dark); font-family: 'Cinzel', serif;
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
}

.sof-yt-play-btn {
  background: rgba(0,0,0,.35); border: 2px solid var(--parch-dark);
  border-radius: 50%; width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  color: var(--parch-dark); cursor: pointer; opacity: .85;
  transition: opacity .15s, transform .15s;
}
.sof-yt-play-btn:hover { opacity: 1; transform: scale(1.06); }

/* Play Card */
#sof-play-card {
  flex: 1; overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
  display: flex; flex-direction: column; gap: 14px; min-height: 0;
}
.card-section-title {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(16px,1.8vw,22px); color: var(--ink); letter-spacing: .04em;
  text-shadow: 0 1px 0 rgba(255,248,230,.5);
  margin: 0 0 .25em 0; padding: 10px 84px 0 0; /* right clears the 72px portrait */
}
.card-body-text {
  font-size: clamp(15px,1.05vw,19px); color: var(--ink-soft);
  line-height: 1.6; margin-bottom: .75em;
}
.choices-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding-top: 0; }
.choice-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--parch-light), var(--parch));
  border: 1px solid var(--gold); border-radius: var(--radius);
  padding: 7px 14px; font-family: 'EB Garamond', serif;
  font-size: clamp(14px,1vw,18px); color: var(--ink);
  cursor: pointer; text-align: left;
  transition: background .18s, box-shadow .18s, transform .1s; line-height: 1.4;
}
.choice-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--parch), var(--parch-dark));
  box-shadow: 0 0 0 2px var(--gold-glow), 0 2px 8px rgba(0,0,0,.2);
  transform: translateY(-1px);
}
.choice-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Stats bar */
#sof-stats-bar {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  background: rgba(43,29,14,.15); border: 1px solid rgba(120,86,40,.3);
  border-radius: var(--radius); flex-wrap: wrap;
}
.stat-item { display: flex; align-items: center; gap: 5px; font-family: 'Cinzel', serif;
  font-size: 11px; letter-spacing: .1em; color: var(--ink-soft); }
.stat-item .stat-val { font-weight: 700; color: var(--ink); }
.stat-item.stat-hp .stat-val { color: var(--blood-bright); }

/* Footer */
#sof-footer {
  height: var(--footer-h); background: rgba(23,15,8,.92);
  border-top: 1px solid rgba(185,137,47,.25);
  display: flex; align-items: center; justify-content: center;
  gap: clamp(10px,2vw,28px); padding: 0 clamp(12px,2vw,28px);
  position: relative; z-index: 300;
}
.footer-link {
  font-family: 'Cinzel', serif; font-size: clamp(9px,.75vw,11px);
  letter-spacing: .12em; text-transform: uppercase; color: var(--parch-dark);
  text-decoration: none; transition: color .18s; white-space: nowrap;
  background: none; border: none; cursor: pointer; padding: 0;
}
.footer-link:hover { color: var(--gold-bright); }
.footer-copy { font-family: 'Cinzel', serif; font-size: clamp(9px,.75vw,11px);
  letter-spacing: .1em; color: var(--parch-dark); white-space: nowrap; opacity: .7; }
.footer-sep { width: 1px; height: 12px; background: rgba(185,137,47,.35); }

/* ============================================================================
   OVERLAY — tabbed Anleitung + consent footer
   Uses align-items:stretch so shell fills the padded overlay height.
   ============================================================================ */
#sof-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(23,15,8,.97);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
#sof-overlay.hidden { display: none; }

.overlay-shell {
  width: 100%;
  max-width: 980px;
  height: 100%;          /* fill the stretched overlay container */
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 50% at 30% 18%, var(--parch-light) 0%, transparent 60%),
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 45%, var(--parch-dark) 100%);
  border: 1px solid var(--gold); border-radius: 8px;
  box-shadow: 0 0 80px rgba(0,0,0,.9), 0 0 0 1px #1d1109;
  overflow: hidden; position: relative;
  min-height: 0;
}
.overlay-shell::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 60px rgba(120,86,40,.25); border-radius: inherit; z-index: 0;
}

/* Header */
.overlay-header {
  position: relative; z-index: 1; flex-shrink: 0;
  padding: clamp(12px,1.8vw,20px) clamp(14px,2vw,22px) 0;
  text-align: center;
}
.overlay-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--ink-faint); padding: 4px 8px;
  font-family: 'Cinzel', serif; transition: color .18s; line-height: 1; z-index: 2;
}
.overlay-close:hover { color: var(--gold); }
.overlay-close.hidden { display: none; }
.overlay-kicker {
  font-family: 'Cinzel', serif; letter-spacing: .36em;
  text-transform: uppercase; font-size: 11px; color: var(--gold); margin-bottom: .3em;
}
.overlay-title {
  font-family: 'Cinzel Decorative', serif; font-weight: 900;
  font-size: clamp(16px,2.4vw,30px); color: var(--ink); line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255,248,230,.6);
}
.overlay-rule {
  display: flex; align-items: center; gap: 10px;
  margin: .4em auto .3em; max-width: 260px; color: var(--gold);
}
.overlay-rule::before { content:""; height:1px; flex:1;
  background: linear-gradient(90deg,transparent,var(--gold)); }
.overlay-rule::after  { content:""; height:1px; flex:1;
  background: linear-gradient(90deg,var(--gold),transparent); }
.policy-notice {
  background: rgba(124,32,32,.12); border: 1px solid var(--blood);
  border-radius: var(--radius); padding: 7px 12px; font-size: 12px;
  color: var(--blood-bright); font-family: 'Cinzel', serif;
  letter-spacing: .07em; text-align: center; margin: .4em 0 0; display: none;
}
.policy-notice.visible { display: block; }

/* Tab bar — horizontal scroll, all tabs reachable */
.overlay-tabs {
  position: relative; z-index: 1; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-bottom: 1px solid rgba(120,86,40,.4);
  padding: 0 clamp(8px,1.2vw,16px);
  margin-top: 6px;
}
.overlay-tabs-row {
  display: flex; overflow-x: auto; scrollbar-width: none; min-height: 34px;
}
.overlay-tabs-row + .overlay-tabs-row {
  border-top: 1px solid rgba(120,86,40,.18);
}
.overlay-tabs-row::-webkit-scrollbar { display: none; }
.tab-btn {
  font-family: 'Cinzel', serif;
  font-size: clamp(8px,.68vw,10px);   /* small enough for all 7 tabs to be nearly visible */
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint); background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 7px clamp(5px,.8vw,10px) 9px;
  cursor: pointer; white-space: nowrap;
  transition: color .18s, border-color .18s; flex-shrink: 0;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 700; }

/* Tab body — takes all remaining vertical space */
.overlay-body {
  position: relative; z-index: 1;
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--gold) transparent;
  min-height: 0;
}
.tab-panel { display: none; padding: clamp(12px,1.6vw,20px); }
.tab-panel.active { display: block; }

/* Cookie tab */
.cookie-section-title {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(13px,1.2vw,16px); color: var(--ink); letter-spacing: .06em;
  margin: .9em 0 .35em;
}
.cookie-section-title:first-child { margin-top: 0; }
.cookie-text {
  font-size: clamp(13px,.95vw,16px); color: var(--ink-soft); line-height: 1.65; margin-bottom: .7em;
}
.cookie-text a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
ul.cookie-text { margin: 0 0 .9em 1.3em; padding: 0; }
ul.cookie-text li { margin-bottom: .3em; }
.cookie-table {
  width: 100%; border-collapse: collapse;
  font-size: clamp(11px,.85vw,14px); margin-bottom: 1em;
}
.cookie-table th {
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  border-bottom: 1px solid rgba(120,86,40,.4);
  padding: 5px 8px; text-align: left;
}
.cookie-table td {
  padding: 6px 8px; color: var(--ink-soft);
  border-bottom: 1px solid rgba(120,86,40,.15);
  vertical-align: top; line-height: 1.5;
}
.cookie-table tr:last-child td { border-bottom: none; }

/* Infographic tabs */
.infographic-img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius); border: 1px solid rgba(120,86,40,.3);
}

/* Consent footer — always at bottom, never scrolls */
.overlay-consent-footer {
  position: relative; z-index: 1; flex-shrink: 0;
  border-top: 1px solid rgba(120,86,40,.4);
  padding: clamp(10px,1.4vw,16px) clamp(14px,2vw,22px);
  background: linear-gradient(0deg, var(--parch-dark) 0%, transparent 100%);
  display: flex; flex-direction: column; gap: 8px;
}
.consent-btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-consent-accept {
  flex: 1; min-width: 160px; padding: 11px 18px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none; border-radius: var(--radius);
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(11px,.9vw,14px); letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink); cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}
.btn-consent-accept:hover { box-shadow: 0 0 0 3px var(--gold-glow); transform: translateY(-1px); }
/* Shared row: withdraw (left) + close (right) — both shown together once
   consent is already given, so they live in one row instead of two
   separate rows (saves vertical space, more room for tabs before scrolling
   is needed). */
.consent-footer-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-consent-withdraw {
  flex-shrink: 0; padding: 11px 14px;
  background: none; border: 1px solid rgba(124,32,32,.45);
  border-radius: var(--radius); font-family: 'Cinzel', serif;
  font-size: clamp(10px,.82vw,12px); letter-spacing: .1em;
  text-transform: uppercase; color: var(--blood-bright);
  cursor: pointer; transition: border-color .18s, background .18s; display: none;
}
.btn-consent-withdraw:hover { border-color: var(--blood); background: rgba(124,32,32,.08); }
.btn-consent-withdraw.visible { display: block; }

/* Close button in footer — shown when consent already given (belt + suspenders) */
.btn-overlay-close-footer {
  display: none;
  flex: 1; min-width: 160px; padding: 11px 18px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none; border-radius: var(--radius);
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(11px,.9vw,14px); letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink); cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}
.btn-overlay-close-footer:hover { box-shadow: 0 0 0 3px var(--gold-glow); transform: translateY(-1px); }
.btn-overlay-close-footer.visible { display: block; }

.consent-status-given {
  font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .1em;
  color: var(--forest); text-align: center; display: none;
}
.consent-status-given.visible { display: block; }
.consent-footer-note {
  font-size: clamp(10px,.82vw,12px); color: var(--ink-faint); line-height: 1.5; text-align: center;
}
.consent-footer-note a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================================
   LOGIN PANEL — Flow B quick login
   ============================================================================ */
#sof-login-panel {
  position: fixed;
  top: var(--nav-h);
  right: clamp(12px, 2vw, 28px);
  z-index: 400;
  width: clamp(280px, 90vw, 360px);
  filter: drop-shadow(0 8px 32px rgba(0,0,0,.7));
}
#sof-login-panel.hidden { display: none; }

.login-panel-inner {
  background:
    radial-gradient(ellipse 70% 50% at 30% 18%, var(--parch-light) 0%, transparent 60%),
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 100%);
  border: 1px solid var(--gold);
  border-radius: 0 0 8px 8px;
  padding: 20px;
  position: relative;
}
.login-panel-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--ink-faint); line-height: 1;
  transition: color .18s;
}
.login-panel-close:hover { color: var(--gold); }
.login-panel-title {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 14px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 4px;
}
.login-panel-sub {
  font-size: 12px; color: var(--ink-faint); margin-bottom: 14px; line-height: 1.4;
}
.login-panel-error {
  background: rgba(124,32,32,.12); border: 1px solid var(--blood);
  border-radius: var(--radius); padding: 7px 10px;
  font-size: 12px; color: var(--blood-bright);
  margin-bottom: 12px; line-height: 1.4;
}
.login-panel-form { display: flex; flex-direction: column; gap: 10px; }
.login-panel-field { display: flex; flex-direction: column; gap: 4px; }
.login-panel-field label {
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
}
.login-panel-field input {
  padding: 8px 10px;
  border: 1px solid rgba(120,86,40,.4);
  border-radius: var(--radius);
  background: rgba(255,252,240,.8);
  font-family: 'EB Garamond', serif; font-size: 15px;
  color: var(--ink);
  transition: border-color .18s;
}
.login-panel-field input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
.login-panel-password-wrap { position: relative; display: flex; }
.login-panel-password-wrap input { flex: 1; padding-right: 36px; }
.login-panel-password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 4px 6px;
  opacity: .55; transition: opacity .15s;
}
.login-panel-password-toggle:hover { opacity: 1; }
.login-panel-password-toggle[aria-pressed="true"] { opacity: 1; }
.login-panel-btn {
  padding: 10px 16px; margin-top: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none; border-radius: var(--radius);
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}
.login-panel-btn:hover {
  box-shadow: 0 0 0 3px var(--gold-glow); transform: translateY(-1px);
}
.login-panel-register {
  font-size: 12px; color: var(--ink-faint); text-align: center;
  margin-top: 12px; line-height: 1.5;
}
.login-panel-register a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================================
   SETTINGS DROPDOWN
   ============================================================================ */
#sof-settings-panel {
  position: fixed;
  top: var(--nav-h);
  right: clamp(12px, 2vw, 28px);
  z-index: 400;
  width: clamp(220px, 70vw, 280px);
  filter: drop-shadow(0 8px 32px rgba(0,0,0,.7));
}
#sof-settings-panel.hidden { display: none; }

.settings-panel-inner {
  background:
    radial-gradient(ellipse 70% 50% at 30% 18%, var(--parch-light) 0%, transparent 60%),
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 100%);
  border: 1px solid var(--gold);
  border-radius: 0 0 8px 8px;
  padding: 16px 18px;
}
.settings-panel-title {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 14px;
  border-bottom: 1px solid rgba(120,86,40,.3);
  padding-bottom: 8px;
}
.settings-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(120,86,40,.12);
}
.settings-row:last-child { border-bottom: none; }
.settings-label {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); flex: 1; cursor: pointer;
}

/* Toggle switch */
.settings-toggle { position: relative; width: 38px; height: 20px; flex-shrink: 0; }
.settings-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(120,86,40,.25); border-radius: 20px;
  transition: background .2s;
}
.settings-toggle-slider::before {
  content: ""; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--parch-dark); top: 3px; left: 3px;
  transition: transform .2s, background .2s;
}
.settings-toggle input:checked + .settings-toggle-slider { background: var(--gold); }
.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(18px); background: var(--ink);
}

/* Number input */
.settings-number {
  width: 52px; padding: 4px 6px;
  border: 1px solid rgba(120,86,40,.4);
  border-radius: var(--radius);
  background: rgba(255,252,240,.8);
  font-family: 'Cinzel', serif; font-size: 13px;
  color: var(--ink); text-align: center;
}
.settings-number:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
.settings-hint {
  font-size: 10px; color: var(--ink-faint);
  font-family: 'Cinzel', serif; letter-spacing: .08em;
}

/* Gear button */
.nav-gear button {
  font-family: 'Cinzel', serif; font-size: 16px;
  color: var(--parch-dark); background: none; border: none;
  cursor: pointer; padding: 4px 6px; border-radius: var(--radius);
  transition: color .18s, background .18s; line-height: 1;
}
.nav-gear button:hover,
.nav-gear button.active { color: var(--gold-bright); background: rgba(185,137,47,.1); }

/* ============================================================================
   SLOT TAKEN MESSAGE
   ============================================================================ */
#sof-slots-full {
  position: fixed; inset: 0; z-index: 450;
  background: rgba(23,15,8,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#sof-slots-full.hidden { display: none; }
.slots-full-inner {
  max-width: 560px; width: 100%;
  background:
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 100%);
  border: 1px solid var(--gold); border-radius: 8px;
  padding: clamp(24px, 4vw, 48px);
  text-align: center;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
}
.slots-full-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .7; }
.slots-full-text {
  font-family: 'EB Garamond', serif;
  font-size: clamp(15px, 1.1vw, 18px);
  color: var(--ink-soft); line-height: 1.7; margin-bottom: 1.5rem;
}
.slots-full-close {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none; border-radius: var(--radius);
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); cursor: pointer;
  transition: box-shadow .2s;
}
.slots-full-close:hover { box-shadow: 0 0 0 3px var(--gold-glow); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

/* Rotate-device notice — hidden by default (desktop / tablet / landscape) */
#sof-rotate-notice { display: none; }

/* (max-height: 500px) and (orientation: landscape) catches phones in
   landscape — most report innerWidth well above 768px there (e.g. 926px on
   iPhone 14 Pro Max), so a width-only query never matched them, leaving
   #sof-resize-handle visible and absolutely positioned over the (now very
   narrow) video column — it has a much higher z-index than the manual
   play button and could eat the tap. Matches the "short side" phone
   detection already used in sof-game.js/sof-ui.js JS.
   IMPORTANT: (orientation: landscape) alone just means width > height —
   true for nearly every desktop browser window. A first attempt at this
   query (max-height:500px + orientation:landscape, no pointer check) wrongly
   matched ordinary desktop windows whenever the viewport got short (e.g.
   DevTools docked at the bottom), applying mobile spacing/handle-hiding on
   desktop. (pointer: coarse) is true only for touchscreens, so it's added
   here to keep this scoped to actual phones regardless of window height. */
@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  /* Mobile keeps the same side-by-side split-screen mechanism as desktop —
     #sof-book's grid-template-columns: var(--split, ...) and the JS-driven
     90/10 active-side split (getResponsiveSplit() in sof-game.js) apply
     unchanged. Only the resize handle (manual drag) is unavailable; the
     active side is switched automatically (video vs. play card). */
  #sof-resize-handle { display: none; }
  /* Height is NOT set here — see the landscape-specific block below.
     Applying a hard height unconditionally (for all phone screen sizes) was
     wrong: very small-height landscape phones ended up with almost no room
     for game content. Height is now conditional on landscape viewport height;
     this block only carries the padding/gap/shadow rules. */
  #sof-main { padding: 2px; gap: 2px; }
  /* Tighter outer frame so the card/video panels use the full screen width —
     the desktop clamp() padding (up to 16px+32px combined) wasted a visible
     strip on a narrow mobile viewport. The desktop box-shadow has an 80px
     blur radius — on a ~700-900px wide phone screen that soft shadow reads
     as another chunk of "empty" space at the edges, so it's dropped here. */
  #sof-book { padding: 2px; box-shadow: none; border-radius: 4px; }
  .sof-page-inner { padding: 6px 8px; }
  /* Overlay on mobile: full screen */
  #sof-overlay { padding: 0; align-items: flex-start; }
  .overlay-shell { height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
  /* Only the lone accept button (.consent-btns) stacks full-width — withdraw
     + close-footer (.consent-footer-actions) stay in a row, same as desktop
     (withdraw on the left, close button to its right), see below. */
  .consent-btns { flex-direction: column; }
  .btn-consent-accept { min-width: unset; width: 100%; }
  .consent-footer-actions { flex-direction: row; }

  /* (1) Withdraw + close-footer button row — explicitly kept as a row to
     match desktop (the rule above just stops the generic mobile column
     override from applying to it; this restates the intent for clarity). */

  /* (2) Overlay header collapsed to one line on mobile: "SCROLL OF FATE —
     DIE CHRONIKEN VON AURATHEL" instead of two stacked lines, and the
     decorative rule/rhombus graphic (.overlay-rule) is dropped entirely. */
  .overlay-rule { display: none; }
  .overlay-header {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
    gap: .35em; padding: 6px 36px 4px 8px;
  }
  .overlay-title { order: 1; font-size: 14px; margin: 0; }
  .overlay-kicker {
    order: 2; font-size: 9px; letter-spacing: .2em; margin: 0;
  }
  .overlay-kicker::before { content: "— "; }
  .policy-notice { flex: 1 0 100%; order: 3; margin: .2em 0 0; padding: 4px 8px; }

  /* (3) General spacer/padding tightening across the overlay tab content —
     was using the same generous desktop spacing (clamp() padding, ~.9em
     margins) which ate too much of the limited mobile screen height. */
  .tab-panel { padding: 6px 8px; }
  .cookie-section-title { margin: .4em 0 .2em; }
  .cookie-text { margin-bottom: .35em; }
  ul.cookie-text { margin: 0 0 .4em 1.1em; }
  .overlay-consent-footer { padding: 6px 8px; gap: 4px; }
  .consent-footer-note { font-size: 10px; }

  /* (4) Tab bar rows — reduced top/bottom padding so the two menu lines
     take minimal vertical space. */
  .overlay-tabs { margin-top: 2px; }
  .overlay-tabs-row { min-height: unset; }
  .tab-btn { padding: 3px 6px; }

  /* (5) TEST VALUE — padding reduced to 2px across buttons/containers/bars
     to reclaim vertical space on mobile. Game-specific elements (inventory,
     vendor, resource chips) are overridden in sof-game.css's own mobile
     block. */
  .choice-btn { padding: 2px; }
  #sof-stats-bar { padding: 2px; }
  .btn-consent-accept, .btn-consent-withdraw, .btn-overlay-close-footer { padding: 2px; }
  .overlay-close { padding: 2px; }
}

/* Landscape phones with viewport height ≥ 360px — hard height cap so
   #sof-play-card scrolls internally (overflow-y:auto) instead of growing
   the page taller than the screen. All currently tested real devices land
   here: Moto Z Play / Huawei P20 Lite (360px), Galaxy S20 FE (360px),
   iPhone 15 (390px), Pixel 7 (412px).
   --device-h is set once from the sof_device_h cookie in sof-ui.js: it is
   the physical CSS landscape height derived from portrait-mode innerWidth —
   --app-vh is measured by sof-ui.js from window.visualViewport, capped at
   deviceLandscapeH (sof_device_h cookie) — so it is already a stable
   hardware-bounded value and never exceeds the physical screen height.
   No overflow:hidden on html or body — old Android/Chrome (Chrome 44)
   blocks touch-event delivery to inner overflow:auto containers when any
   ancestor has overflow:hidden, making .sof-dev-body / #sof-play-card /
   .pc-inventory-scroll unscrollable. Heights on #sof-main/#sof-book are
   set exactly to the visible viewport, so there is no overflow to hide. */
@media (orientation: landscape) and (pointer: coarse) {
  html, body { height: 100%; }
}

@media (orientation: landscape) and (min-height: 360px) and (max-height: 500px) and (pointer: coarse) {
  #sof-main {
    overflow: hidden;
    height: calc(var(--app-vh, 100vh) - var(--nav-h) - var(--footer-h));
  }
  #sof-book {
    height: calc(var(--app-vh, 100vh) - var(--nav-h) - var(--footer-h) - 4px);
  }
}

/* Landscape phones with very small viewport height (<360px) — no hard
   height cap; page scroll is acceptable here since forcing the exact
   viewport height would leave almost no vertical room for game content. */
@media (orientation: landscape) and (max-height: 359px) and (pointer: coarse) {
  #sof-main { height: auto; }
  #sof-book { height: auto; }
}

/* Portrait on a small/touch screen: block the game UI and show the
   rotate-device notice instead. Game UI only ever renders side-by-side
   (landscape) on mobile, so portrait simply isn't a supported layout. */
@media (max-width: 900px) and (orientation: portrait) {
  #sof-rotate-notice { display: flex; }
  #sof-main { display: none; }
}

@media (max-width: 480px) {
  .footer-sep { display: none; }
  #sof-footer { gap: 8px; flex-wrap: wrap; height: auto;
    min-height: var(--footer-h); padding: 6px 12px; }
  .overlay-tabs { padding: 0 4px; }
  /* padding tightened to match the broader mobile rule above (item 4) —
     this query can also match (e.g. a narrow phone still in portrait,
     before rotating, where the cookie overlay can already be showing) and
     previously declared a looser 8px/10px padding afterward in source
     order, which would have won and undone that tightening there. */
  .tab-btn { padding: 3px 6px; font-size: 9px; letter-spacing: .07em; }
}

/* Rotate-notice visuals */
#sof-rotate-notice {
  /* "inset: 0" sizes a fixed element against the browser's LARGE viewport
     (the size assuming toolbars/address bar are hidden), not the visible
     one — on a real mobile browser with the address bar showing, that made
     this element's actual box noticeably bigger than the screen (confirmed
     via DevTools: 608x1248 reported instead of the real 360x740 device
     size). Switching to 100dvw/100dvh ("dynamic viewport" units, meant to
     track the real visible viewport) fixed that real device but then
     produced the OPPOSITE problem in Chrome DevTools' device emulation for
     some presets — dvh/dvw came out smaller than the emulated device size
     there (there's no real toolbar for DevTools to simulate, so its dvh/dvw
     calculation doesn't reliably match the chosen device preset). Rather
     than keep chasing disagreeing viewport-unit behaviors across
     environments, this uses var(--app-vw)/var(--app-vh) — set from
     window.visualViewport (falling back to innerWidth/innerHeight) in
     sof-ui.js, which is the API browsers added specifically to report the
     real currently-visible viewport regardless of toolbar/keyboard state
     — with a 100vw/100vh fallback here only for the brief instant before
     that JS has run. */
  position: fixed; top: 0; left: 0; z-index: 1000;
  width: 100vw; height: 100vh;
  width: var(--app-vw, 100vw); height: var(--app-vh, 100vh);
  /* display itself stays controlled by the "display:none" default (line
     ~710) and the portrait media query's "display:flex" override — not set
     here, since this rule is unconditional and would otherwise always win
     and make the notice permanently visible regardless of orientation. */
  flex-direction: column; align-items: center; justify-content: center;
  gap: 1.2rem; padding: 2rem; text-align: center;
  background: var(--wood); color: var(--parch-light);
}
.rotate-notice-icon {
  font-size: 3rem;
  animation: sof-rotate-hint 1.6s ease-in-out infinite;
}
@keyframes sof-rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(90deg); }
}
.rotate-notice-text {
  font-family: 'Cinzel', serif; font-size: clamp(14px,3vw,18px);
  letter-spacing: .04em; max-width: 28ch;
}


/* ============================================================================
   HERO MANAGEMENT TAB (tab-meine-helden)
   ============================================================================ */

.hero-mgmt-slots {
  font-size: .85rem;
  color: var(--ink-light, #888);
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule-color, rgba(0,0,0,.12));
}

.hero-mgmt-loading,
.hero-mgmt-empty {
  font-size: .9rem;
  color: var(--ink-light, #888);
  text-align: center;
  padding: 1rem 0;
}

.hero-mgmt-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.hero-mgmt-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .5rem;
  border-radius: 6px;
  background: var(--card-inner-bg, rgba(0,0,0,.04));
}

.hero-mgmt-portrait {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.hero-mgmt-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}

.hero-mgmt-name {
  font-family: 'Cinzel', serif;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-mgmt-meta {
  font-size: .78rem;
  color: var(--ink-light, #888);
}

.hero-mgmt-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .3rem;
  flex-shrink: 0;
}

.btn-hero-delete {
  font-size: .78rem;
  padding: .3rem .65rem;
  border-radius: 4px;
  border: 1px solid var(--danger, #b33);
  background: transparent;
  color: var(--danger, #b33);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-hero-delete:hover {
  background: var(--danger, #b33);
  color: #fff;
}
.btn-hero-delete--disabled {
  opacity: .45;
  cursor: not-allowed;
  border-color: var(--ink-light, #888);
  color: var(--ink-light, #888);
}
.btn-hero-delete--disabled:hover {
  background: transparent;
  color: var(--ink-light, #888);
}

.hero-mgmt-confirm {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .3rem;
}

.hero-mgmt-confirm-msg {
  font-size: .78rem;
  max-width: 18rem;
  text-align: right;
  color: var(--danger, #b33);
  margin: 0;
}

.btn-hero-cancel {
  font-size: .78rem;
  padding: .25rem .55rem;
  border-radius: 4px;
  border: 1px solid var(--ink-light, #888);
  background: transparent;
  color: var(--ink-mid, #555);
  cursor: pointer;
}

.btn-hero-delete-confirm {
  font-size: .78rem;
  padding: .25rem .55rem;
  border-radius: 4px;
  border: none;
  background: var(--danger, #b33);
  color: #fff;
  cursor: pointer;
}
.btn-hero-delete-confirm:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.hero-mgmt-err {
  font-size: .78rem;
  color: var(--danger, #b33);
  margin: .2rem 0 0;
}
