/* Stray From The Path
 *
 * Regeln aus docs/destillat.md, Abschnitt 12: enge Palette, harte Kanten, kein Glanz,
 * keine Verlaeufe ueber grosse Flaechen, Farbe nur fuer Bedeutung. Die Oberflaeche soll
 * wie bedrucktes Papier wirken, das lange in einer Tasche lag — nicht wie eine App.
 */

:root {
  --tinte:      #100e0c;
  --grund:      #17150f;
  --grund-hoch: #201d17;
  --linie:      #332e26;
  --schrift:    #ddd5c4;
  --schrift-leise: #8f8776;
  --messing:    #c8903c;
  --blut:       #a5443c;
  --gruen:      #6e8a63;

  --normal:  #b9b2a4;
  --magisch: #6f9dd6;
  --selten:  #d8c56a;
  --einzig:  #c8813c;

  --schrift-familie: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --schrift-technisch: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--tinte);
  color: var(--schrift);
  font-family: var(--schrift-familie);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body { user-select: none; }

.app {
  position: relative;
  height: 100%;
  height: 100dvh;
  max-width: 780px;
  margin: 0 auto;
  background: var(--grund);
  overflow: hidden;
}

/* Feines Korn ueber allem — bricht die Sauberkeit digitaler Flaechen. */
.app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  z-index: 60;
  background-image:
    repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}

/* --- Bildschirme ------------------------------------------------------------------ */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.aktiv { display: flex; }
.screen--mitte { justify-content: center; align-items: center; text-align: center; }
.screen--spiel { padding: 0; overflow: hidden; }

/* --- Titel ------------------------------------------------------------------------ */

.titel { max-width: 30rem; }

.titel__marke {
  width: 82px; height: 82px;
  margin: 0 auto 20px;
  border: 2px solid var(--messing);
  transform: rotate(45deg);
  position: relative;
}
.titel__marke::before,
.titel__marke::after {
  content: "";
  position: absolute;
  background: var(--messing);
}
.titel__marke::before { inset: 16px 50% 16px 50%; width: 2px; margin-left: -1px; }
.titel__marke::after  { inset: 50% 16px 50% 16px; height: 2px; margin-top: -1px; }

.titel__name {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 11vw, 3.3rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 0.95;
  text-transform: uppercase;
}
.titel__name span {
  display: block;
  font-size: 0.36em;
  letter-spacing: 0.42em;
  color: var(--schrift-leise);
  margin: 0.5em 0 0.35em 0.4em;
}

