/* crossword.hoshibi.de – flach, Hoshibi Dark. Keine Inline-Styles im HTML (CSP), Größen setzt app.js per CSSOM. */
:root {
  --bg: #09090b; --bar: #0d0f14; --surf: #11131a; --raise: #161922; --raise2: #1c202b;
  --line: rgba(255, 255, 255, .08); --line2: rgba(255, 255, 255, .16);
  --tx: #f4f4f6; --mute: #9ca3af;
  --accent: #c9a96e; --on-accent: #17130a;
  --word: rgba(201, 169, 110, .16); --bad: #e0624f; --good: #4f9d69;
  --cs: 34px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--tx); font: 16px/1.5 var(--sans); }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 12px 24px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--tx); color: var(--bg); padding: 8px 12px; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin: 0 0 6px; font-weight: 600; }
h3 { font-size: 15px; margin: 18px 0 6px; }
.muted { color: var(--mute); }

/* Kopf */
.top { background: var(--bar); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1100px; margin: 0 auto; height: 52px; padding: 0 12px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.mark { width: 26px; height: 26px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border-radius: 4px; font-weight: 800; font-size: 15px; }
.eco { display: flex; gap: 14px; margin-left: 6px; font-size: 14px; }
.eco a { color: var(--mute); text-decoration: none; padding: 4px 0; }
.eco a:hover { color: var(--tx); }
.tools { margin-left: auto; display: flex; gap: 2px; }
.ic { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 4px; color: var(--mute); }
.ic:hover { color: var(--tx); background: var(--raise); }
.ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Reiter */
.tabs { max-width: 1100px; width: 100%; margin: 0 auto; padding: 0 12px; display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 16px 10px; color: var(--mute); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--tx); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--tx); }

/* Leiste, Fortschritt */
.bar { padding: 14px 0 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sel select, .fld select, .fld input, .fld textarea { background: var(--surf); color: var(--tx); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 10px; font: inherit; width: 100%; }
.sel select { width: auto; min-width: 200px; max-width: 100%; }
.fld textarea { font: 14px/1.5 var(--mono); resize: vertical; min-height: 160px; }
.meta { color: var(--mute); font-size: 14px; margin-left: auto; }
.track { height: 3px; background: var(--raise2); border-radius: 2px; overflow: hidden; margin-bottom: 14px; }
.fill { height: 100%; width: 0; background: var(--accent); }

.banner { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line2); background: var(--surf); border-radius: 4px; color: var(--tx); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--tx); color: var(--bg); padding: 9px 14px; border-radius: 4px; font-size: 14px; opacity: 0; pointer-events: none; z-index: 40; max-width: 90vw; }
.toast.on { opacity: 1; }
.empty { color: var(--mute); padding: 32px 0; }

