:root {
  --bg: #111113;
  --panel: #19191c;
  --panel2: #212125;
  --line: #2c2c31;
  --text: #f1efe9;
  --muted: #9a978f;
  --accent: #c8a46e;
  --accent-ink: #1a1408;
  --danger: #e5484d;
  --ok: #46a758;
  --r: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* Buttons & Inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { border-color: #3b3b42; background: #29292e; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffb4b4; border-color: #4a2526; background: #2a1718; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.active { border-color: var(--accent); color: var(--accent); background: #241f17; }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #141416; outline: none; }
.input:focus { border-color: var(--accent); }
label.f { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; background: radial-gradient(1200px 600px at 20% 10%, #2a2217 0%, #111113 60%); border-right: 1px solid var(--line); }
.auth-hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(38px, 5vw, 64px); line-height: 1.02; margin: 0 0 16px; }
.auth-hero h1 em { color: var(--accent); }
.auth-hero p { color: var(--muted); max-width: 480px; line-height: 1.55; }
.auth-hero .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; max-width: 560px; }
.auth-hero .steps div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--muted); background: rgba(255,255,255,.02); }
.auth-hero .steps b { display: block; color: var(--text); margin-bottom: 4px; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .card { width: 100%; max-width: 400px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand svg { width: 28px; height: 28px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-hero { padding: 28px; min-height: 240px; } .auth-hero .steps { display: none; } }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: rgba(17,17,19,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.page { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }
.page h2 { font-family: var(--serif); font-weight: 500; font-size: 34px; margin: 0 0 4px; }

/* Projektliste */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 22px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s; }
.pcard:hover { transform: translateY(-2px); border-color: #3a3a40; }
.pcard .thumb { height: 140px; background: linear-gradient(135deg, #1f1d1a, #2a2419); display: grid; place-items: center; color: var(--accent); font-family: var(--serif); font-size: 22px; }
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .85; filter: grayscale(.3) contrast(1.05); }
.pcard .body { padding: 14px 16px; }
.pcard .body b { display: block; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: #9be3a9; border-color: #234d2c; }
.empty { text-align: center; padding: 70px 20px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); margin-top: 22px; }

/* Projekt-Arbeitsbereich */
.work { height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.tabs { display: flex; gap: 4px; background: #141416; padding: 4px; border-radius: 11px; border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--panel2); color: var(--text); }
.save-state { font-size: 12px; color: var(--muted); min-width: 90px; text-align: right; }

.editor-wrap { display: grid; grid-template-columns: 56px 1fr 320px; min-height: 0; }
.toolbar { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.tool { width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); position: relative; }
.tool:hover { background: var(--panel2); color: var(--text); }
.tool.on { background: #241f17; border-color: var(--accent); color: var(--accent); }
.tool svg { width: 20px; height: 20px; }
.tool .tip { position: absolute; left: 48px; background: #000; color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .1s; z-index: 5; }
.tool:hover .tip { opacity: 1; }
.toolbar hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.canvas-area { position: relative; min-width: 0; min-height: 0; background: #f6f5f2; }
.canvas-area canvas { display: block; }
.hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(20,20,22,.88); color: #eee; padding: 7px 12px; border-radius: 9px; font-size: 13px; max-width: 90%; text-align: center; pointer-events: none; }
.side { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 16px; }
.side h4 { margin: 18px 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side h4:first-child { margin-top: 0; }
.drop { border: 1.5px dashed #3a3a40; border-radius: 14px; padding: 22px 14px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: #1d1a15; color: var(--text); }
.drop b { color: var(--text); display: block; margin-bottom: 4px; }
.furn { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.furn button { text-align: left; font-size: 12px; padding: 7px 8px; }
.props .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat:last-child { border-bottom: 0; }
.progress { height: 6px; border-radius: 9px; background: #2a2a2f; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* 3D */
.viewer-wrap { display: grid; grid-template-columns: 1fr 320px; min-height: 0; }
.viewer { position: relative; min-height: 0; background: #dfe8ee; overflow: hidden; }
.viewer canvas { display: block; }
.vbar { position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 16px; display: flex; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(17,17,19,.86); backdrop-filter: blur(8px); border: 1px solid #2a2a2f; z-index: 4; flex-wrap: nowrap; overflow-x: auto; max-width: calc(100% - 16px); scrollbar-width: none; }
.vbar::-webkit-scrollbar { display: none; }
.caption { position: absolute; left: 24px; bottom: 84px; padding: 10px 16px; border-radius: 12px; background: rgba(15,15,17,.65); color: #fff; font-weight: 600; font-size: 18px; z-index: 3; pointer-events: none; }
.walkhelp { position: absolute; right: 16px; top: 16px; background: rgba(17,17,19,.78); padding: 8px 12px; border-radius: 10px; font-size: 12px; color: #ddd; z-index: 3; pointer-events: none; }
.rb-joy { position: absolute; left: 24px; bottom: 90px; width: 110px; height: 110px; border-radius: 50%; background: rgba(17,17,19,.35); border: 2px solid rgba(255,255,255,.4); z-index: 5; touch-action: none; }
.rb-joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,.85); }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery figure { margin: 0; position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; }
.gallery img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
video.preview { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #000; }

/* Dialog */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal .card { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.modal.wide .card { max-width: 980px; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.pages button { padding: 6px; background: #fff; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.pages button:hover { border-color: var(--accent); }
.pages img { width: 100%; display: block; }
.pages span { display: block; color: #333; font-size: 12px; margin-top: 4px; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 12px; display: block; margin: 0 auto; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #222226; border: 1px solid #34343a; padding: 10px 14px; border-radius: 10px; max-width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.35); transition: opacity .3s, transform .3s; }
.toast-error { border-color: #6b2a2c; background: #2a1718; }
.toast-ok { border-color: #234d2c; background: #142318; }
.toast.out { opacity: 0; transform: translateY(8px); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); border-top-color: currentColor; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Handy */
@media (max-width: 900px) {
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .tabs button { padding: 6px 8px; font-size: 13px; }
  .work { height: auto; min-height: 100vh; }
  .editor-wrap { grid-template-columns: 1fr; grid-template-rows: auto 62vh auto; }
  .toolbar { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .toolbar hr { display: none; }
  .tool .tip { display: none; }
  .canvas-area { height: 62vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .viewer-wrap { grid-template-columns: 1fr; grid-template-rows: 70vh auto; }
  .caption { bottom: 70px; font-size: 15px; left: 12px; }
  .vbar { bottom: 10px; }
  .vbar .btn.sm { padding: 6px 9px; font-size: 12.5px; }
  .rb-joy { bottom: 70px; }
}
