/* ============================================================
   GameDesign Hub — Dark Theme
   Palette: Obsidian #0b0e14 · Panel #131722 · Border #232a3b
            Akzent Amber (MC-Gold) #f59e0b · Sekundär Indigo #818cf8
   ============================================================ */

:root {
  --bg: #0b0e14;
  --panel: #131722;
  --panel-2: #1a2030;
  --border: #232a3b;
  --text: #e2e8f0;
  --muted: #8b93a7;
  --accent: #f59e0b;
  --indigo: #818cf8;
}

html { color-scheme: dark; }
body { background: var(--bg); color: var(--text); }

.auth-bg {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(129,140,248,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(245,158,11,0.08), transparent 60%),
    var(--bg);
}

/* Logo: 3x3 "Crafting-Grid" als Signatur-Element */
.logo-block {
  width: 44px; height: 44px;
  background:
    conic-gradient(from 90deg at 33.33% 33.33%, transparent 0 25%, var(--border) 0 26%, transparent 0),
    conic-gradient(from 90deg at 66.66% 66.66%, transparent 0 25%, var(--border) 0 26%, transparent 0),
    linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border), 0 8px 24px rgba(245,158,11,0.25);
  image-rendering: pixelated;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245,158,11,0.2);
}
.textarea { resize: vertical; min-height: 70px; }

.btn-primary {
  background: var(--accent); color: #14100a;
  border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: #fbbf24; }

.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.btn-danger {
  background: rgba(239,68,68,0.12); color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.4); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ---------- Sidebar ---------- */
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.active {
  color: var(--accent); background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.25);
}
.nav-ico { width: 18px; height: 18px; flex: none; }

/* ---------- Editor ---------- */
.editor-area {
  min-height: 50vh;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  font-size: 15px; line-height: 1.7;
  outline: none;
}
.editor-area:focus { border-color: var(--indigo); }
.editor-area h1 { font-size: 1.5em; font-weight: 800; margin: 0.6em 0 0.3em; }
.editor-area h2 { font-size: 1.25em; font-weight: 700; margin: 0.6em 0 0.3em; }
.editor-area h3 { font-size: 1.1em; font-weight: 700; margin: 0.5em 0 0.25em; }
.editor-area ul { list-style: disc; padding-left: 1.4em; margin: 0.4em 0; }
.editor-area ol { list-style: decimal; padding-left: 1.4em; margin: 0.4em 0; }
.editor-area blockquote { border-left: 3px solid var(--indigo); padding-left: 12px; color: var(--muted); margin: 0.5em 0; }
.editor-area pre { background: #0d1017; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; overflow-x: auto; margin: 0.5em 0; }
.editor-area code { font-family: ui-monospace, monospace; color: #7dd3fc; }
.editor-area hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }

.toolbar-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.toolbar-btn:hover { color: var(--text); border-color: var(--muted); }

.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid; cursor: pointer; user-select: none;
}

/* ---------- Kanban ---------- */
.kanban-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 290px; flex: none;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 170px);
}
.kanban-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: grab;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.4; }
.kanban-drop { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 14px; }

