* { box-sizing: border-box; }
:root {
  --bg:#0a0a0c; --fg:#e8e8ee; --muted:#a9a9b2; --line:#2a2a31;
  --panel: rgba(18,18,22,.94);
}
@media (prefers-color-scheme: light) {
  :root { --bg:#f7f7fa; --fg:#101015; --line:#d8d8e0; --panel: rgba(255,255,255,.98); }
}
html,body { height:100%; }
body {
  margin:0; background:var(--bg); color:var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  display:grid; grid-template-rows:auto 1fr;
}

/* Header */
.top {
  display:flex; align-items:center; justify-content:space-between;
  padding:.8rem 1rem; border-bottom:1px solid var(--line);
}
.brand { letter-spacing:.08em; font-weight:700; }
.header-actions { display:flex; gap:.5rem; align-items:center; }

/* Buttons */
.hamburger, .iconbtn, .close, .ghost {
  background:transparent; color:var(--fg); border:1px solid var(--line); border-radius:6px; cursor:pointer;
}
.hamburger { width:42px; height:32px; display:grid; place-content:center; }
.hamburger span { display:block; width:20px; height:2px; background:var(--fg); margin:2px 0; }
.iconbtn { padding:.35rem .55rem; }
.ghost { padding:.45rem .8rem; }

/* Panels */
.menu, .notes {
  position: fixed; top:0; right:0; width:min(480px,92vw); height:100%;
  background:var(--panel); border-left:1px solid var(--line);
  transform: translateX(100%); transition: transform .25s ease;
  padding:1rem; z-index: 20; backdrop-filter: blur(8px);
}
.menu.open, .notes.open { transform: translateX(0); }
.menu-head, .notes-head { display:flex; align-items:center; justify-content:space-between; }
.menu h2, .notes h2 { margin:0; font-size:1rem; letter-spacing:.08em; }
.close { width:32px; height:32px; }
.overlay { position:fixed; inset:0; background: rgba(0,0,0,.35); z-index:15; }

/* Menu form */
.seedbar { display:flex; gap:.6rem; align-items:center; flex-wrap:wrap; margin-top:.8rem; }
.seedbar input {
  background: transparent; color: var(--fg); border:1px solid var(--line);
  padding:.45rem .6rem; min-width: 12ch; border-radius:6px;
}
.seedbar .row { display:flex; gap:.6rem; align-items:center; }
.seedbar .hint { color:var(--muted); margin:.4rem 0 0; font-size:.85rem; }

/* Notes Panel */
.notes-meta { display:flex; align-items:center; justify-content:space-between; gap:.8rem; margin:.8rem 0; }
.notes-entity { display:flex; align-items:center; gap:.8rem; }
.entity-sketch { width:72px; height:72px; border:1px solid var(--line); border-radius:8px; display:grid; place-items:center; overflow:hidden; }
.notes-editor { display:grid; gap:.5rem; margin:.6rem 0 .8rem; }
.notes-editor input, .notes-editor textarea {
  background: transparent; color: var(--fg); border:1px solid var(--line); border-radius:6px; padding:.5rem .6rem;
}
.notes-list ul, .notes-all ul { list-style:none; padding:0; margin:.35rem 0 0; }
.notes-list li, .notes-all li { padding:.35rem 0; border-bottom:1px dashed var(--line); }
.notes-list a, .notes-all a { color:var(--fg); text-decoration:none; border-bottom:1px dotted var(--line); }

/* Stage & Card */
.stage { display:grid; place-items:center; padding:2rem 1rem; }
.card {
  position: relative;
  width:min(88vw, 560px); min-height: 320px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.00));
  border:1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset, 0 10px 40px rgba(0,0,0,.35);
  padding: 1rem 1.2rem; border-radius: 10px; overflow:hidden;
  transition: transform .16s ease;
}
.card.aging0 {
  border-color: var(--line);
  box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset, 0 10px 40px rgba(0,0,0,.35);
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.00));
  transform: translate(0, 0);
}
.card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:.6rem; gap:.6rem; }
.head-left { display:flex; align-items:center; gap:.5rem; min-width:0; }
.card-id { color:var(--muted); font-size:.9rem; white-space:nowrap; }
.stamp { font-size:.75rem; opacity:.6; letter-spacing:.08em; border:1px solid var(--line); padding:.15rem .4rem; border-radius:999px; white-space:nowrap; }
.badges { display:flex; gap:.35rem; flex-wrap:wrap; justify-content:flex-end; }
.badge { font-size:.72rem; border:1px solid var(--line); padding:.15rem .35rem; border-radius:999px; color: var(--muted); opacity:.85; }

