:root {
  --night: #12233b;
  --night-2: #1b3354;
  --paper: #fffaf0;
  --ink: #23262d;
  --muted: #6d6a62;
  --red: #b3261e;
  --red-dark: #8c1c16;
  --gold: #e3b24c;
  --green: #2f6b4f;
  --line: #e6dcc6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--night) radial-gradient(circle at 20% 0%, var(--night-2), var(--night) 60%) fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; margin-top: 1.4em; }
a { color: var(--red); }
p { margin: 0 0 1em; }

.top {
  display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; justify-content: space-between;
  padding: .8rem 1.2rem; color: #fff; border-bottom: 1px solid rgba(227, 178, 76, .35);
}
.brand { color: var(--gold); font: bold 1.15rem Georgia, serif; text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; align-items: center; }
.top nav a, .linklike { color: #fff; text-decoration: none; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.top nav a:hover, .linklike:hover { color: var(--gold); }
.inline { display: inline; margin: 0; }

main { width: 100%; max-width: 980px; margin: 0 auto; padding: 1.2rem; flex: 1; }
.foot { text-align: center; color: rgba(255, 255, 255, .5); padding: 1rem; font-size: .85rem; }

.card { background: var(--paper); border-radius: 12px; padding: 1.3rem; margin-bottom: 1.2rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.card > :last-child { margin-bottom: 0; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); font-size: .92rem; }
.crumbs { color: rgba(255, 255, 255, .75); margin-bottom: .8rem; font-size: .92rem; }
.crumbs a { color: var(--gold); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.spread { justify-content: space-between; }

.flash { padding: .7rem 1rem; border-radius: 8px; background: #fff; border-left: 5px solid var(--gold); }
.flash.ok { border-color: var(--green); }
.flash.error { border-color: var(--red); }

label { display: block; font-weight: 600; margin: .9rem 0 .25rem; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: .55rem .65rem; font: inherit; color: inherit;
  border: 1px solid #cfc4ab; border-radius: 8px; background: #fff;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
.hint { font-weight: 400; color: var(--muted); font-size: .88rem; margin: .25rem 0 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }

.btn {
  display: inline-block; padding: .55rem 1.1rem; margin-top: 1rem; border: 0; border-radius: 8px;
  background: var(--red); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--red-dark); }
.btn.secondary { background: #e9dfc8; color: var(--ink); }
.btn.secondary:hover { background: #dccfae; }
.btn.small { padding: .25rem .6rem; margin: 0; font-size: .85rem; }
.btn.good { background: var(--green); }
td .btn, .row .btn { margin-top: 0; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td input, td select { min-width: 5.5rem; }
.answer { white-space: pre-wrap; overflow-wrap: anywhere; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: #eee4cd; color: #5d5338; }
.badge.ok { background: #d8eedd; color: #1e5a3c; }
.badge.bad { background: #f6d9d6; color: #8c1c16; }
.badge.wait { background: #fbeec9; color: #7a5a0c; }

/* Türchen */
.doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.door {
  aspect-ratio: 1; border-radius: 12px; padding: .5rem; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; text-align: center;
  color: #fff; border: 2px solid transparent;
}
.door .n { font: bold 2rem/1 Georgia, serif; }
.door .s { font-size: .74rem; line-height: 1.2; }
.door.locked { background: rgba(255, 255, 255, .06); border: 2px dashed rgba(255, 255, 255, .28); color: rgba(255, 255, 255, .6); }
.door.open { background: var(--red); border-color: var(--gold); box-shadow: 0 0 18px rgba(227, 178, 76, .35); }
.door.open .n { color: var(--gold); }
.door.closed { background: var(--green); }
.door.mine { border-color: #fff; border-style: double; border-width: 4px; }
a.door:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: no-preference) { a.door { transition: transform .15s; } }

.puzzle-body { font-size: 1.05rem; overflow-wrap: anywhere; }
.puzzle-img { max-width: 100%; height: auto; border-radius: 8px; margin: .5rem 0 1rem; }
.solution { background: #f1f7ee; border: 1px solid #c9dfc6; border-radius: 8px; padding: .9rem 1rem; margin-bottom: 1rem; }
.callist { list-style: none; padding: 0; margin: 0; }
.callist li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.callist li:last-child { border-bottom: 0; }

.puzzle-fig { margin: .5rem 0 1rem; }
.puzzle-fig .puzzle-img { margin: 0; display: block; }
.puzzle-fig figcaption { font-size: .82rem; color: var(--muted); margin-top: .3rem; overflow-wrap: anywhere; }
