/*
 * villa-mobile.css — Mobile-Layout-Override für Villa-Räume
 * Triggert auf Touch-Geräten in beiden Orientierungen
 * Stand 24.05.2026 — Claude Code für Lutz (Pilot: Foyer)
 */

@media (max-width: 768px), (pointer: coarse) and (max-height: 600px) {

  /* ─── Top-Nav komplett ausblenden (mobile Nav läuft über Sheet) ─ */
  nav.room-nav { display: none !important; }

  /* ─── Status-Bar: dezent unten rechts ─────────────────────────── */
  .statusbar {
    top: auto !important;
    bottom: 10px !important;
    right: 10px !important;
    font-size: 10px !important;
    padding: 4px 9px !important;
    letter-spacing: 1px !important;
    opacity: .7;
  }

  /* ─── Hint + Service-Bar im Mobile weg ────────────────────────── */
  .hint, .service-bar {
    display: none !important;
  }

  /* ─── Body/Scene: kein Page-Scroll, Inhalt im Sheet ───────────── */
  html, body {
    overflow: hidden !important;
    height: 100vh !important;
  }
  .scene {
    /* Aspect-Ratio behalten, statt height zu forcen → kein Crop */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 60px auto 14px !important;
    width: 96vw !important;
    max-width: 96vw !important;
    height: auto !important;
    aspect-ratio: 16/9 !important;
    /* Fallback wenn aspect-ratio nicht supported */
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: #000 !important;
  }

  /* SVG-Hotspots auf Mobile dezent ────────────────────────────── */
  svg.hotspots .hot { stroke: transparent !important; }

  /* Speech-Bubble auf Bild ausblenden — Begrüßung wandert in den Chat */
  .speech { display: none !important; }

  /* ─── Mobile-Sheet: feste Höhe, Räume scrollen innen ──────────── */
  .villa-mobile-sheet {
    position: relative;
    margin: 0 8px 18px 8px;
    background: rgba(15, 10, 6, .9);
    border: 1px solid rgba(201, 168, 76, .4);
    border-radius: 14px;
    padding: 12px;
    backdrop-filter: blur(8px);
    z-index: 40;
    display: flex;
    flex-direction: column;
    /* Scene = 96vw breit, 16:9 → 54vw hoch; plus 60+14+18px margins */
    max-height: calc(100vh - 54vw - 92px);
    overflow: hidden;
  }
  .vm-rooms {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
  }
  .villa-mobile-sheet h3 {
    margin: 0 0 10px 0;
    font: 11px ui-monospace, 'JetBrains Mono', monospace;
    color: rgba(201, 168, 76, .8);
    letter-spacing: 2px;
    text-transform: uppercase;
  }
  /* ─── Chat-Area (Standard) ───────────────────────────────────── */
  .vm-chat {
    background: rgba(20, 14, 8, .6);
    border: 1px solid rgba(201, 168, 76, .25);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
  }
  .vm-chat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px 8px;
    border-bottom: 1px solid rgba(201, 168, 76, .15);
    margin-bottom: 8px;
  }
  .vm-chat-who {
    font: 11px ui-monospace, 'JetBrains Mono', monospace;
    color: #d4b870;
    letter-spacing: 2px;
    text-transform: uppercase;
  }
  .vm-tts-toggle {
    background: transparent !important;
    border: none !important;
    color: #d4b870 !important;
    font-size: 16px !important;
    padding: 4px 6px !important;
    min-height: 0 !important;
    cursor: pointer;
  }
  .vm-chat-log {
    min-height: 90px;
    max-height: 16vh;
    overflow-y: auto;
    padding: 6px 2px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .vm-bubble {
    padding: 8px 11px;
    border-radius: 10px;
    margin: 4px 0;
    font: 14px/1.4 system-ui, -apple-system, sans-serif;
    max-width: 88%;
    word-wrap: break-word;
  }
  .vm-bubble.vm-me {
    background: rgba(201, 168, 76, .18);
    color: #f0e0b8;
    margin-left: auto;
    border-bottom-right-radius: 3px;
  }
  .vm-bubble.vm-bot {
    background: rgba(40, 28, 18, .7);
    color: #d4b870;
    border-bottom-left-radius: 3px;
  }
  .vm-chat-form {
    display: flex;
    gap: 6px;
    margin-top: 4px;
  }
  .vm-chat-input {
    flex: 1;
    background: rgba(15, 10, 6, .85) !important;
    border: 1px solid rgba(201, 168, 76, .3);
    color: #f0e0b8;
    padding: 11px 13px !important;
    border-radius: 8px;
    font: 15px system-ui, -apple-system, sans-serif !important;
    resize: none;
    outline: none;
    min-height: 70px;
  }
  .vm-chat-input:focus {
    border-color: rgba(201, 168, 76, .7);
  }
  .vm-chat-send {
    background: rgba(201, 168, 76, .25) !important;
    border: 1px solid rgba(201, 168, 76, .5) !important;
    color: #f0e0b8 !important;
    padding: 0 14px !important;
    border-radius: 8px !important;
    min-height: 0 !important;
    font: 12px ui-monospace, 'JetBrains Mono', monospace !important;
    cursor: pointer;
  }

  /* ─── Foyer: Zimmer-Liste (editorial, feine Linien) ───────────── */
  .vm-rooms {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .vm-btn-room {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(201, 168, 76, .12);
    color: #d4b870;
    padding: 13px 6px;
    font: 17px/1.3 'Cormorant Garamond', 'Georgia', serif;
    letter-spacing: .015em;
    text-align: left;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: color .15s;
  }
  .vm-btn-room:last-child { border-bottom: none; }
  .vm-btn-room:active { color: #f0e0b8; }
  .vm-btn-room .room-ico {
    font-size: 16px;
    opacity: .8;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
  }

  /* Highlight-Items: Titel + dezenter Sub (Source) */
  .vm-btn-highlight {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(201, 168, 76, .12);
    color: #d4b870;
    padding: 11px 6px;
    text-align: left;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: color .15s;
  }
  .vm-btn-highlight:last-child { border-bottom: none; }
  .vm-btn-highlight:active { color: #f0e0b8; }
  .vm-h-title {
    font: 15px/1.3 'Cormorant Garamond', 'Georgia', serif;
    color: #e4c87a;
  }
  .vm-h-sub {
    font: 10px/1 ui-monospace, 'JetBrains Mono', monospace;
    color: rgba(201, 168, 76, .55);
    letter-spacing: 1.5px;
    text-transform: uppercase;
  }

  /* ─── Salon-Tripod: Conrad/Lina/Hermes-Diskussion ─────────────── */
  .vm-tripod { padding: 4px 2px; }
  .vm-tripod-turn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    margin-bottom: 9px;
    border-radius: 10px;
    border-left: 3px solid;
  }
  .vm-sp-name {
    font: 10px ui-monospace, 'JetBrains Mono', monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
  }
  .vm-sp-text {
    font: 14px/1.4 'Cormorant Garamond', 'Georgia', serif;
    color: #e4c87a;
  }
  .vm-sp-source {
    font: 9px ui-monospace, 'JetBrains Mono', monospace;
    color: rgba(201, 168, 76, .4);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
  }
  /* Conrad — kühles Blaugrau */
  .vm-sp-conrad {
    background: rgba(40, 50, 65, .45);
    border-left-color: #7fa5c7;
  }
  .vm-sp-conrad .vm-sp-name { color: #7fa5c7; }
  /* Lina — warmer Rosenton */
  .vm-sp-lina {
    background: rgba(70, 40, 45, .45);
    border-left-color: #d49584;
  }
  .vm-sp-lina .vm-sp-name { color: #d49584; }
  /* Hermes — Gold */
  .vm-sp-hermes {
    background: rgba(50, 40, 20, .55);
    border-left-color: #c9a84c;
  }
  .vm-sp-hermes .vm-sp-name { color: #c9a84c; }

  /* ─── Nav (max 2) + Content (max 3) ──────────────────────────── */
  .vm-nav, .vm-content {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
  }
  .vm-nav { grid-template-columns: 1fr 1fr; }
  .vm-content { grid-template-columns: 1fr 1fr 1fr; }
  .vm-btn {
    border-radius: 10px;
    padding: 12px 10px;
    font: 12px 'JetBrains Mono', ui-monospace, monospace;
    text-align: center;
    cursor: pointer;
    transition: .15s;
    line-height: 1.25;
    min-height: 50px;
    word-break: break-word;
  }
  .vm-btn-nav {
    background: rgba(201, 168, 76, .18);
    border: 1px solid rgba(201, 168, 76, .45);
    color: #f0e0b8;
    font-weight: 600;
  }
  .vm-btn-content {
    background: rgba(30, 20, 12, .7);
    border: 1px solid rgba(201, 168, 76, .25);
    color: #d4b870;
    font-size: 11px;
  }
  .vm-btn:active {
    transform: scale(.97);
    border-color: #c9a84c;
  }

  /* Toggle (LAN/Public-Mode) auf Mobile weg — wird nur Desktop-seitig gebraucht */
  #villa-infobox-toggle { display: none !important; }

  /* ─── Pforte: Bild zentriert + Lock zentral + Intro überspringen ─ */
  body.intro-active .intro-video { display: block !important; }
  body.intro-active .intro-skip  { display: block !important; }
  /* Lock und Greeting sofort sichtbar machen */
  body.intro-active .lock,
  body.intro-active .greeting,
  body.intro-active .statusbar { opacity: 0 !important; pointer-events: none !important; }

  /* Lock zentral statt prozentual positioniert (Bild-Position passt nicht auf Mobile) */
  .lock {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: rgba(15, 10, 6, .85);
    padding: 18px 16px 20px !important;
    border-radius: 14px;
    border: 1px solid rgba(201, 168, 76, .35);
    backdrop-filter: blur(8px);
  }
  .lock-title { font-size: 13px !important; }
  .dials { gap: 6px !important; }
  /* Raeder NATIV (62x96) — JS positioniert Ziffern in fixen 96px-Schritten;
     Verkleinern schob sie aus dem Sichtfenster = leere Raedchen. Fix 04.06.2026 */

  /* Greeting unter dem Lock zentriert */
  .greeting {
    left: 50% !important;
    top: auto !important;
    bottom: 14% !important;
    transform: translateX(-50%) !important;
    text-align: center;
    max-width: 88vw;
    font-size: 16px !important;
  }
}

/* ─── Landscape Phone: Szene links, Bedienung rechts nebeneinander ── */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .intro-video{ position:fixed !important; inset:0 !important; width:100% !important; height:100% !important; max-width:none !important; aspect-ratio:auto !important; transform:none !important; border:none !important; border-radius:0 !important; object-fit:cover !important }

  /* Body bleibt no-scroll (vom Portrait-MQ) */
  html, body {
    overflow: hidden !important;
    height: 100vh !important;
  }

  /* Wrapper als 2-Spalten-Flex: links Szene, rechts Sheet */
  body {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 8px !important;
  }

  /* Szene links: BREITEN-Cap statt Hoehen-Cap.
     Vorher: height:calc(100vh-16px) + aspect-ratio:16/9 -> bei 390px Hoehe
     wurde Szene ~690px breit und frass 80% des Schirms, Labels rechts
     brachen buchstabenweise um. Jetzt: max-width:50% + aspect-ratio:16/9,
     Hoehe folgt aus Breite (max-height als Sicherheits-Cap). */
  .scene {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    width: auto !important;
    max-width: 50% !important;
    height: auto !important;
    max-height: calc(100vh - 16px) !important;
    aspect-ratio: 16/9 !important;
    flex: 0 0 50% !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: #000 !important;
    border: 1px solid rgba(201, 168, 76, .35) !important;
    border-radius: 10px !important;
    box-shadow: 0 0 24px rgba(0, 0, 0, .6) !important;
  }

  /* Sheet rechts: nimmt Restbreite, volle Höhe, scrollt innen */
  .villa-mobile-sheet {
    position: relative !important;
    margin: 0 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    height: calc(100vh - 16px) !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* Chat oben: kompakter, fixed max-height, restlicher Platz für Räume */
  .vm-chat {
    flex: 0 0 auto !important;
    max-height: 45% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .vm-chat-log {
    min-height: 60px !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
  }
  .vm-chat-form {
    flex: 0 0 auto !important;
  }
  .vm-chat-input {
    min-height: 44px !important;
    font: 14px system-ui, -apple-system, sans-serif !important;
    padding: 8px 10px !important;
  }

  /* Raum-Grid: 2 Spalten im Landscape, Touch-tauglich (min 44px) */
  .vm-rooms {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 4px !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .vm-btn-room {
    border: 1px solid rgba(201, 168, 76, .25) !important;
    border-radius: 10px !important;
    padding: 12px 10px !important;
    min-height: 48px !important;
    font: 15px/1.2 'Cormorant Garamond', 'Georgia', serif !important;
    background: rgba(20, 14, 8, .55) !important;
    align-items: center !important;
  }
  .vm-btn-room:active {
    background: rgba(201, 168, 76, .18) !important;
  }

  /* Highlight-Items: gleiches Grid-Item-Verhalten */
  .vm-btn-highlight {
    border: 1px solid rgba(201, 168, 76, .25) !important;
    border-radius: 10px !important;
    padding: 10px !important;
    min-height: 48px !important;
    background: rgba(20, 14, 8, .55) !important;
  }

  /* Nav-/Content-Buttons: 2 bzw. 3 Spalten, größer für Touch */
  .vm-nav {
    grid-template-columns: 1fr 1fr !important;
  }
  .vm-content {
    grid-template-columns: 1fr 1fr 1fr !important;
  }
  .vm-btn {
    min-height: 48px !important;
    padding: 10px 8px !important;
  }

  /* h3 im Sheet kompakter */
  .villa-mobile-sheet h3 {
    margin: 0 0 6px 0 !important;
    font-size: 10px !important;
  }

  /* Statusbar: klein unten links, nicht über Sheet */
  .statusbar {
    bottom: 4px !important;
    right: auto !important;
    left: 8px !important;
    font-size: 9px !important;
    padding: 2px 6px !important;
  }
}
