/* ==========================================================================
   Wortschatz — gemeinsames Stylesheet für Landing, App und Druckfassung.
   Gestalt: klassisches Wörterbuch. Papier, Bordeaux, Serifen, Geduld.
   ========================================================================== */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --paper: #f6f1e6;
  --card: #fffdf6;
  --ink: #2b2520;
  --muted: #6f6557;
  --accent: #8c2f39;          /* Bordeaux — das Rot alter Lexika */
  --accent-ink: #ffffff;
  --gold: #b08a3e;
  --border: #e3dac6;
  --border-strong: #cfc3a9;
  --shadow: 0 1px 2px rgba(60, 45, 20, .08), 0 8px 28px rgba(60, 45, 20, .10);
  --wash: #efe8d8;            /* leicht dunklere Papierfläche */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1712;
    --card: #23201a;
    --ink: #eae2d2;
    --muted: #a89d8a;
    --accent: #d2727c;
    --accent-ink: #241014;
    --gold: #cfa85c;
    --border: #383226;
    --border-strong: #4a4232;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
    --wash: #201c16;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Sprachumschaltung der Landingpage: html[lang] blendet .only-de/.only-en um */
html[lang="de"] .only-en { display: none !important; }
html[lang="en"] .only-de { display: none !important; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; }

button { font-family: var(--sans); cursor: pointer; }

.btn {
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  padding: .6rem 1.1rem;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .12s ease;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.ghost { background: transparent; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

/* --------------------------------------------------------------------------
   Wörterbuchartikel — die zentrale Gestalt, auf Landing, App und im Druck
   -------------------------------------------------------------------------- */

.entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 0 0 .8rem;
}

.entry .headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem .6rem; }

.entry .word {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.entry .article { font-size: 1.05rem; font-style: italic; color: var(--muted); }
.entry .pron { color: var(--muted); font-size: .95rem; }
.entry .pos { font-style: italic; color: var(--accent); font-size: .95rem; }

.entry .meanings { margin: .45rem 0 0; padding: 0; list-style: none; }
.entry .meanings li { margin: .2rem 0; padding-left: 1.5rem; text-indent: -1.5rem; }
.entry .meanings .num { color: var(--accent); font-weight: 700; margin-right: .45rem; }
.entry .example { font-style: italic; color: var(--muted); }
.entry .example::before { content: "‹"; margin-right: .15rem; color: var(--border-strong); }
.entry .example::after { content: "›"; margin-left: .15rem; color: var(--border-strong); }

.entry .originblock {
  margin-top: .7rem;
  padding: .7rem .9rem;
  background: var(--wash);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  font-size: .95rem;
}
.entry .originlabel {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: .15rem;
}

.entry .meta {
  margin-top: .55rem;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .9rem;
}

.entry .tags { display: inline-flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.entry .tag {
  font-family: var(--sans);
  font-size: .72rem;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 99px;
  padding: .1rem .55rem;
}

.entry .actions { margin-top: .7rem; display: flex; flex-wrap: wrap; gap: .5rem; }

/* --------------------------------------------------------------------------
   Landingpage
   -------------------------------------------------------------------------- */

.landing header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.1rem 1.2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}
.brand svg { display: block; }

.top nav { display: flex; align-items: center; gap: .6rem; }

.hero {
  max-width: 1060px;
  margin: 0 auto;
  padding: 3rem 1.2rem 3.5rem;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 840px) { .hero { grid-template-columns: 1fr; padding-top: 1.5rem; } }

.hero h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); margin: 0 0 1rem; }
.hero h1 em { color: var(--accent); font-style: italic; }
.hero .lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 1.6rem; max-width: 34rem; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.hero .honest {
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
}

.specimen {
  transform: rotate(1.2deg);
  box-shadow: var(--shadow);
  position: relative;
}
.specimen::before {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  transform: rotate(-2deg);
  z-index: -1;
  background: var(--wash);
}

section.band { padding: 3.2rem 1.2rem; }
section.band.alt { background: var(--wash); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
section.band > .inner { max-width: 860px; margin: 0 auto; }
section.band > .inner.wide { max-width: 1060px; }

.band h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); margin: 0 0 1rem; }
.band .sub { color: var(--muted); max-width: 40rem; }

.kicker {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: .6rem;
}

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 2rem; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.3rem 1.3rem 1.1rem;
}
.step .n {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.step h3 { margin: .5rem 0 .4rem; font-size: 1.1rem; }
.step p { margin: 0; font-size: .95rem; color: var(--muted); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 2rem; }
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
}
.feature .ico { font-size: 1.4rem; }
.feature h3 { margin: .4rem 0 .35rem; font-size: 1.02rem; }
.feature p { margin: 0; font-size: .92rem; color: var(--muted); }

.pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 2rem; }
@media (max-width: 720px) { .pricing { grid-template-columns: 1fr; } }
.price {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  position: relative;
}
.price.soon { border-style: dashed; }
.price .amount { font-size: 2rem; font-weight: 700; }
.price .per { color: var(--muted); font-size: .9rem; }
.price ul { padding-left: 1.2rem; margin: .8rem 0 0; }
.price li { margin: .3rem 0; font-size: .95rem; }
.price .badge {
  position: absolute;
  top: -0.7rem;
  right: 1rem;
  background: var(--gold);
  color: var(--paper);
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: .2rem .7rem;
}

.faq details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1.2rem;
  margin: .6rem 0;
}
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { color: var(--muted); margin: .6rem 0 0; font-size: .96rem; }

footer.site {
  padding: 2.5rem 1.2rem 3rem;
  text-align: center;
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--muted);
}
footer.site .sibs { margin-top: .5rem; }
footer.site a { color: var(--muted); }

/* Im App-View reicht eine schmale Zeile — der Werkzeugbereich soll führen. */
footer.site.appfoot { padding: 1.4rem 1.2rem 2rem; font-size: .8rem; }
footer.site.appfoot .sibs { margin-top: 0; }
@media print { footer.site.appfoot { display: none; } }

/* --------------------------------------------------------------------------
   App
   -------------------------------------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem 1rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.appbar .brand { font-size: 1.1rem; }
.appbar .spacer { flex: 1; }
.appbar select {
  font-family: var(--sans);
  font-size: .9rem;
  max-width: 40vw;
  padding: .4rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

.menuwrap { position: relative; }
.menupop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 240px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: .4rem;
  display: none;
  z-index: 30;
}
.menupop.open { display: block; }
.menupop button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: .5rem .7rem;
  font-size: .9rem;
  color: var(--ink);
}
.menupop button:hover { background: var(--wash); }
.menupop hr { border: 0; border-top: 1px solid var(--border); margin: .35rem .3rem; }
.menupop button.danger { color: var(--accent); }

main.appmain { max-width: 780px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }

.viewbanner {
  background: var(--wash);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  margin-bottom: 1rem;
  font-family: var(--sans);
  font-size: .92rem;
}
.viewbanner .actions { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .5rem; }

.dicthead { margin: .4rem 0 1.1rem; }
.dicthead h1 { margin: 0; font-size: 1.6rem; }
.dicthead .subtitle { color: var(--muted); font-style: italic; margin: .15rem 0 0; }
.dicthead .stats {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--muted);
  margin-top: .4rem;
}

.searchrow { display: flex; gap: .6rem; margin-bottom: 1rem; }
.searchrow input {
  flex: 1;
  font-family: var(--sans);
  font-size: 1rem;
  padding: .6rem .9rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}
.searchrow input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.wotd {
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, var(--card), var(--wash));
  border-radius: 12px;
  padding: .8rem 1.1rem;
  margin-bottom: 1.1rem;
  cursor: pointer;
}
.wotd .label {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
}
.wotd .word { font-size: 1.25rem; font-weight: 700; }
.wotd .def { color: var(--muted); font-size: .95rem; }

.alpharail {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem;
  margin-bottom: 1rem;
  font-family: var(--sans);
  font-size: .8rem;
}
.alpharail a, .alpharail span {
  display: inline-block;
  min-width: 1.6rem;
  text-align: center;
  padding: .15rem 0;
  border-radius: 6px;
  text-decoration: none;
}
.alpharail a { color: var(--accent); font-weight: 700; }
.alpharail a:hover { background: var(--wash); }
.alpharail span { color: var(--border-strong); }

.lettergroup h2 {
  font-size: 1.1rem;
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
  display: inline-block;
  padding: 0 .5rem .1rem .1rem;
  margin: 1.2rem 0 .6rem;
  scroll-margin-top: 5rem;
}

.entry.clickable { cursor: pointer; transition: border-color .12s ease; }
.entry.clickable:hover { border-color: var(--border-strong); }
.entry .details { display: none; }
.entry.expanded .details { display: block; }
.entry .expandhint {
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--muted);
  margin-top: .5rem;
}
.entry.expanded .expandhint { display: none; }

.emptystate {
  text-align: center;
  padding: 3rem 1rem;
}
.emptystate h2 { margin-bottom: .4rem; }
.emptystate p { color: var(--muted); }
.emptystate ul {
  list-style: none;
  padding: 0;
  margin: 1.2rem auto 1.6rem;
  max-width: 30rem;
  text-align: left;
}
.emptystate li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .9rem;
  margin: .4rem 0;
  font-style: italic;
  color: var(--muted);
}

.welcome {
  max-width: 30rem;
  margin: 3rem auto;
  text-align: center;
}
.welcome input {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.1rem;
  padding: .7rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  margin: 1rem 0 .8rem;
  text-align: center;
}
.welcome .or { color: var(--muted); font-family: var(--sans); font-size: .85rem; margin: 1rem 0 .4rem; }
.welcome .restore { margin-top: 1.6rem; font-family: var(--sans); font-size: .85rem; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 8, .55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  z-index: 50;
  overflow-y: auto;
}
.modal.open { display: flex; }
.modal .box {
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 620px;
  padding: 1.4rem 1.5rem 1.5rem;
}
.modal h2 { margin: 0 0 1rem; font-size: 1.3rem; }

.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
.formgrid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .formgrid { grid-template-columns: 1fr; } }

.field label {
  display: block;
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .25rem;
}
.field input, .field textarea, .field select, .meaningrow > input {
  width: 100%;
  font-family: var(--serif);
  font-size: 1rem;
  padding: .5rem .7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
.field textarea { min-height: 4.2rem; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.meaningrow {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: .7rem .8rem .8rem;
  margin-bottom: .6rem;
}
.meaningrow .rowhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .4rem;
}
.meaningrow .rowhead b {
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.meaningrow .rowhead button {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: .78rem;
  padding: 0;
}
.meaningrow .exlabel { margin-top: .5rem; }

.audiobox {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem .9rem;
  background: var(--wash);
}
.audiobox .hint { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: 0 0 .6rem; }
.audiobox .controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.audiobox .rec-live { color: var(--accent); font-family: var(--sans); font-size: .85rem; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.audiobox audio { height: 34px; max-width: 100%; }

.formactions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.2rem;
}

.sharelink {
  width: 100%;
  font-family: var(--sans);
  font-size: .82rem;
  padding: .6rem .7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  word-break: break-all;
}
.sharemeta { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin-top: .5rem; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: .9rem;
  padding: .6rem 1.1rem;
  border-radius: 99px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
  max-width: min(90vw, 34rem);
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------------------------
   Druckfassung — aus der App wird ein Buch
   -------------------------------------------------------------------------- */