.titel__zeile { color: var(--schrift-leise); font-style: italic; margin: 0 0 32px; }
.titel__knoepfe { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.titel__stand { margin-top: 22px; color: var(--schrift-leise); font-size: 0.84rem; }

.fuss {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center;
}
.fuss__marke {
  font-family: var(--schrift-technisch);
  font-size: 0.62rem;
  color: #4a443a;
  letter-spacing: 0.08em;
}

/* --- Knoepfe ---------------------------------------------------------------------- */

.knopf {
  appearance: none;
  background: var(--grund-hoch);
  color: var(--schrift);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 90ms linear, background 90ms linear;
}
.knopf:active { background: #2a251d; }
.knopf:disabled { opacity: 0.4; cursor: not-allowed; }
.knopf--haupt { border-color: var(--messing); color: var(--messing); }
.knopf--gross { padding: 14px 26px; font-size: 1.05rem; }
.knopf--klein { padding: 7px 12px; font-size: 0.82rem; }
.knopf--leise { color: var(--schrift-leise); }

.ueberschrift {
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.92rem;
  color: var(--schrift-leise);
  margin: 0 0 14px;
}
.ueberschrift--klein { font-size: 0.76rem; margin: 22px 0 10px; }

/* --- Klassenwahl ------------------------------------------------------------------ */

.klassen { display: grid; gap: 10px; width: 100%; max-width: 30rem; margin-bottom: 18px; }

.klasse {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  align-items: start;
  text-align: left;
  background: var(--grund-hoch);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 14px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}
.klasse[aria-pressed="true"] { border-color: var(--messing); background: #241f18; }
.klasse__zeichen {
  width: 46px; height: 46px;
  border: 1px solid var(--linie);
  display: grid; place-items: center;
  font-size: 1.5rem;
  color: var(--messing);
}
.klasse__name { font-size: 1.06rem; margin: 0 0 3px; }
.klasse__zeile { color: var(--messing); font-size: 0.8rem; margin: 0 0 7px; }
.klasse__text { color: var(--schrift-leise); font-size: 0.85rem; line-height: 1.45; margin: 0; }

.namensfeld {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 30rem; margin-bottom: 18px;
}
.namensfeld span {
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--schrift-leise);
}
.namensfeld input {
  flex: 1;
  background: var(--grund-hoch);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 10px 12px;
  color: var(--schrift);
  font-family: inherit;
  font-size: 1rem;
}
.namensfeld input:focus { outline: none; border-color: var(--messing); }

/* --- Kapelle ---------------------------------------------------------------------- */

.hub__kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hub__ort { margin: 0; font-size: 1.5rem; font-weight: 500; letter-spacing: 0.04em; }
.hub__zeile { margin: 4px 0 0; color: var(--schrift-leise); font-style: italic; font-size: 0.88rem; }

.hub__leute { display: flex; gap: 10px; margin: 20px 0 0; }

.person {
  flex: 1;
  background: var(--grund-hoch);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 14px 10px;
  display: grid; gap: 4px; justify-items: center;
  cursor: pointer; color: inherit; font-family: inherit;
}
.person:active { background: #262019; }
.person__figur {
  width: 34px; height: 46px;
  clip-path: polygon(50% 0%, 78% 26%, 70% 100%, 30% 100%, 22% 26%);
}
.person__figur--kaplan { background: linear-gradient(#5a4c3e, #3a322a); }
.person__figur--haendlerin { background: linear-gradient(#43524b, #2b352f); }
.person__name { font-size: 0.95rem; }
.person__rolle {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--schrift-leise);
}

.spruch {
  margin: 16px 0 0;
  padding: 13px 15px;
  border-left: 2px solid var(--messing);
  background: #1c1913;
  color: #c6bda9;
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.5;
  min-height: 1em;
}

.zonen { display: grid; gap: 8px; }

.zone {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  background: var(--grund-hoch);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 12px 14px;
  cursor: pointer; color: inherit; font-family: inherit; text-align: left;
}
.zone:disabled { opacity: 0.35; cursor: not-allowed; }
.zone__name { font-size: 1rem; }
.zone__stufe {
  font-family: var(--schrift-technisch);
  font-size: 0.74rem;
  color: var(--schrift-leise);
}
.zone__zeile {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--schrift-leise);
  font-size: 0.82rem;
  font-style: italic;
}

.hub__fuss { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
.hub__fuss .knopf { flex: 1; }

/* --- Spiel ------------------------------------------------------------------------ */

#buehne { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.hud__oben { display: flex; align-items: center; gap: 10px; }
.hud__oben .knopf { pointer-events: auto; }
.hud__mitte { flex: 1; text-align: center; line-height: 1.2; }
.hud__zone {
  display: block; font-size: 0.86rem; letter-spacing: 0.1em; text-transform: uppercase;
  text-shadow: 0 1px 3px #000;
}
.hud__stufe {
  display: block; font-family: var(--schrift-technisch); font-size: 0.68rem;
  color: var(--schrift-leise);
}

.balken {
  position: relative;
  height: 13px;
  background: #0d0b09;
  border: 1px solid #2a251e;
  border-radius: 1px;
  overflow: hidden;
  min-width: 96px;
  flex: 0 0 34%;
}
.balken--ausdauer, .balken--xp { flex: none; width: 100%; margin-top: 5px; height: 5px; }
.balken--xp { height: 3px; }
.balken__fuellung { height: 100%; width: 100%; transition: width 110ms linear; }
.balken--leben .balken__fuellung { background: linear-gradient(#b04a40, #7d3029); }
.balken--ausdauer .balken__fuellung { background: #4a6a7a; }
.balken--xp .balken__fuellung { background: var(--messing); opacity: 0.75; }
.balken__text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--schrift-technisch);
  font-size: 0.62rem;
  text-shadow: 0 1px 2px #000;
}

.meldungen {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 0.82rem;
  text-shadow: 0 1px 3px #000;
}
.meldung { opacity: 0; animation: einblenden 4s ease forwards; }
.meldung--fund { color: var(--selten); }
.meldung--einzig { color: var(--einzig); font-weight: 600; }
.meldung--stufe { color: var(--messing); }
.meldung--boss { color: var(--blut); font-style: italic; }

@keyframes einblenden {
  0% { opacity: 0; transform: translateY(-3px); }
  8%, 72% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

.hud__unten {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.stick {
  position: relative;
  width: 118px; height: 118px;
  border: 1px solid #2e2820;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 120ms linear;
  pointer-events: none;
}
.stick.sichtbar { opacity: 0.5; }
.stick__knopf {
  position: absolute; top: 50%; left: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border: 1px solid var(--messing);
  border-radius: 50%;
  background: rgba(200,144,60,0.14);
}

.taste-reihe { display: flex; align-items: flex-end; gap: 8px; pointer-events: auto; }
.tasten { display: grid; grid-template-columns: repeat(2, auto); gap: 8px; }

.taste {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid var(--linie);
  background: rgba(32,29,23,0.86);
  color: var(--schrift);
  font-family: inherit;
  display: grid; place-items: center; gap: 1px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  padding: 4px;
}
.taste:active { border-color: var(--messing); }
.taste:disabled { opacity: 0.42; }
.taste__name { font-size: 0.64rem; line-height: 1.1; text-align: center; }
.taste__zahl { font-family: var(--schrift-technisch); font-size: 0.6rem; color: var(--schrift-leise); }
.taste--trank { border-color: #6d3b34; }
.taste__abkling {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.62);
  transform-origin: bottom;
  pointer-events: none;
}

/* --- Overlay ---------------------------------------------------------------------- */

.overlay {
  position: absolute; inset: 0;
  background: rgba(8,7,6,0.86);
  display: grid; place-items: center;
  padding: 16px;
  z-index: 50;
}
.overlay[hidden] { display: none; }

.overlay__karte {
  width: 100%; max-width: 34rem;
  max-height: 100%;
  background: var(--grund);
  border: 1px solid var(--linie);
  border-radius: 2px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.overlay__kopf {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 15px;
  border-bottom: 1px solid var(--linie);
}
.overlay__kopf h3 {
  margin: 0; font-size: 1rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.overlay__inhalt { padding: 15px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* --- Gegenstaende ----------------------------------------------------------------- */

.beutel { display: grid; gap: 7px; }

.gegenstand {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  align-items: center;
  background: var(--grund-hoch);
  border: 1px solid var(--linie);
  border-left-width: 3px;
  border-radius: 2px;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.gegenstand--normal  { border-left-color: var(--normal); }
.gegenstand--magisch { border-left-color: var(--magisch); }
.gegenstand--selten  { border-left-color: var(--selten); }
.gegenstand--einzig  { border-left-color: var(--einzig); }

.gegenstand__name { font-size: 0.96rem; }
.gegenstand--normal  .gegenstand__name { color: var(--normal); }
.gegenstand--magisch .gegenstand__name { color: var(--magisch); }
.gegenstand--selten  .gegenstand__name { color: var(--selten); }
.gegenstand--einzig  .gegenstand__name { color: var(--einzig); }

.gegenstand__slot {
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--schrift-leise);
}
.gegenstand__werte {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  display: grid; gap: 1px;
  font-family: var(--schrift-technisch);
  font-size: 0.76rem;
  color: #9fb08f;
}
.gegenstand__flavour {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  font-style: italic;
  font-size: 0.8rem;
  color: var(--schrift-leise);
}

/* Guete: wie nah der Wurf am Maximum liegt. Ohne diese Rueckmeldung waere ein
 * Beinahe-Treffer nicht als solcher erkennbar (Destillat, Abschnitt 1). */
.guete {
  grid-column: 1 / -1;
  margin-top: 7px;
  height: 2px;
  background: #2a251e;
  position: relative;
}
.guete__wert { height: 100%; background: var(--gruen); }
.guete__marke {
  position: absolute; top: -2px; right: 0;
  font-family: var(--schrift-technisch); font-size: 0.6rem;
  color: var(--schrift-leise);
  transform: translateY(-100%);
}

.leer { color: var(--schrift-leise); font-style: italic; text-align: center; padding: 26px 0; }

/* --- Held ------------------------------------------------------------------------- */

.werte { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin-bottom: 18px; }
.wert { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; }
.wert dt { color: var(--schrift-leise); }
.wert dd { margin: 0; font-family: var(--schrift-technisch); }

.punkte {
  border: 1px solid var(--messing);
  padding: 9px 12px;
  margin-bottom: 14px;
  font-size: 0.86rem;
  color: var(--messing);
}

.faehigkeit {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 3px 10px;
  align-items: center;
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 10px 12px;
  margin-bottom: 7px;
  background: var(--grund-hoch);
}
.faehigkeit__name { font-size: 0.95rem; }
.faehigkeit__punkte { font-family: var(--schrift-technisch); font-size: 0.85rem; }
.faehigkeit__text {
  grid-column: 1 / -1; margin: 2px 0 0;
  color: var(--schrift-leise); font-size: 0.8rem; font-style: italic;
}
.faehigkeit__synergie {
  grid-column: 1 / -1; margin: 4px 0 0;
  font-family: var(--schrift-technisch); font-size: 0.72rem; color: #7d8f74;
}
.faehigkeit__mehr {
  width: 30px; height: 30px; padding: 0;
  font-size: 1.1rem; line-height: 1;
}

/* --- Fundmeldung ------------------------------------------------------------------ */

.fund {
  position: absolute;
  left: 50%; top: 32%;
  transform: translate(-50%, -50%);
  z-index: 55;
  text-align: center;
  pointer-events: none;
  padding: 16px 26px;
  border: 1px solid var(--einzig);
  background: rgba(20,16,12,0.94);
  animation: fundzeigen 2.6s ease forwards;
}
.fund[hidden] { display: none; }
.fund__art {
  font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--schrift-leise);
}
.fund__name { font-size: 1.25rem; margin-top: 5px; color: var(--einzig); }

@keyframes fundzeigen {
  0% { opacity: 0; transform: translate(-50%, -46%); }
  10%, 76% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; }
}

/* --- Handel ----------------------------------------------------------------------- */

.gold {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--schrift-technisch); font-size: 0.86rem;
  color: var(--messing);
  border-bottom: 1px solid var(--linie);
  padding-bottom: 10px; margin-bottom: 13px;
}

.aktion-reihe { display: flex; gap: 7px; margin-top: 10px; }
.aktion-reihe .knopf { flex: 1; }

@media (min-width: 640px) {
  .klassen { grid-template-columns: 1fr; }
  .taste { width: 68px; height: 68px; }
}
