:root{
  --bg: #0B1220;
  --panel: #101a33;
  --panel2: #0f1730;
  --text: #E9EEF9;
  --muted: #AAB6D6;
  --border: rgba(255,255,255,.10);
  --accent: #7bdcff;
  --accent2: #b6ffb0;
  --danger: #ff6b6b;

  --radius: 14px;
  --shadow: 0 10px 24px rgba(0,0,0,.25);

  --fontScale: 1; /* wird per Settings gesetzt */
}

/* High contrast mode (optional) */
:root[data-contrast="high"]{
  --bg: #000000;
  --panel: #0a0a0a;
  --panel2: #000000;
  --text: #ffffff;
  --muted: #d7d7d7;
  --border: rgba(255,255,255,.25);
  --accent: #00e5ff;
  --accent2: #00ff88;
  --danger: #ff4d4d;
}

*{ box-sizing: border-box; }

html, body{
  height:100%;
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: calc(16px * var(--fontScale));
}

a{ color: inherit; text-decoration: none; }

.app-shell{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.topbar{
  position: sticky;
  top:0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(11,18,32,0.98), rgba(11,18,32,0.85));
  border-bottom: 1px solid var(--border);
  padding: 12px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}

.brand-logo{
  width:42px;
  height:42px;
  flex: 0 0 auto;
}

.brand-text{
  min-width:0;
}

.brand-name{
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.1;
}

.brand-sub{
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions{
  display:flex;
  gap: 10px;
  align-items:center;
}

.main{
  flex:1 1 auto;
  padding: 14px 12px 92px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.bottom-nav{
  position: fixed;
  left:0;
  right:0;
  bottom:0;
  background: rgba(16, 26, 51, 0.92);
  border-top: 1px solid var(--border);
  display:flex;
  justify-content:space-around;
  padding: 8px 6px;
  gap: 4px;
  backdrop-filter: blur(10px);
}

.nav-item{
  width: 100%;
  text-align:center;
  padding: 8px 6px;
  border-radius: 12px;
  color: var(--muted);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 4px;
}

.nav-item.active{
  background: rgba(123, 220, 255, 0.15);
  color: var(--text);
  border: 1px solid rgba(123, 220, 255, 0.25);
}

.nav-icon{ font-size: 1.1rem; }
.nav-label{ font-size: .75rem; }

.card{
  background: linear-gradient(180deg, rgba(16, 26, 51, 0.9), rgba(15, 23, 48, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.card + .card{ margin-top: 12px; }

.h1{
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 8px;
}

.p{
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 720px){
  .grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tile{
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  user-select: none;
  transition: transform .06s ease;
}
.tile:active{ transform: scale(0.98); }

.tile-icon{
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.tile-title{
  font-weight: 800;
  margin-bottom: 4px;
}
.tile-sub{
  font-size: .85rem;
  color: var(--muted);
}

.row{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
}

.btn{
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
}
.btn:active{ transform: scale(0.99); }
.btn-primary{
  border-color: rgba(123,220,255,.35);
  background: rgba(123,220,255,.12);
}
.btn-secondary{
  border-color: rgba(182,255,176,.35);
  background: rgba(182,255,176,.12);
}
.btn-danger{
  border-color: rgba(255,107,107,.35);
  background: rgba(255,107,107,.12);
}
.btn-ghost{
  background: transparent;
}

.hidden{ display:none !important; }

hr.sep{
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.kv{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
}
.kv .k{ color: var(--muted); }
.kv .v{ font-weight: 700; }

.label{
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, select{
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: .85rem;
}

.syllables{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.syll{
  display:inline-block;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  user-select: none;
}

.syll[data-ci="0"]{ color: #7bdcff; }
.syll[data-ci="1"]{ color: #b6ffb0; }
.syll[data-ci="2"]{ color: #ffdd7b; }
.syll[data-ci="3"]{ color: #ff9bd1; }
.syll[data-ci="4"]{ color: #bfa7ff; }
.syll[data-ci="5"]{ color: #7bffa9; }
.syll[data-ci="6"]{ color: #ff7b7b; }
.syll[data-ci="7"]{ color: #9bf0ff; }

.syll.active{
  outline: 2px solid rgba(123,220,255,.55);
  background: rgba(123,220,255,.12);
  color: var(--text);
}

.story-text{
  font-size: 1.05rem;
  line-height: 1.65;
}
.story-line{
  margin: 10px 0;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
}
.story-line.active{
  border-color: rgba(123,220,255,.35);
  background: rgba(123,220,255,.08);
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  max-width: min(92vw, 720px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.toast.show{ opacity: 1; }

.small{
  font-size: .9rem;
  color: var(--muted);
}

.callout{
  border: 1px solid rgba(123,220,255,.28);
  background: rgba(123,220,255,.08);
  border-radius: var(--radius);
  padding: 12px;
}