#printBook { display: none; }

@media print {
  @page { margin: 18mm 16mm; }

  body { background: #fff; color: #1a1610; font-size: 10.5pt; }
  body.printing .appbar,
  body.printing main.appmain,
  body.printing .modal,
  body.printing #toast { display: none !important; }

  #printBook { display: block; }

  #printBook .titlepage {
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    page-break-after: always;
  }
  #printBook .titlepage .gem { font-size: 28pt; color: #8c2f39; }
  #printBook .titlepage h1 { font-size: 26pt; margin: .4em 0 .2em; }
  #printBook .titlepage .subtitle { font-style: italic; color: #555; font-size: 12pt; }
  #printBook .titlepage .meta { margin-top: 2.5em; font-size: 9.5pt; color: #777; }

  #printBook .lettergroup h2 {
    font-size: 14pt;
    color: #8c2f39;
    border-bottom: 1.5pt solid #8c2f39;
    margin: 1.2em 0 .5em;
    break-after: avoid;
  }
  #printBook .groupbody { column-count: 2; column-gap: 8mm; }
  #printBook .entry {
    border: 0;
    border-radius: 0;
    padding: 0 0 .7em;
    margin: 0 0 .7em;
    border-bottom: .5pt solid #ddd;
    break-inside: avoid;
    background: none;
  }
  #printBook .entry .word { font-size: 12.5pt; }
  #printBook .entry .originblock {
    background: none;
    border-left: 1.5pt solid #b08a3e;
    padding: .3em .8em;
    font-size: 9.5pt;
  }
  #printBook .entry .originlabel { color: #b08a3e; }
  #printBook .entry .meta { color: #777; font-size: 8pt; }
  #printBook .entry .tag { border-color: #ccc; color: #777; }

  #printBook .bookfooter {
    margin-top: 2em;
    text-align: center;
    font-family: var(--sans);
    font-size: 8pt;
    color: #999;
  }
}
