/* ============================================================
   Zeichenklang — dunkel, gold, privat, würdevoll
   ============================================================ */

:root {
  --nacht: #06080f;
  --gold: #d9b87c;
  --gold-hell: #ecd9ae;
  --gold-tief: #9a8354;
  --text: #cdbd97;
  --leise: #8d7f60;
  --ganz-leise: #7a6f58;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--nacht);
  color: var(--text);
  font-family: Georgia, 'Palatino', 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* Hintergrundbild fest hinter allem (iOS-sicher, kein background-attachment) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('../img/hintergrund.jpg') center / cover no-repeat;
  z-index: -1;
}

main {
  height: 100vh;   /* Fallback für ältere iOS-Versionen */
  height: 100dvh;
  overflow-y: auto; /* falls es je zu eng wird: scrollen statt abschneiden */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 18px)
           max(env(safe-area-inset-left, 0px), 20px)
           calc(env(safe-area-inset-bottom, 0px) + 12px)
           max(env(safe-area-inset-right, 0px), 20px);
}

/* ---------- Kopf ---------- */
header h1 {
  font-size: 1.06rem;
  font-weight: normal;
  letter-spacing: 0.42em;
  text-indent: 0.42em; /* gleicht das letzte Spacing aus */
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(217, 184, 124, 0.35);
}

header .claim {
  margin-top: 7px;
  font-size: 0.72rem;
  font-style: italic;
  letter-spacing: 0.06em;
  color: var(--leise);
  text-shadow: 0 1px 10px rgba(6, 8, 15, 0.85), 0 0 3px rgba(6, 8, 15, 0.7);
}

/* ---------- das Siegel ---------- */
#siegel {
  position: relative;
  width: min(76vw, 44vh, 420px);
  aspect-ratio: 1;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

#siegel img {
  position: absolute;
  inset: -9%;
  width: 118%;
  height: 118%;
  pointer-events: none;
  /* Bildrand garantiert vollständig in den Hintergrund auflösen */
  -webkit-mask-image: radial-gradient(circle closest-side, #000 82%, transparent 100%);
          mask-image: radial-gradient(circle closest-side, #000 82%, transparent 100%);
}

#siegel .ruht { opacity: 1; transition: opacity 2.6s ease; }
#siegel .an   { opacity: 0; transition: opacity 2.6s ease; }

body.fliesst #siegel .ruht { opacity: 0; }
body.fliesst #siegel .an   { opacity: 1; }

/* atmen, wenn der Klang fließt */
@keyframes atmen {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.028); }
}
body.fliesst #siegel {
  animation: atmen 8.5s ease-in-out infinite;
}

/* weicher Lichthof hinter dem Siegel */
#siegel::before {
  content: '';
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 184, 124, 0.16) 0%, transparent 62%);
  opacity: 0;
  transition: opacity 3s ease;
  pointer-events: none;
}
body.fliesst #siegel::before { opacity: 1; }

/* ---------- Status ---------- */
#status {
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  color: var(--text);
  min-height: 1.3em;
  opacity: 0.92;
  /* steht im hellsten Bereich des Hintergrunds → unsichtbarer dunkler Hauch */
  text-shadow: 0 1px 10px rgba(6, 8, 15, 0.85), 0 0 3px rgba(6, 8, 15, 0.7);
}

/* ---------- Klangraum-Wahl: zwei stille Reihen, alles auf einen Blick ---------- */
#klangwahl {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  gap: 14px 18px;
  justify-content: center;
  overflow: visible;
  padding: 6px 4px;
}

.raum {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.8s ease, transform 0.8s ease, box-shadow 0.8s ease;
}

.raum img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}

.raum.aktiv {
  opacity: 1;
  transform: scale(1.12);
  box-shadow: 0 0 0 1px rgba(217, 184, 124, 0.75),
              0 0 16px rgba(217, 184, 124, 0.4);
}

/* ---------- Regler ---------- */
#regler {
  width: min(78vw, 320px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.volume-zeile {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ganz-leise);
  font-size: 0.7rem;
}

input[type='range'] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 44px;           /* volle Touch-Fläche, Optik bleibt filigran */
  background: transparent;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-tief), rgba(217, 184, 124, 0.25));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(217, 184, 124, 0.6);
}
input[type='range']::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-tief), rgba(217, 184, 124, 0.25));
}
input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(217, 184, 124, 0.6);
}

#timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--leise);
}
#timer button {
  border: none;
  background: none;
  font: inherit;
  color: var(--leise);
  letter-spacing: 0.08em;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 6px;
  transition: color 0.6s ease, text-shadow 0.6s ease;
}
#timer button.aktiv {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(217, 184, 124, 0.5);
}
#timer-rest {
  font-size: 0.72rem;
  color: var(--leise);
  font-style: italic;
  min-height: 1em;
}

/* ---------- Fokus (Tastatur) ---------- */
#siegel:focus-visible,
.raum:focus-visible,
#timer button:focus-visible,
input[type='range']:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}
#siegel:focus-visible { outline-offset: 10px; border-radius: 50%; }
.raum:focus-visible { border-radius: 50%; }

/* ---------- Fuß ---------- */
footer p {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--leise);
}

/* ---------- Erst-Besuch ---------- */
#intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 12, 0.82);
  opacity: 0;
  transition: opacity 0.9s ease;
  z-index: 10;
  padding: 32px;
}
#intro.sichtbar { opacity: 1; }
#intro:not(.sichtbar) { pointer-events: none; }
#intro[hidden] { display: none; }
#intro div {
  max-width: 300px;
  font-size: 0.86rem;
  line-height: 2;
  letter-spacing: 0.1em;
  color: var(--text);
  text-align: center;
}

/* ---------- Ruhe für alle, die es brauchen ---------- */
@media (prefers-reduced-motion: reduce) {
  body.fliesst #siegel { animation: none; }
  #siegel .ruht, #siegel .an, #siegel::before { transition-duration: 0.4s; }
  .raum { transition: opacity 0.4s ease, box-shadow 0.4s ease; }
  .raum.aktiv { transform: none; }
  #intro { transition-duration: 0.2s; }
}

/* sehr kleine / flache Bildschirme */
@media (max-height: 620px) {
  header .claim { display: none; }
  #siegel { width: min(70vw, 36vh, 320px); }
}
