:root{
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --serif: ui-serif, Georgia, "Times New Roman", Times, serif;

  --w: 980px;
  --side: 250px;
  --gap: 18px;
  --radius: 22px;

  --bg: #0a1022;
  --paper: rgba(227,206,185,.94);
  --paper2: rgba(234,219,203,.96);
  --card: rgba(241,233,210,.28);
  --ink: #14110c;
  --muted: rgba(20,17,12,.62);
  --rule: rgba(30,24,16,.12);
  --rule2: rgba(30,24,16,.08);
  --accent: #2f3a52;
  --shadow: 0 18px 56px rgba(0,0,0,.35);
}
html[data-theme="dark"]{
  --bg: #05070f;
  --paper: rgba(14,16,22,.94);
  --paper2: rgba(14,16,22,.82);
  --card: rgba(255,255,255,.06);
  --ink: rgba(245,245,247,.92);
  --muted: rgba(245,245,247,.62);
  --rule: rgba(245,245,247,.14);
  --rule2: rgba(245,245,247,.10);
  --accent: #9fb3ff;
  --shadow: 0 18px 56px rgba(0,0,0,.55);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: var(--serif);
  color: var(--ink);
  background:
    radial-gradient(980px 720px at 15% 10%, rgba(255,255,255,.05), transparent 55%),
    radial-gradient(900px 720px at 85% 20%, rgba(255,255,255,.04), transparent 60%),
    var(--bg);
}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
.hidden{display:none !important;}

/* Outer rounding enforced */
.wrap{
  max-width: var(--w);
  margin: 28px auto;
  padding: 0 14px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--paper);
  clip-path: inset(0 round var(--radius));
  contain: paint;
  isolation: isolate;
}

/* Header */
.topbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  padding: 18px 18px 14px 18px;
  background: var(--paper2);
  border-bottom: 1px solid var(--rule2);
}
.brand__row{ display:flex; align-items:baseline; gap: 14px; }
.brand__name{ letter-spacing:.14em; font-weight:650; font-size:1.72rem; }
.brand__sub{ color: var(--muted); margin-top: 6px; }
.brand__ouro{ width: 44px; height: 44px; opacity:.62; transform: translateY(4px); }
html[data-theme="dark"] .brand__ouro{ opacity:.70; }

.topbar__right{ display:flex; align-items:center; gap: 12px; }

/* Darkmode toggle ~10% smaller */
.mode{
  display:inline-flex; align-items:center; gap: 9px;
  padding: 9px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,.10);
  color: var(--ink);
  cursor:pointer;
}
html[data-theme="dark"] .mode{ background: rgba(255,255,255,.06); }
.mode__track{
  width: 40px; height: 20px;
  border-radius: 999px;
  border: 1px solid var(--rule2);
  background: rgba(0,0,0,.08);
  position: relative;
}
html[data-theme="dark"] .mode__track{ background: rgba(255,255,255,.08); }
.mode__knob{
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(47,58,82,.35);
  position:absolute;
  top: 1px; left: 2px;
  transition: transform .18s ease;
  border: 1px solid var(--rule2);
}
html[data-theme="dark"] .mode__knob{
  transform: translateX(20px);
  background: rgba(159,179,255,.45);
}
.mode__text{ font-family: var(--mono); font-size: .80rem; color: var(--muted); }

/* Borders */
.border{
  height: 6px;
  background-image: url("/assets/img/ui/border-mirror-seamless.png");
  background-repeat: repeat-x;
  background-position: center;
  opacity: .30;
  background-color: var(--paper2);
  border-bottom: 1px solid var(--rule2);
}
.border--bottom{ transform: scaleY(-1); border-top: 1px solid var(--rule2); border-bottom: 0; }

/* Layout */
.layout{ display:flex; gap: var(--gap); background: var(--paper); padding: 18px; }
.side{ width: var(--side); flex: 0 0 var(--side); }
.main{ flex: 1 1 auto; min-width: 0; padding: 2px 4px; }
.h1{ margin: 2px 0 14px 0; font-size: 1.18rem; letter-spacing:.03em; font-weight:650; }

/* Nav */
.nav{ background: rgba(255,255,255,.08); border: 1px solid var(--rule); border-radius: calc(var(--radius) - 4px); padding: 12px; }
.nav__title{ display:flex; align-items:center; gap: 10px; font-weight:700; letter-spacing:.10em; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--rule2); }
.nav__glyph{ width:18px; height:18px; opacity:.62; }
.nav a{ display:flex; align-items:center; gap: 12px; padding: 9px 10px; border-radius: 14px; }
.nav a:hover{ background: rgba(47,58,82,.06); }
.nav__icon{ width:16px; height:16px; opacity:.62; }

/* Cards */
.card{ border: 1px solid var(--rule); border-radius: calc(var(--radius) - 2px); background: var(--card); padding: 16px; margin: 0 0 14px 0; }
.lead{ margin: 0; line-height:1.58; }
.note{ color: var(--muted); line-height:1.58; margin:.7rem 0 0 0; }
.meta{ font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.muted{ color: var(--muted); }
.mono{ font-family: var(--mono); }

/* Buttons + icon sizing */
.btn{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 16px;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,.10);
  color: var(--ink);
}
.btn:hover{ text-decoration:none; background: rgba(47,58,82,.06); }
.btn__icon{ width: 14px; height: 14px; opacity:.65; flex: 0 0 auto; }