/* ---------- Tree-View ---------- */
.tree-wrap {
  position: relative; overflow: hidden;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #0d1017;
  border: 1px solid var(--border);
  border-radius: 14px;
  height: calc(100vh - 210px);
  min-height: 420px;
  cursor: grab;
  touch-action: none;
}
.tree-wrap.panning { cursor: grabbing; }
.tree-node {
  position: absolute;
  min-width: 150px; max-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: grab;
  user-select: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.tree-node:active { cursor: grabbing; }
.tree-node.selected { outline: 2px solid var(--accent); }
.tree-node.link-source { outline: 2px dashed var(--indigo); }
.tree-node .tn-title { font-size: 13px; font-weight: 700; }
.tree-node .tn-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tree-node .tn-item { font-size: 11px; margin-top: 4px; color: var(--accent); }

/* ---------- Timeline ---------- */
.tl-grid { display: grid; grid-template-columns: repeat(12, 1fr); }
.tl-bar {
  height: 28px; border-radius: 7px;
  display: flex; align-items: center;
  padding: 0 10px; font-size: 12px; font-weight: 600;
  color: #0b0e14; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Minecraft-Tooltip ---------- */
@font-face {
  font-family: 'MCPixel';
  src: local('Minecraft');
  font-display: swap;
}
.mc-tooltip {
  display: inline-block;
  background: rgba(16, 0, 16, 0.94);
  border: 2px solid transparent;
  border-image: linear-gradient(180deg, #5000FF, #28007F) 1;
  outline: 3px solid rgba(16, 0, 16, 0.94);
  padding: 8px 12px;
  max-width: 100%;
  font-family: 'MCPixel', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
  word-break: break-word;
  image-rendering: pixelated;
}
.mc-line { white-space: pre-wrap; min-height: 1.5em; }
.mc-name { color: #FFFFFF; }
.mc-id   { color: #555555; margin-top: 3px; }
@keyframes mc-obf { 0%{opacity:1} 49%{opacity:1} 50%{opacity:0.15} 100%{opacity:0.15} }
.mc-obf { animation: mc-obf 0.12s steps(2) infinite; }

/* ---------- Command-Output ---------- */
.cmd-box { background: #0d1017; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cmd-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
}
.cmd-box pre {
  margin: 0; padding: 14px;
  font-size: 12.5px; line-height: 1.6; color: #55FF55;
  white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, monospace;
  max-height: 220px; overflow-y: auto;
}

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 6, 10, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  padding: 20px;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent);
  color: var(--text); font-size: 13px; font-weight: 600;
  padding: 9px 18px; border-radius: 999px; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
#toast.show { opacity: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .mc-obf { animation: none; }
  * { transition: none !important; }
}

/* ---------- Tree-View: Zoom-Controls & MiniMap ---------- */
.tree-controls {
  position: absolute; right: 12px; top: 12px;
  display: flex; flex-direction: column; gap: 6px; z-index: 5;
}
.tree-controls button {
  width: 34px; height: 34px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.tree-controls button:hover { border-color: var(--accent); color: var(--accent); }
#tr-minimap {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  background: rgba(13, 16, 23, 0.88);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
}

/* ---------- Item-Sprites ---------- */
.mc-sprite {
  image-rendering: pixelated;
  width: 48px; height: 48px; object-fit: contain;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.35));
}
.mc-sprite-sm { width: 26px; height: 26px; image-rendering: pixelated; object-fit: contain; }

/* ---------- Minecraft-Inventar-GUI ---------- */
.mcgui {
  display: inline-block;
  background: #c6c6c6;
  border: 3px solid;
  border-color: #ffffff #555555 #555555 #ffffff;
  border-radius: 3px;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.mcgui-title {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color: #3f3f3f; font-size: 14px; font-weight: 700;
  margin: 0 2px 8px;
}
.mcgrid { display: grid; gap: 2px; }
.mcslot {
  width: 52px; height: 52px;
  background: #8b8b8b;
  border: 2px solid;
  border-color: #373737 #ffffff #ffffff #373737;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
}
.mcslot img { width: 40px; height: 40px; image-rendering: pixelated; object-fit: contain; pointer-events: none; }
.mcslot .mc-count {
  position: absolute; right: 2px; bottom: 0;
  font-family: ui-monospace, monospace;
  font-size: 15px; font-weight: 700; color: #ffffff;
  text-shadow: 2px 2px 0 #3f3f3f;
  pointer-events: none;
}
.mcslot.drag-over { background: #a0d99b; border-color: #2f5e2b #d9ffd4 #d9ffd4 #2f5e2b; }
.mcslot .mc-fallback {
  font-size: 9px; line-height: 1.1; text-align: center;
  color: #3f3f3f; font-weight: 700; word-break: break-word;
  padding: 2px; pointer-events: none;
}

.inv-lib-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
  cursor: grab; user-select: none;
}
.inv-lib-card:active { cursor: grabbing; }
.inv-lib-card.selected { outline: 2px solid var(--accent); }
.inv-trash {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 14px; text-align: center;
  font-size: 12px; color: var(--muted);
}
.inv-trash.drag-over { border-color: #ef4444; color: #fca5a5; background: rgba(239,68,68,0.08); }

#inv-tip {
  position: fixed; z-index: 90; pointer-events: none; display: none;
}

/* ---------- PDF-Export-Stage (offscreen) ---------- */
#pdf-stage {
  position: absolute; left: -9999px; top: 0;
  width: 794px; background: #0b0e14; color: #e2e8f0;
  padding: 48px; font-size: 15px; line-height: 1.7;
}
#pdf-stage h1 { font-size: 1.6em; font-weight: 800; margin: 0.6em 0 0.3em; }
#pdf-stage h2 { font-size: 1.3em; font-weight: 700; margin: 0.6em 0 0.3em; }
#pdf-stage h3 { font-size: 1.1em; font-weight: 700; margin: 0.5em 0 0.25em; }
#pdf-stage ul { list-style: disc; padding-left: 1.4em; }
#pdf-stage ol { list-style: decimal; padding-left: 1.4em; }
#pdf-stage blockquote { border-left: 3px solid #818cf8; padding-left: 12px; color: #8b93a7; }
#pdf-stage pre { background: #0d1017; border: 1px solid #232a3b; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
#pdf-stage code { font-family: ui-monospace, monospace; color: #7dd3fc; }
.pdf-item { display: flex; align-items: flex-start; gap: 14px; margin: 14px 0; }

/* Eingebettetes Inventar im PDF-Export */
.pdf-inv { margin: 16px 0; }
