/* ==========================================================================
   Innercraft Meditation — App-Design
   Erdpalette und Typografie der Innercraft-Website
   ========================================================================== */

:root {
  --forest:      #2f3b30;
  --forest-deep: #232c24;
  --moss:        #5b6b4d;
  --sage:        #8a9a7b;
  --clay:        #b6713f;
  --clay-soft:   #c98a5b;
  --gold:        #c9a24b;
  --sand:        #e8dcc6;
  --cream:       #f5efe2;
  --paper:       #faf6ec;
  --ink:         #34302a;
  --ink-soft:    #5d564c;

  --serif: "Cormorant Garamond", Georgia, serif;
  --sans:  "Jost", -apple-system, "Segoe UI", system-ui, sans-serif;

  --shadow-soft: 0 18px 50px -28px rgba(35, 44, 36, .45);
  --radius: 6px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ---------- Filmkorn-Textur ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.app-header {
  padding: calc(var(--safe-top) + 14px) 22px 12px;
  display: flex;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--forest);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; letter-spacing: .04em; }
.brand-tag  { font-family: var(--sans); font-size: .62rem; letter-spacing: .28em; text-transform: uppercase; color: var(--clay); }

/* ---------- Screens ---------- */
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 22px calc(var(--safe-bottom) + 40px);
}

.screen { display: none; animation: fade-in .45s var(--ease); }
.screen.is-active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.hidden { display: none !important; }

/* ---------- Typografie ---------- */
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  line-height: 1.12;
  margin-bottom: 1.2rem;
}

h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: .6rem;
}

.eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: .8rem;
}

.lead { color: var(--ink-soft); margin-bottom: 1.4rem; }

.hint {
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin-bottom: .8rem;
}

code {
  font-size: .85em;
  background: var(--sand);
  padding: .1em .35em;
  border-radius: 3px;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 500;
  letter-spacing: .08em;
  padding: 14px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--forest);
  color: var(--cream);
  box-shadow: var(--shadow-soft);
}
.btn-primary:active { transform: scale(.98); background: var(--forest-deep); }

.btn-ghost {
  background: transparent;
  color: var(--forest);
  border-color: rgba(47, 59, 48, .35);
}
.btn-ghost:active { background: rgba(47, 59, 48, .07); }

.btn-danger { color: var(--clay); border-color: rgba(182, 113, 63, .4); }

.btn-big {
  display: block;
  width: 100%;
  font-size: 1.02rem;
  padding: 18px;
  margin: 1.6rem 0 1rem;
}

.btn-back {
  font-family: var(--sans);
  font-size: .85rem;
  letter-spacing: .06em;
  background: none;
  border: none;
  color: var(--clay);
  padding: 8px 0;
  margin-bottom: .8rem;
  cursor: pointer;
}

.home-nav { display: flex; gap: 10px; }
.home-nav .btn { flex: 1; padding: 13px 10px; font-size: .82rem; }

/* ---------- Karten ---------- */
.card, .flow-card {
  background: var(--cream);
  border: 1px solid rgba(47, 59, 48, .12);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}

/* ---------- Ablauf-Liste (Home) ---------- */
.flow-list {
  list-style: none;
  counter-reset: flow;
}

.flow-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(47, 59, 48, .1);
  font-size: .98rem;
}
.flow-list li:last-child { border-bottom: none; }

.flow-list .flow-icon {
  font-family: var(--sans);
  font-size: .7rem;
  color: var(--gold);
  min-width: 1.4em;
  text-align: center;
}

.flow-list .flow-duration {
  margin-left: auto;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 300;
  color: var(--ink-soft);
  white-space: nowrap;
}

.flow-total {
  margin-top: .9rem;
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--clay);
  text-align: right;
}

/* ---------- Anleitung: als App installieren (Home, unten) ---------- */
.install-card {
  margin-top: 28px;
  padding: 20px;
  background: rgba(47, 59, 48, .05);
  border: 1px dashed rgba(47, 59, 48, .25);
  border-radius: var(--radius);
}

/* Läuft die Seite bereits als installierte App, ist die Anleitung überflüssig */
@media (display-mode: standalone) {
  .install-card { display: none; }
}

.install-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: .8rem;
}

.install-head h2 {
  font-size: 1.3rem;
  margin-bottom: 0;
}