/* Toolbar */
.toolbar{ display:flex; align-items:center; justify-content:space-between; gap: 10px; margin-bottom: 10px; }
.search{ width: 100%; max-width: 520px; padding: 11px 12px; border-radius: 16px; border: 1px solid var(--rule); background: rgba(255,255,255,.10); color: var(--ink); outline: none; font-family: var(--serif); }
.search:focus{ border-color: rgba(47,58,82,.35); }

/* Lists */
.list{ display:flex; flex-direction:column; gap: 10px; }
.item{ display:flex; justify-content:space-between; align-items:flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule2); border-radius: 16px; background: rgba(255,255,255,.06); }
html[data-theme="dark"] .item{ background: rgba(255,255,255,.04); }

/* Detail view (Documents/Snippets) */
.detail__head{ display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; margin-bottom: 12px; }
.detail__title{ font-weight:700; font-size: 1.05rem; }
.detail__meta{ color: var(--muted); font-size: .82rem; }
.detail__body{ border-top: 1px solid var(--rule2); padding-top: 12px; }
.detail iframe{ width:100%; height: 740px; border: 1px solid var(--rule2); border-radius: calc(var(--radius) - 2px); background: rgba(0,0,0,.03); }

/* HERO */
.hero__frame{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--rule2);
  overflow: hidden;
  background: rgba(255,255,255,.02);
}
.hero__frame--contain{ padding: 0; }
.hero__img{ width:100%; height:100%; display:block; }
.hero__img--contain{ object-fit: cover; object-position: 50% 52%; opacity: .98; }
html[data-theme="dark"] .hero__img--contain{ opacity:.86; filter: brightness(.92) contrast(1.04); }
.hero__card--below{ margin-top: 14px; }

/* Tabs */
.tabs{ display:flex; gap:10px; margin-bottom: 14px; }
.tab{ padding: 10px 12px; border-radius: 16px; border: 1px solid var(--rule); background: rgba(255,255,255,.10); color: var(--ink); cursor:pointer; font-family: var(--mono); }
.tab.is-active{ background: rgba(47,58,82,.10); }
.tabpane{ display:block; }

/* Frames */
.frame{ position: relative; border: 1px solid var(--rule2); border-radius: calc(var(--radius) - 2px); overflow:hidden; background: rgba(0,0,0,.04); }
.frame iframe{ width: 100%; height: 100%; border: 0; display:block; }
.frame--xl{ height: 560px; }
.frame--xxl{ height: 760px; }

/* YouTube list */
.ytlist{ display:flex; flex-direction:column; gap: 14px; }
.ytcard{ border: 1px solid var(--rule2); border-radius: calc(var(--radius) - 2px); overflow:hidden; background: rgba(255,255,255,.06); }
html[data-theme="dark"] .ytcard{ background: rgba(255,255,255,.04); }
.ytcard__title{ padding: 10px 12px; border-bottom: 1px solid var(--rule2); font-weight:650; }
.ytcard__frame{ height: 420px; }
.ytcard__frame iframe{ width:100%; height:100%; border:0; display:block; }

/* Footer */
.foot{ display:flex; align-items:center; justify-content:space-between; padding: 12px 18px; background: var(--paper2); border-top: 1px solid var(--rule2); }

@media (max-width: 920px){
  :root{ --side: 100%; }
  .layout{ flex-direction: column; }
  .side{ width: auto; }
  .brand__ouro{ width: 38px; height: 38px; }
  .hero__frame{ aspect-ratio: 4 / 3; }
  .ytcard__frame{ height: 280px; }
  .midi__title{ display:none; }
}

/* --- Denkraum patch v23: compact MIDI + nicer PDF reader --- */
.topbar__right{ gap: 10px; }

/* MIDI-Player: EINZIGE Definitionsstelle (statisch oben in .topbar) */

.midi{
  display:flex; align-items:center; gap: 8px;
  padding: 9px 11px;         /* gleiche vertikale Maße wie .mode */
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,.10);
  width: 150px;
  max-width: 150px;
  min-width: 0;
}
html[data-theme="dark"] .midi{ background: rgba(255,255,255,.06); }

.midi__btn{
  width: 28px; height: 20px;  /* Höhe an .mode__track (20px) angepasst */
  border-radius: 999px;
  border: 1px solid var(--rule2);
  background: rgba(0,0,0,.05);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
html[data-theme="dark"] .midi__btn{ background: rgba(255,255,255,.06); }

.midi__btn svg{ width: 11px; height: 11px; opacity:.75; }

.midi__title{
  max-width: none;
  min-width: 0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-family: var(--mono);
  font-size: .80rem;
  color: var(--muted);
}

/* Marquee for long titles (JS toggles .is-marquee + wraps in <span>) */
.midi__title.is-marquee{ text-overflow:clip; }
.midi__title.is-marquee > span{ display:inline-block; padding-left:100%; animation: midi-marquee 10s linear infinite; }
@keyframes midi-marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
/* PDF reader */
.detail__body{ padding-top: 10px; }
.pdfshell{
  border: 1px solid var(--rule2);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(0,0,0,.03);
  height: min(72vh, 860px);
}
.pdfshell iframe{ width: 100%; height: 100%; border: 0; display:block; }
/* ----------------------------------------------------------- */
