/* Goban – Go lernen & spielen. Mobile-first, warme Holz-Identität. */

:root {
  --bg: #f5f1e8;
  --bg-elev: #fffdf8;
  --ink: #2c241b;
  --ink-soft: #6b5d4d;
  --line: #e3d9c8;
  --accent: #b3541e;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3d3;
  --good: #3d7a3f;
  --bad: #a83a2e;
  --chip: #ece4d4;
  --shadow: 0 2px 10px rgba(60, 40, 10, 0.08);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1611;
    --bg-elev: #262019;
    --ink: #efe7da;
    --ink-soft: #b0a390;
    --line: #3a3226;
    --accent: #e0783a;
    --accent-ink: #221507;
    --accent-soft: #3d2b1c;
    --good: #7fbc81;
    --bad: #e08a7e;
    --chip: #322a20;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: "Zilla Slab", "Georgia", serif;
  line-height: 1.2;
  margin: 0 0 0.4em;
}

button { font: inherit; }

/* ---------- Header / Footer ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.brand-name {
  font-family: "Zilla Slab", serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.header-actions { display: flex; gap: 6px; align-items: center; }

.app-footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
}
.link-button:hover { color: var(--ink); }
.app-footer nav { display: flex; gap: 14px; }

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.06s;
}
.btn:hover { background: var(--chip); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }

.btn-ghost { background: transparent; }
.btn-small { padding: 6px 12px; font-size: 0.9rem; border-radius: 9px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- Layout ---------- */

main {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 14px 24px;
}

.view-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.view-head h2 { margin: 0; font-size: 1.35rem; }
.view-intro { color: var(--ink-soft); margin-top: 0; max-width: 60ch; }

/* ---------- Menü ---------- */

.hero { text-align: center; margin: 18px 0 22px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.hero-sub { color: var(--ink-soft); max-width: 46ch; margin: 0 auto; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.menu-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.menu-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(60, 40, 10, 0.13); }
.menu-card-primary { border-color: var(--accent); }
.menu-card-icon { font-size: 1.6rem; }
.menu-card-title { font-family: "Zilla Slab", serif; font-weight: 700; font-size: 1.15rem; }
.menu-card-sub { color: var(--ink-soft); font-size: 0.88rem; }
.menu-card-progress {
  align-self: flex-start;
  margin-top: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- Lektionen / Probleme Listen ---------- */

.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

.lesson-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  cursor: pointer;
}
.lesson-item:hover { background: var(--chip); }
.lesson-num {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--chip);
  font-weight: 700;
  font-size: 0.9rem;
}
.lesson-item.done .lesson-num { background: var(--good); color: #fff; }
.lesson-item-title { font-weight: 600; }
.lesson-item-sub { display: block; color: var(--ink-soft); font-size: 0.85rem; font-weight: 400; }
.lesson-check { margin-left: auto; color: var(--good); font-weight: 700; }

.problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.problem-card {
  text-align: left;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.problem-card:hover { background: var(--chip); }
.problem-card .p-id { font-size: 0.75rem; color: var(--ink-soft); font-weight: 700; letter-spacing: 0.06em; }
.problem-card .p-title { font-weight: 600; font-size: 0.95rem; }
.problem-card.done { border-color: var(--good); }
.problem-card.done .p-id::after { content: " ✓"; color: var(--good); }

/* ---------- Brett-Layout ---------- */

.board-layout {
  display: grid;
  gap: 14px;
  align-items: start;
}
@media (min-width: 760px) {
  .board-layout { grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); }
}

.board-wrap {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

canvas.goban {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(50, 30, 5, 0.3);
  touch-action: manipulation;
  cursor: pointer;
}

.side-panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.lesson-intro { margin-top: 0; color: var(--ink-soft); font-size: 0.93rem; }
.lesson-task { font-weight: 600; }

.feedback { min-height: 1.4em; margin: 8px 0 0; font-size: 0.95rem; }
.feedback.good { color: var(--good); font-weight: 600; }
.feedback.bad { color: var(--bad); font-weight: 600; }

/* ---------- Info-Bar (Partie) ---------- */

.info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
}
.info-item { color: var(--ink-soft); font-weight: 600; }
.turn-item { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); }
.turn-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #555, #000);
  border: 1px solid rgba(0,0,0,0.4);
}
.turn-dot.white { background: radial-gradient(circle at 35% 30%, #fff, #cfcabe); }

.scoring-panel h3 { margin-bottom: 6px; }
.scoring-help { font-size: 0.88rem; color: var(--ink-soft); margin-top: 0; }
.scoring-live { font-weight: 700; font-size: 1.05rem; }

/* ---------- Dialoge ---------- */

.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 20px;
  max-width: min(480px, 92vw);
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal::backdrop { background: rgba(20, 12, 4, 0.5); }
.modal h3 { font-size: 1.3rem; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.settings-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
.settings-group legend { font-weight: 700; font-size: 0.9rem; padding: 0 6px; }
.honest-note { font-weight: 400; color: var(--ink-soft); }
.radio-row { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; cursor: pointer; }

.seg-row { display: flex; gap: 6px; flex-wrap: wrap; }
.seg {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 14px;
  font-weight: 600;
  cursor: pointer;
}
.seg[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}
.field-row select {
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  max-width: 60%;
}
.hint-note { font-size: 0.82rem; color: var(--ink-soft); margin: 6px 0 0; }

.premium-list { padding-left: 20px; }
.premium-list li { margin: 4px 0; }
.premium-price { font-size: 1.05rem; }
.todo-note {
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.result-headline { font-size: 1.2rem; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.result-table { border-collapse: collapse; width: 100%; }
.result-table th, .result-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.result-table td:nth-child(2), .result-table td:nth-child(3),
.result-table th:nth-child(2), .result-table th:nth-child(3) { text-align: right; }

/* ---------- Werbe-Slot ---------- */

.ad-slot {
  max-width: 1000px;
  width: calc(100% - 28px);
  margin: 0 auto 12px;
  min-height: 64px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Sonstiges ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
