:root {
    --primary-color:#73453a;
    --accent-color: #83844c;
    --bg-color: #f8f9fa;
    --text-color: #333;

    --xr-ink: #f4f4f2;
    --xr-panel: rgba(12, 16, 14, 0.72);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* =========================================
   Globale UI Elemente (Buttons, Container)
   ========================================= */
.container {
    max-width: 600px;
    padding: 2rem;
    margin: 0 auto;
    text-align: center;
    width: 100%;
}

.header {
    margin-bottom: 2rem;
}

.header h1 {
    color: var(--primary-color);
}

.header h2 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.header p {
    color: #666;
    line-height: 1.5;
}

.card-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ar-button, .btn {
    display: block;
    width: 100%;
    padding: 1.2rem;
    background: var(--primary-color);
    border-radius: 12px;
    border:none;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.ar-button:hover,
.ar-button:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(39, 174, 96, 0.15);
}

.btn-subtitle {
    display: block;
    font-size: 0.85rem;
    font-weight: normal;
    color: #fff;
    margin-top: 5px;
    line-height: 1.3;
}

.back-button {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary-color);
}

.hidden {
    display: none !important;
}

/* =========================================
   Modus: Index (Startseite)
   ========================================= */
.index-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.model-preview {
    width: 100%;
    background: #eef2f5;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.large-model {
    height: 50vh;
    min-height: 350px;
}

model-viewer {
    width: 100%;
    height: 100%;
    outline: none;
}

/* =========================================
   Modus: Navigation
   ========================================= */
.nav-body {
    overflow: hidden;
    background: #000;
}

.nav-overlay {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#camera-stream {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: 1;
}

#arrow {
    position: fixed;
    bottom: 15%;
    left: 50%;
    width: 150px;
    height: 150px;
    color: var(--accent-color);
    filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.8));
    transform-origin: center bottom;
    transform: translateX(-50%) rotateX(45deg);
    transition: transform 0.1s ease-out;
    z-index: 10;
}

#pin {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 80px;
    text-shadow: 0px 4px 6px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

#start-ar-btn {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 80%;
    max-width: 300px;
}



/* =========================================
   Modus: WebXR (Kompass / Three.js)
   ========================================= */
body.webxr-body {
    color: #fff !important;
}


#xr-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}


#download-container {
    margin-top: 15px;
    width: 100%;
    max-width: 320px;
}

#download-text {
    font-size: 13px;
    margin-bottom: 6px;
    color: #ddd;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
}

#download-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-color);
    transition: width 0.2s ease-out;
}

/* ONSCREEN DEBUG LOGS */
#debug-log {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 160px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #00ff66;
    border-radius: 6px;
    padding: 8px;
    font-size: 11px;
    color: #00ff66;
    overflow-y: auto;
    z-index: 100;
    white-space: pre-wrap;
    word-break: break-all;
}

#statusText {
    position: absolute;
    color: white;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 14px;
    border-radius: 16px;
    font-size: 13px;
    z-index: 5;
    text-align: center;
    max-width: 85%;
    pointer-events: none;
}

#retryFloorBtn {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 14px;
    border:none;
    border-radius: 16px;
    font-size: 13px;
    z-index: 5;
    text-align: center;
    cursor: pointer;
    z-index: 5;
}

#compassBox {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 8px;
    z-index: 5;
    width: 240px;
    text-align: center;
}

.badge-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}

#compassBar,
#compassBadgeBar {
    height: 100%;
    width: 0%;
    background: #2196F3;
    transition: width 0.2s;
}

#calibBox {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 10px;
    border-radius: 10px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.calib-row {
    display: flex;
    gap: 6px;
}

.calib-btn {
    background: #444;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

#toggleCalibBtn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

#xr-compassBadge {
    position: absolute;
    top: 50px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    display: none;
    z-index: 5;
}

.hidden {
    display: none !important;
}


/* --- Navigation im WebXR Startbildschirm --- */
#bg-camera {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Dunkelt die Kamera leicht ab */
    z-index: 2;
}

.nav-content {
    position: relative;
    z-index: 3;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.nav-content h2 {
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

#gps-container {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 40px;
    border: 1px solid rgba(255,255,255,0.2);
}

#nav-arrow {
    width: 120px;
    height: 120px;
    color: var(--accent-color);
    filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.8));
    transform-origin: center center;
    transition: transform 0.15s ease-out;
}

#start-controls {
    position: relative;
    z-index: 3;
    width: 100%;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}