/* Spiel */
.play { display: grid; grid-template-columns: minmax(0, auto) minmax(260px, 1fr); gap: 24px; align-items: start; }
.gridcol { min-width: 0; }
.now { display: flex; gap: 10px; align-items: baseline; min-height: 48px; padding: 8px 10px; background: var(--surf); border: 1px solid var(--line); border-radius: 4px; margin-bottom: 10px; }
.now-n { color: var(--accent); font-weight: 700; white-space: nowrap; }
.gridwrap { overflow-x: auto; padding-bottom: 2px; }
.grid { display: grid; gap: 2px; width: max-content; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cell, .blk { width: var(--cs); height: var(--cs); }
.blk { background: transparent; }
.cell { position: relative; display: grid; place-items: center; background: var(--raise); border: 1px solid var(--line2); border-radius: 2px; cursor: pointer; font-weight: 600; font-size: calc(var(--cs) * .52); line-height: 1; text-transform: uppercase; }
.static .cell { cursor: default; }
.cell .n { position: absolute; top: 1px; left: 3px; font: 600 calc(var(--cs) * .27)/1 var(--mono); color: var(--mute); }
.cell.on { background: var(--word); }
.cell.cur { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cell.cur .n { color: var(--on-accent); }
.cell.bad { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 2px; }
.cell.cur.bad { color: var(--on-accent); }
.cell.rev { color: var(--accent); }
.cell.cur.rev { color: var(--on-accent); }
.kin { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; pointer-events: none; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn { background: var(--raise); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 14px; font-size: 14px; }
.btn:hover:not(:disabled) { background: var(--raise2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.pri:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.danger { color: var(--bad); }

/* Hinweise */
.clues { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; min-width: 0; }
.cl { list-style: none; margin: 0; padding: 0; max-height: 62vh; overflow-y: auto; }
.cl li { margin: 0; }
.cl button { display: flex; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-left: 2px solid transparent; padding: 5px 8px; font-size: 14px; line-height: 1.35; border-radius: 0 3px 3px 0; }
.cl button:hover { background: var(--raise); }
.cl .cn { color: var(--mute); min-width: 2ch; text-align: right; flex: none; }
.cl .len { color: var(--mute); white-space: nowrap; }
.cl .act { background: var(--word); border-left-color: var(--accent); }
.cl .act .cn { color: var(--accent); }
.cl .full .ct { color: var(--mute); text-decoration: line-through; text-decoration-color: var(--line2); }

/* Generator */
.gen { display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr); gap: 28px; padding-top: 18px; align-items: start; }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-size: 13px; color: var(--mute); margin-bottom: 4px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.hint { color: var(--mute); font-size: 13px; margin: 4px 0 10px; }
.hint .e { color: var(--bad); display: block; }
.gen-out .gridwrap { margin-top: 8px; }

/* Dialoge */
dialog { background: var(--surf); color: var(--tx); border: 1px solid var(--line2); border-radius: 6px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.dh { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surf); }
.dh h2 { margin: 0; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--tx); }
.db { padding: 4px 16px 16px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 0 0 10px; }
.keys dt { font-family: var(--mono); color: var(--accent); }
.keys dd { margin: 0; color: var(--mute); }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.nums div { background: var(--raise); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.nums dt { font-size: 12px; color: var(--mute); }
.nums dd { margin: 0; font: 600 20px var(--mono); }

.foot { border-top: 1px solid var(--line); padding: 14px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; color: var(--mute); font-size: 13px; }
.foot a { color: var(--mute); }
.foot a:hover { color: var(--tx); }

.sheet { display: none; }

@media (max-width: 860px) {
  .play, .gen { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .cl { max-height: none; }
}
@media (max-width: 520px) {
  .eco { display: none; }
  .clues { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .nums { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { transition: opacity .15s; }
}

/* Druck: nur das Blatt, schwarz auf weiß */
@media print {
  body.printing > :not(.sheet) { display: none !important; }
  body.printing { background: #fff; color: #000; display: block; min-height: 0; }
  body.printing .sheet { display: block; color: #000; font: 12px/1.35 var(--sans); }
  .sheet h1 { font-size: 20px; margin: 0 0 10px; }
  .sheet .grid { gap: 0; margin-bottom: 14px; }
  .sheet .blk { background: transparent; }
  .sheet .cell { background: #fff; border: 1px solid #000; border-radius: 0; color: #000; font-weight: 600; cursor: default; }
  .sheet .cell .n { color: #000; }
  .sheet .cols { columns: 2; column-gap: 24px; }
  .sheet h2 { color: #000; margin: 6px 0 4px; }
  .sheet ol { list-style: none; margin: 0 0 10px; padding: 0; break-inside: avoid-column; }
  .sheet li { margin: 0 0 2px; }
  .sheet li b { font-family: var(--mono); display: inline-block; min-width: 2.5ch; }
  @page { margin: 14mm; }
}

/* /admin (nur Super-Admin) */
.adm { margin-top: 18px; }
.adm table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm th, .adm td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.adm th { color: var(--mute); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.adm .off { color: var(--mute); }
.adm .w { font-family: var(--mono); word-break: break-word; }
.adm summary { cursor: pointer; color: var(--mute); }
.adm dl { margin: 0 0 12px; }
.adm dt { font-weight: 700; margin-top: 10px; }
.adm dd { margin: 2px 0 0; font-family: var(--mono); }