.install-icon {
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.install-intro,
.install-note {
  font-family: var(--sans);
  font-size: .88rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.6;
}

.install-steps {
  margin: 14px 0 14px 1.3em;
  display: grid;
  gap: 9px;
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.55;
}

.install-steps strong { font-weight: 500; }

.share-glyph {
  display: inline-block;
  vertical-align: -3px;
  color: var(--clay);
}

.install-note { color: var(--clay); font-weight: 400; }

/* ---------- Hinweise ---------- */
.notice {
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 300;
  line-height: 1.5;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.notice-warn {
  background: rgba(201, 162, 75, .14);
  border: 1px solid rgba(201, 162, 75, .4);
  color: var(--ink);
}

.notice:not(.notice-warn) {
  background: rgba(91, 107, 77, .12);
  border: 1px solid rgba(91, 107, 77, .35);
  color: var(--ink);
}

/* ---------- Autoren-Modus ---------- */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: .4rem;
}
.card-head h2 { margin-bottom: 0; }

.card-remove { color: var(--ink-soft); }
.card-remove:disabled { opacity: .3; pointer-events: none; }

.author-recording {
  padding: 12px 0;
  border-bottom: 1px solid rgba(47, 59, 48, .1);
}

.author-recording .recording-hint {
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.card-publish { margin-top: 28px; }

.card-publish .btn-big { margin: 1rem 0 .6rem; }
.card-publish .btn-ghost { width: 100%; }

.publish-setup {
  font-family: var(--sans);
  font-size: .85rem;
  margin: 10px 0;
}

.publish-setup summary {
  cursor: pointer;
  color: var(--clay);
  font-weight: 500;
  padding: 6px 0;
}

.setup-steps {
  margin: 10px 0 14px 1.2em;
  display: grid;
  gap: 6px;
  font-weight: 300;
  line-height: 1.5;
}

.setup-steps a { color: var(--clay); }

#github-token {
  width: 100%;
  font-family: var(--sans);
  font-size: .9rem;
  padding: 12px 14px;
  border: 1px solid rgba(47, 59, 48, .3);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.publish-status {
  font-family: var(--sans);
  font-size: .85rem;
  min-height: 1.4em;
  margin-top: .6rem;
  color: var(--ink-soft);
}
.publish-status.is-success { color: var(--moss); }
.publish-status.is-error { color: var(--clay); }

/* ---------- Einstellungen ---------- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  font-size: .98rem;
}

.row-toggle { cursor: pointer; }
.row-toggle input { display: none; }

.toggle {
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: rgba(47, 59, 48, .25);
  position: relative;
  transition: background .25s var(--ease);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform .25s var(--ease);
}
.row-toggle input:checked + .toggle { background: var(--moss); }
.row-toggle input:checked + .toggle::after { transform: translateX(20px); }

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stepper-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(47, 59, 48, .3);
  background: transparent;
  color: var(--forest);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stepper-btn:active { background: rgba(47, 59, 48, .08); }

.stepper-value {
  font-family: var(--sans);
  font-size: 1.15rem;
  min-width: 2em;
  text-align: center;
}

.duration-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.duration-input input {
  font-family: var(--sans);
  font-size: 1.05rem;
  width: 64px;
  padding: 9px 10px;
  text-align: center;
  border: 1px solid rgba(47, 59, 48, .3);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.duration-input .unit {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink-soft);
}

/* ---------- Aufnahmen ---------- */
.recording-item {
  background: var(--cream);
  border: 1px solid rgba(47, 59, 48, .12);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.recording-item h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.08rem;
  margin-bottom: 2px;
}

.recording-item .recording-hint {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

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

.rec-btn {
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(47, 59, 48, .3);
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rec-btn-record { border-color: rgba(182, 113, 63, .5); color: var(--clay); }
.rec-btn-record.is-recording {
  background: var(--clay);
  color: var(--cream);
  animation: rec-pulse 1.4s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(182, 113, 63, .4); }
  50%      { box-shadow: 0 0 0 9px rgba(182, 113, 63, 0); }
}

.rec-btn:disabled { opacity: .35; pointer-events: none; }

.rec-status {
  flex-basis: 100%;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--moss);
}
.rec-status.empty { color: var(--clay); }

/* ---------- Laufende Meditation ---------- */
.screen-session {
  text-align: center;
  padding-top: 4vh;
}

.session-scene { position: relative; height: 0; }

.session-rings {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: -1;
}

.session-rings span {
  position: absolute;
  border: 1px solid rgba(201, 162, 75, .25);
  border-radius: 50%;
  width: 70vmin; height: 70vmin;
  animation: ring-breathe 9s ease-in-out infinite;
}
.session-rings span:nth-child(2) { width: 88vmin; height: 88vmin; animation-delay: -3s; }
.session-rings span:nth-child(3) { width: 106vmin; height: 106vmin; animation-delay: -6s; }

@keyframes ring-breathe {
  0%, 100% { transform: scale(1); opacity: .5; }
  50%      { transform: scale(1.06); opacity: 1; }
}

.session-title { margin-bottom: 2rem; }

.session-timer {
  position: relative;
  width: min(64vw, 280px);
  margin: 0 auto 1.6rem;
}

.progress-ring { width: 100%; transform: rotate(-90deg); }

.ring-bg, .ring-fg {
  fill: none;
  stroke-width: 4;
}
.ring-bg { stroke: rgba(47, 59, 48, .14); }
.ring-fg {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 553; /* 2 * PI * 88 */
  stroke-dashoffset: 553;
  transition: stroke-dashoffset 1s linear;
}

.session-time {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(2rem, 11vw, 3rem);
  letter-spacing: .04em;
  color: var(--forest);
  font-variant-numeric: tabular-nums;
}

.session-step {
  font-family: var(--sans);
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 2.2rem;
}

.session-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ---------- Abschluss ---------- */
.screen-done {
  text-align: center;
  padding-top: 8vh;
}

.done-mark {
  color: var(--gold);
  margin-bottom: 1.6rem;
  animation: fade-in 1.2s var(--ease);
}

.screen-done .btn { margin-top: 1.8rem; }
