/* Astrolabium — eine Nachtszene, bewusst nur dunkel: die Uhr ist ein Instrument
   für den Himmel, Gold und Elfenbein wie auf dem Prager Zifferblatt. */
:root {
  --night: #0b0d1c;          /* Grund */
  --deep: #141a36;           /* Tiefe hinter der Uhr */
  --panel: #151a30;          /* Dialoge */
  --line: #2b3256;
  --gold: #d9b45a;
  --gold-soft: rgba(217, 180, 90, .55);
  --ivory: #f3e6c8;
  --muted: #a9a58f;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 45%, var(--deep), var(--night) 70%);
  color: var(--ivory); font: 15px/1.5 var(--sans); overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* the dial fills the window; on wide windows the bar sits above it */
.stage { position: fixed; inset: 0; }
.dial { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.dial:active { cursor: grabbing; }

/* ---- the bar ------------------------------------------------------------------- */
.bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: linear-gradient(rgba(11, 13, 28, .92), rgba(11, 13, 28, .6) 75%, transparent);
  transition: opacity .4s;
}
.title { flex: 1 1 260px; min-width: 0; }
h1 { margin: 0; font: 600 22px/1.15 var(--serif); letter-spacing: .02em; color: var(--gold); }
.when, .what { margin: 1px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when { color: var(--ivory); }

.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--gold); color: #1a1406; font-weight: 600; }

.tools { display: flex; gap: 4px; }
.tools button {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent;
  padding: 6px 9px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--ivory);
}
.tools button:hover { border-color: var(--line); background: rgba(255, 255, 255, .04); }
.tools svg { width: 20px; height: 20px; fill: none; stroke: var(--gold); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tools svg .fill { fill: var(--gold-soft); }
@media (max-width: 1100px) {
  .tools span { display: none; }
  /* explanation and glossary keep their names: they are what a newcomer looks for */
  .tools button.lbl { flex-direction: column; gap: 2px; }
  .tools button.lbl span { display: block; font-size: 10.5px; line-height: 1.1; color: var(--gold); }
}

/* wide windows: the clock starts below the bar (in fullscreen the bar steps aside) */
@media (min-width: 641px) {
  :root[data-mode="voll"]:not([data-idle]) .stage { top: var(--bar-h, 84px); }
}

/* phones: title on top, the controls at the bottom within thumb reach */
@media (max-width: 640px) {
  .bar { flex-direction: column; align-items: stretch; gap: 8px; bottom: 0; top: auto;
         padding-bottom: max(10px, env(safe-area-inset-bottom));
         background: linear-gradient(transparent, rgba(11, 13, 28, .7) 25%, rgba(11, 13, 28, .94)); }
  .title { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 16px; right: 16px; }
  .seg { align-self: center; }
  .tools { justify-content: space-around; }
  .tools button { padding: 8px; }
  .tools svg { width: 24px; height: 24px; }
  :root[data-mode="voll"] .stage { bottom: 104px; }
}

/* fullscreen: the controls step aside until the mouse or a finger moves */
:root[data-idle] .bar { opacity: 0; pointer-events: none; }
:root[data-idle] .dial { cursor: none; }

/* ---- wallpaper and mini window: the clock alone ---------------------------------------- */
:root[data-mode="hintergrund"] .bar, :root[data-mode="hintergrund"] .mini-tools { display: none; }
:root[data-mode="hintergrund"] .dial { pointer-events: none; cursor: default; }
@media (max-aspect-ratio: 4/5) {          /* phone wallpaper: below the lock screen's own clock */
  :root[data-mode="hintergrund"] .stage { top: 11vh; bottom: 5vh; }
}
:root[data-mode="mini"] .bar { display: none; }
.mini-tools { display: none; }
:root[data-mode="mini"] .mini-tools { display: block; position: fixed; top: 6px; right: 8px; z-index: 2; opacity: 0; transition: opacity .3s; }
:root[data-mode="mini"]:hover .mini-tools { opacity: 1; }
.mini-tools a { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; text-decoration: none;
                color: var(--gold); background: rgba(11, 13, 28, .8); border: 1px solid var(--line); font-size: 17px; }

/* ---- dialogs --------------------------------------------------------------------------- */
.dlg {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  border: 1px solid var(--line); border-radius: 18px; padding: 22px 22px 18px;
  background: var(--panel); color: var(--ivory); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.dlg-wide { width: min(640px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 6, 14, .6); backdrop-filter: blur(3px); }
.dlg h2 { margin: 0 0 8px; font: 600 21px/1.2 var(--serif); color: var(--gold); text-wrap: balance; }
.dlg h3 { margin: 18px 0 4px; font: 600 16px/1.3 var(--serif); color: var(--gold); }
.dlg p, .dlg li { max-width: 65ch; }
.dlg ul { margin: 6px 0; padding-left: 20px; }
.dlg li { margin: 4px 0; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 0; padding: 10px 14px 12px; }
legend { padding: 0 6px; font-weight: 600; color: var(--gold); }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field select, .copy input {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line);
  background: #0e1226; min-width: 0;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.copy { display: flex; gap: 8px; }
.copy button { flex: none; border-radius: 999px; padding: 8px 16px; cursor: pointer; border: 1px solid var(--line); background: transparent; }
.copy button:hover { background: rgba(255, 255, 255, .05); }
.howto { font-size: 14px; color: var(--muted); }
.howto strong { color: var(--ivory); }
.preview { display: block; margin: 12px auto 4px; max-width: 100%; max-height: 240px; border-radius: 10px;
           border: 1px solid var(--line); background: var(--night); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.actions.left { justify-content: flex-start; margin-top: 6px; }
.actions button { border-radius: 999px; padding: 8px 18px; cursor: pointer; border: 1px solid var(--line); background: transparent; }
.actions .pri { background: var(--gold); border-color: var(--gold); color: #1a1406; font-weight: 600; }
.actions .ghost:hover { background: rgba(255, 255, 255, .05); }

@media (prefers-reduced-motion: reduce) { .bar, .mini-tools { transition: none; } }

/* ---- glossary ---------------------------------------------------------------------------- */
.tbl { overflow-x: auto; }
.gl-t { width: 100%; border-collapse: collapse; font-size: 14px; }
.gl-t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; }
.gl-t td { padding: 5px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.gl-t td.g { width: 3.2em; color: var(--gold); font: 20px/1.2 "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", "DejaVu Sans", var(--serif); white-space: nowrap; }
.gl-d { margin: 0; }
.gl-d .term { padding: 8px 0; border-top: 1px solid var(--line); }
.gl-d dt { font: 600 16px/1.3 var(--serif); color: var(--gold); }
.gl-d dd { margin: 2px 0 0; color: var(--ivory); max-width: 65ch; }
.gl-h[hidden], .tbl[hidden], .term[hidden], .gl-t tr[hidden] { display: none; }

/* ---- imprint and privacy ------------------------------------------------------------------ */
.legal-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 16px 0 0; font-size: 13px; }
.legal-links a { color: var(--muted); text-underline-offset: 3px; }
.legal-links a:hover { color: var(--ivory); }