.title { margin:.2rem 0 .4rem; font-size: clamp(1.08rem, 1.2rem + .6vw, 1.65rem); line-height:1.25; }
.note { margin:.25rem 0; color:var(--fg); opacity:.9; }
.meta { margin-top:.6rem; color:var(--muted); font-size:.86rem; }

/* Illustration: Post-it Tab + Panel */
.illus-tab {
  position: absolute;
  top: 2.2rem; right: .8rem;
  padding: .15rem .5rem;
  font-size: .72rem; letter-spacing: .04em;
  border: 1px dashed var(--line);
  background: rgba(255,255,200,.06);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  opacity: .85;
  z-index: 4;
}
.illus-tab:hover { opacity: 1; border-style: solid; }

.illus-panel {
  position: absolute;
  top: 2.6rem; right: .8rem;
  width: min(70%, 360px); min-width: 220px; max-width: 92%;
  background: rgba(255,255,210,.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  transform-origin: top right;
  animation: postit-in .18s ease both;
  backdrop-filter: blur(2px);
  z-index: 4;
}
@keyframes postit-in { from { opacity: 0; transform: scale(.98) translateY(-4px); } to { opacity:1; transform: none; } }

.illus-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .35rem .5rem .2rem .6rem;
  font-size: .78rem; color: var(--muted);
  border-bottom: 1px dashed var(--line);
  user-select: none;
}
.mini-close {
  border: 1px solid var(--line);
  background: transparent; color: var(--fg);
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  line-height: 1;
}

.illus-canvas {
  padding: .6rem .7rem .8rem .7rem;
  min-height: 110px; max-height: 240px; overflow: hidden;
  display: grid; place-items: center;
}

/* leichte „Papier“-Anmutung */
.illus-panel::before {
  content:"";
  position:absolute; inset:0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.03), rgba(255,255,255,.03) 22px,
    rgba(0,0,0,.00) 22px, rgba(0,0,0,.00) 44px
  );
  pointer-events: none;
  border-radius: 10px;
  opacity: .4;
}

/* Inspect */
.inspect { position:absolute; left:0; right:0; bottom:0; padding:.6rem .9rem; background: linear-gradient(180deg, transparent, rgba(0,0,0,.45)); border-top:1px dashed var(--line); font-size:.9rem; }

/* Hinweisbar & Scribble */
.hintbar { position:absolute; left:0; right:0; bottom:.1rem; text-align:center; color:var(--muted); font-size:.85rem; opacity:.9; }
.scribble { position:absolute; bottom:.5rem; right:.6rem; font-size:.8rem; opacity:.5; transform: rotate(-8deg); }

/* Controls */
.controls { display:flex; gap:.6rem; margin-top:1rem; flex-wrap:wrap; justify-content:center; }
.controls button { background: transparent; border:1px solid var(--line); color: var(--fg); padding:.5rem .8rem; cursor:pointer; border-radius:6px; }
.controls button:hover { border-color: var(--fg); }

/* Toast */
.toast { position: fixed; bottom: 14px; right: 14px; padding:.5rem .8rem; border:1px solid var(--line); background: rgba(10,10,12,.75); color: var(--fg); border-radius:6px; backdrop-filter: blur(6px); }

/* Focus-Lens (Leseführung) */
.title.dim span, .note.dim span { opacity:.45; transition: opacity .08s ease; }
.title span.focus, .note span.focus { opacity:1; }

/* Misc */
.fade { animation: fade .36s ease both; }
@keyframes fade { from{ opacity:0; transform: translateY(4px); } to{ opacity:1; transform:none; } }
.hidden { display:none !important; }
