/* LevelUp – Design 2: Tinte, Creme, Gold. Manrope für Text, Cormorant nur für Zahlen/Titel. */
:root {
  --ink: #0f0e0c;
  --surface: #17140f;
  --track: #2a251d;
  --line: #3b3324;
  --cream: #ece3d0;
  --soft: #cfc4ad;
  --muted: #a39882;
  --gold: #c9a35c;
  --gold-bar: #b49a6c;
  --red: #c4503a;
  --on-gold: #15120d;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app {
  position: relative;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(120% 55% at 85% -10%, #2b2317 0%, rgba(15,14,12,0) 62%),
    radial-gradient(90% 45% at -15% 105%, #2a1510 0%, rgba(15,14,12,0) 58%),
    var(--ink);
  overflow-x: hidden;
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.screen.with-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.pad { padding: 0 24px; }
.col { display: flex; flex-direction: column; gap: 16px; flex: 1; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.push { margin-top: auto; }

/* Typo */
.wordmark { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 26px; color: var(--gold); }
.wordmark.big { font-size: 56px; margin: 0; line-height: 1; }
.h1 { margin: 8px 0 12px; font-family: var(--serif); font-weight: 600; font-size: 36px; line-height: 1; }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.label.gold { color: var(--gold); }
.muted { font-size: 14px; color: var(--muted); }
.error { margin: 0; font-size: 14px; color: #e38a72; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 0; }
.menu-wrap { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 0 0 12px; background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 160px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.menu-item { display: block; width: 100%; height: 46px; padding: 0 14px; background: none; border: 0; text-align: left; font-size: 14px; font-weight: 600; cursor: pointer; }

/* Buttons */
.cta {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 54px; border: 0; background: var(--gold); color: var(--on-gold);
  font-size: 15px; font-weight: 700; letter-spacing: 0.06em; cursor: pointer;
}
.cta.slant { clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); }
.cta:disabled { opacity: .55; cursor: default; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; margin-top: 18px; padding: 0; background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.link-btn { align-self: center; min-height: 44px; padding: 0 12px; background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Login */
.login { display: flex; flex-direction: column; gap: 14px; padding: 18vh 24px 40px; }
.login-sub { margin: 0 0 18px; font-size: 15px; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg-btn { height: 44px; background: transparent; border: 1px solid var(--line); font-size: 14px; font-weight: 600; cursor: pointer; }
.seg-btn.on { border-color: var(--gold); color: var(--gold); background: rgba(201,163,92,.12); }
.form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.form .cta { margin-top: 12px; }
.input {
  width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 0;
  color: var(--cream); font-family: var(--sans); font-size: 16px; outline: none;
}
.input:focus { border-color: var(--gold); }
.area-input { height: 96px; resize: none; line-height: 1.45; }

/* Charakterblatt */
.hero { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 28px; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; }
.hero-row { display: flex; align-items: center; justify-content: space-between; }
.hero-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--gold); }
.chev { transition: transform .2s; }
[aria-expanded="true"] .chev { transform: rotate(180deg); }
.hero-level { display: flex; align-items: flex-end; gap: 16px; }
.hero-level .num { font-family: var(--serif); font-weight: 600; font-size: 100px; line-height: .8; }
.hero-level .title { padding-bottom: 4px; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 26px; color: var(--gold); }
.hero-xp { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--muted); }
.bar { display: block; height: 3px; background: var(--track); }
.bar > span { display: block; height: 100%; width: 0; background: var(--gold-bar); transition: width .5s ease; }
.bar.big { height: 10px; margin-top: 8px; clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.bar.big > span { background: var(--gold); clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }

.areas { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.area-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; row-gap: 6px; }
.area-row .nr { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 18px; color: var(--gold); }
.area-row .nm { font-size: 15px; font-weight: 500; }
.area-row .lv { font-size: 14px; font-weight: 700; }
.area-row .bar { grid-column: 2 / 4; }

.stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 22px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats > div { display: flex; flex-direction: column; gap: 6px; }
.stats > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.stat { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1; }

.bottom-cta { margin-top: auto; padding: 24px 24px 20px; }

/* Eintragen */
.rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0; background: none; border: 0; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 500; cursor: pointer; }
.row-val { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--gold); }

/* Ergebnis */
.xp-big { display: flex; align-items: baseline; gap: 10px; }
.xp-big .num { font-family: var(--serif); font-weight: 600; font-size: 108px; line-height: .9; }
.xp-big .unit { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 32px; color: var(--gold); }
.r-text { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.quote { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 23px; line-height: 1.3; }
.details { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.details-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 54px; padding: 0; background: none; border: 0; font-size: 15px; font-weight: 600; cursor: pointer; }
.details-body { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span:first-child { color: var(--soft); }
.kv span:last-child { font-weight: 700; }
.result-actions { display: flex; flex-direction: column; gap: 8px; }
.levelup { padding: 14px 16px; border: 1px solid var(--gold); background: rgba(201,163,92,.1); font-size: 15px; font-weight: 600; animation: rise .5s ease; }
.levelup b { font-family: var(--serif); font-size: 22px; color: var(--gold); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Verlauf */
.day-head { margin: 22px 0 4px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; padding: 14px 0; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.entry .t { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.entry .x { font-size: 16px; font-weight: 700; color: var(--gold); }
.entry .m { grid-column: 1 / 3; font-size: 13px; color: var(--muted); }
.empty { margin-top: 24px; font-size: 15px; color: var(--muted); }

/* Navigation */
.nav {
  position: fixed; left: 50%; bottom: 0; z-index: 10; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--ink); border-top: 1px solid var(--line);
}
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.nav button.on { color: var(--gold); }

/* Dropfenster */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: rgba(8,7,6,.72); animation: fade .15s ease; }
.sheet-scrim { flex: 1; background: none; border: 0; cursor: pointer; }
.sheet { display: flex; flex-direction: column; gap: 18px; max-height: 85dvh; overflow-y: auto; padding: 14px 24px calc(28px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--gold); animation: up .2s ease; }
.handle { align-self: center; width: 40px; height: 3px; background: var(--line); }
#sheet-body { display: flex; flex-direction: column; gap: 18px; }
.sheet h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 28px; }
.grid6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip { height: 44px; padding: 0; background: transparent; border: 1px solid var(--line); font-size: 15px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { padding: 0 16px; font-size: 14px; }
.opt { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0; background: none; border: 0; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; cursor: pointer; }
.opt::after { content: ''; width: 8px; height: 8px; transform: rotate(45deg); }
.opt.on { color: var(--gold); }
.opt.on::after { background: var(--gold); }
.sheet .cta { height: 50px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%); max-width: 90%; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }

.loading { position: relative; color: transparent !important; }
.loading::after { content: 'KI bewertet …'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--on-gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
