/* ====== Questbuch – Theme ======
   Pergament / Fantasy-Look, abgeleitet aus der Planer-Vorlage. */

:root {
  /* Parchment & ink */
  --bg: #2c2418;            /* dark wood frame behind the "page" */
  --paper: #efe7d4;         /* parchment page */
  --paper-2: #e6dabf;       /* slightly darker parchment */
  --card: #faf5e7;          /* cream cards */
  --card-line: #d9cbab;
  --ink: #463a29;           /* main text */
  --ink-soft: #6f6047;
  --ink-faint: #9b8a6d;

  /* Accents from the cover art */
  --ember: #d9803a;         /* fire / XP */
  --ember-dark: #b85e26;
  --teal: #6fa597;          /* magic / mana */
  --teal-dark: #4f7d72;
  --purple: #9285bd;        /* spirit */
  --gold: #c9a23f;          /* loot / gold */
  --green: #7d9b55;         /* growth / done */
  --danger: #b5503f;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 18px rgba(40, 30, 12, 0.18);
  --shadow-sm: 0 2px 6px rgba(40, 30, 12, 0.14);

  --font-title: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "EB Garamond", Georgia, serif;

  --tabbar-h: 64px;
  --maxw: 560px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(circle at 50% 0%, #3a3020 0%, #221c12 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  background: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(140,110,60,0.025) 0 2px, transparent 2px 4px);
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: 18px 18px calc(var(--tabbar-h) + 24px);
  padding-top: max(18px, env(safe-area-inset-top));
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--font-title); color: var(--ink); margin: 0 0 .4em; letter-spacing: .5px; }
.screen-title {
  font-size: 1.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 6px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.screen-title .emoji { font-size: 1.6rem; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Buttons ---------- */
button { font-family: var(--font-body); cursor: pointer; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.96); }
.btn.ember { background: linear-gradient(160deg, var(--ember), var(--ember-dark)); }
.btn.teal  { background: linear-gradient(160deg, var(--teal), var(--teal-dark)); }
.btn.gold  { background: linear-gradient(160deg, var(--gold), #a8842c); color: #3a2e10; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--card-line); box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: .9rem; }
.btn:disabled { opacity: .45; pointer-events: none; }

.icon-btn {
  background: transparent; border: none; font-size: 1.4rem; padding: 6px; border-radius: 10px; color: var(--ink);
}

/* ---------- Inputs ---------- */
input[type=text], input[type=number], textarea, select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: #fffdf6;
  border: 1.5px solid var(--card-line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}
textarea { resize: vertical; min-height: 80px; }
label.field { display: block; font-weight: 600; margin: 12px 0 5px; font-size: .95rem; }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  background: var(--paper-2); color: var(--ink-soft);
}
.pill.ember { background: rgba(217,128,58,.18); color: var(--ember-dark); }
.pill.teal  { background: rgba(111,165,151,.22); color: var(--teal-dark); }
.pill.gold  { background: rgba(201,162,63,.22); color: #8a6c1f; }
.pill.purple{ background: rgba(146,133,189,.22); color: #6a5e96; }

.diff-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.diff-chip {
  border: 1.5px solid var(--card-line); background: var(--card);
  border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: .9rem; color: var(--ink-soft);
}
.diff-chip.active { color: #fff; border-color: transparent; }
.diff-chip.active[data-diff=easy]   { background: var(--green); }
.diff-chip.active[data-diff=medium] { background: var(--teal-dark); }
.diff-chip.active[data-diff=hard]   { background: var(--ember-dark); }
.diff-chip.active[data-diff=boss]   { background: var(--danger); }

/* ---------- XP / Mana bars ---------- */
.bar { height: 14px; border-radius: 999px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--card-line); }
.bar > span { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.bar.xp > span   { background: linear-gradient(90deg, var(--ember), #f0b06b); }
.bar.mana > span { background: linear-gradient(90deg, var(--teal-dark), var(--teal)); }

/* ---------- Task / list items ---------- */
.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.item.done { opacity: .55; }
.item.done .item-title { text-decoration: line-through; }
.item-title { flex: 1; font-size: 1.05rem; }
.check {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
  border: 2px solid var(--ink-soft); background: transparent;
  display: grid; place-items: center; font-size: 1rem; color: transparent;
}
.check.on { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- Camp / hub grid ---------- */
.camp-hero {
  border-radius: var(--radius); overflow: hidden; position: relative;
  background: linear-gradient(160deg, #4a3b22, #2e2415);
  color: #f3e8cf; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.camp-hero h1 { color: #f5ecd6; font-size: 1.5rem; margin-bottom: 2px; }
.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.hub-tile {
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius);
  padding: 16px 14px; text-align: left; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px; min-height: 96px;
}
.hub-tile .ico { font-size: 1.7rem; }
.hub-tile .name { font-family: var(--font-title); font-weight: 600; font-size: 1.02rem; }
.hub-tile .sub { font-size: .8rem; color: var(--ink-faint); }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--maxw);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(38, 30, 18, .96);
  display: flex; justify-content: space-around; align-items: center;
  border-top: 2px solid #5a4a30; z-index: 50;
}
.tab { background: none; border: none; color: #b6a684; font-size: .68rem; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 10px; }
.tab .ti { font-size: 1.35rem; }
.tab.active { color: var(--ember); }

/* ---------- Toast ---------- */
.toast-layer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 18px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 100; }
.toast {
  background: rgba(38,30,18,.97); color: #f3e8cf; padding: 11px 18px; border-radius: 999px;
  font-weight: 600; box-shadow: var(--shadow); border: 1px solid #6a5836;
  animation: toast-in .3s ease, toast-out .3s ease 2.2s forwards;
  display: flex; align-items: center; gap: 8px;
}
.toast.xp { border-color: var(--ember); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* level-up flash */
.levelup {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 200;
  background: rgba(20,15,8,.6); animation: fade .3s ease;
}
.levelup .burst { font-family: var(--font-title); color: var(--gold); font-size: 2.4rem; text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,.6); animation: pop .5s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

.empty { text-align: center; color: var(--ink-faint); padding: 30px 10px; font-style: italic; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.section-label { font-family: var(--font-title); font-size: 1.1rem; margin: 18px 0 8px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 1px; }
.back-link { background: none; border: none; color: var(--ink-soft); font-size: .95rem; padding: 4px 0; margin-bottom: 6px; }
