/* ============================================================
   Myoki · MyoKino — styles
   Tokens lifted from the Myoki design system (design.md).
   ============================================================ */

:root {
  /* --- raw palette --- */
  --beige-100: #FBF7F3;
  --beige-200: #E9DDD1;
  --orange-200: #FFE7DE;
  --orange-500: #FF9671;
  --orange-600: #FF7949;
  --orange-700: #B75734;
  --yellow-500: #FDD338;
  --yellow-600: #FCC600;
  --green-300: #BEECE6;
  --green-500: #6ED5C8;
  --green-600: #45C9B9;
  --green-700: #369D90;
  --green-800: #23655D;
  --blue-200: #DAE1F1;
  --blue-400: #8EA8E1;
  --blue-500: #5480E2;
  --blue-800: #1B3674;
  --blue-900: #142448;
  --white: #FFFFFF;

  /* --- semantic roles --- */
  --bg: var(--beige-100);
  --surface: var(--white);
  --primary: var(--green-500);
  --primary-pressed: var(--green-600);
  --text: var(--blue-800);
  --text-pressed: var(--blue-900);
  --error: var(--orange-700);
  --border-input: var(--blue-400);
  --divider: var(--beige-200);

  /* --- radius --- */
  --r-input: 12px;
  --r-medium: 16px;
  --r-large: 24px;
  --r-full: 999px;

  /* --- elevation: soft warm shadow tinted with beige/200 --- */
  --shadow-low: 0 5px 20px rgba(233, 221, 209, 0.75);
  --shadow-card: 0 8px 28px rgba(233, 221, 209, 0.85);

  /* --- motion --- */
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Fredoka", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2 { font-weight: 500; margin: 0; }

/* ---------- header / footer ---------- */
.app-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 32px;
}
.wordmark-logo {
  height: 40px;
  width: auto;
  display: block;
}

/* language switch (top-right) */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  background: var(--white);
  border-radius: var(--r-full);
  padding: 3px;
  box-shadow: var(--shadow-low);
}
.lang-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  color: var(--blue-400);
  padding: 7px 13px;
  border-radius: var(--r-full);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, color 120ms ease;
}
.lang-btn.is-active { background: var(--blue-200); color: var(--blue-800); }
.wordmark-sub {
  font-size: 18px;
  font-weight: 500;
  color: var(--green-700);
}
.app-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: 14px;
  color: var(--blue-400);
  padding: 16px 32px 24px;
  margin-top: auto;
}

/* ---------- main / views ---------- */
.app-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 32px 24px;
}
.view[hidden] { display: none; }

/* ============ WELCOME VIEW ============ */
.view--welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 36px;
  padding-top: 12px;
}
.hero { max-width: 760px; }
.hero-visual { display: block; width: 96px; height: auto; margin: 0 auto 18px; }
.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.5px;
}
.hero-title-accent { color: var(--green-600); }
.hero-sub {
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.5;
  color: var(--blue-800);
  opacity: 0.85;
  margin: 20px auto 0;
  max-width: 620px;
}

.benefits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px 56px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.benefit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 160px;
}
.benefit-label { font-size: 17px; line-height: 1.35; }
.benefit-label b { font-weight: 500; color: var(--green-700); }

.icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.icon-circle--warm   { background: var(--orange-200); }
.icon-circle--cool   { background: var(--blue-200); }
.icon-circle--accent { background: var(--green-300); }

/* ---------- card ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-large);
  box-shadow: var(--shadow-low);
}
.start-card {
  width: 100%;
  max-width: 700px;
  padding: 40px;
  text-align: left;
}
.card-title { font-size: 28px; margin-bottom: 22px; }

.field-label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--blue-800);
}
/* the playlist label is the one place we use Regular instead of Medium */
.field-label[for="welcome-url"] { font-weight: 400; }
.text-input {
  width: 100%;
  font-family: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-input);
  padding: 14px 16px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.text-input::placeholder { color: var(--blue-400); opacity: 0.7; }
.text-input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(110, 213, 200, 0.25);
}
.text-input--compact { font-size: 16px; padding: 11px 14px; }
.text-area { min-height: 96px; resize: vertical; line-height: 1.45; }

.checklist {
  list-style: none;
  margin: 22px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 16px;
  line-height: 1.4;
}
.check {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-300);
  position: relative;
  margin-top: 1px;
}
.check::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid var(--green-800);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.fine-print {
  font-size: 14px;
  color: var(--blue-400);
  margin: 14px 0 0;
  text-align: center;
}

/* ---------- buttons ---------- */
.btn {
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-radius: var(--r-full);
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 140ms var(--ease-back), background-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn--primary {
  width: 100%;
  background: var(--primary);
  color: var(--text);
  font-size: 22px;
  padding: 16px 24px;
}
.btn--primary:hover { background: var(--green-600); }
.btn--secondary {
  background: var(--primary);
  color: var(--text);
  font-size: 16px;
  padding: 10px 22px;
  min-height: 46px;
}
.btn--text {
  background: transparent;
  color: var(--text);
  font-size: 17px;
  padding: 8px 14px;
  min-height: 46px;
}
.btn--text:hover { color: var(--text-pressed); }

/* press feedback: scale down on press, gentle overshoot back up */
.pressable:active { transform: scale(0.96); transition: transform 80ms ease-out; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ---------- error text ---------- */
.error-text {
  color: var(--error);
  font-size: 15px;
  margin: 16px 0 0;
  line-height: 1.4;
}
.error-text--center { text-align: center; }

/* ============ PLAYER VIEW ============ */
.player-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.url-bar {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.url-bar .text-input { flex: 1; }

.player-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
/* let grid items shrink below their content so a long URL / the iframe can't
   blow out the card width on mobile */
.player-grid > * { min-width: 0; }
.player-card { padding: 12px; min-width: 0; }
.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-medium);
  overflow: hidden;
  background: var(--blue-900);
}
.player-frame iframe,
.player-frame #yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.player-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--blue-200);
  font-size: 18px;
  line-height: 1.5;
}
.player-empty[hidden] { display: none; }

/* ---------- playlist queue ---------- */
.queue-list {
  list-style: none;
  margin: 12px 4px 2px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.queue-list[hidden] { display: none; }
.queue-item {
  display: flex;
  align-items: center;
  border-radius: var(--r-input);
  background: var(--beige-100);
  overflow: hidden;
}
.queue-item.is-current { background: var(--green-300); }
.queue-select {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.queue-select:hover { background: rgba(20, 36, 72, 0.05); }
.queue-select:active { background: rgba(20, 36, 72, 0.09); }
.queue-num {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-200);
  color: var(--blue-800);
  font-size: 13px;
  font-weight: 500;
  display: grid;
  place-items: center;
}
.queue-item.is-current .queue-num { background: var(--green-600); color: var(--white); }
.queue-label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--blue-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-remove {
  flex: none;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--blue-400);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 140ms var(--ease-back), color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.queue-remove:hover { color: var(--error); }

/* ---------- monitor panel ---------- */
.monitor-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mouth-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--r-full);
  background: rgba(110, 213, 200, 0.25); /* green/500 @ 25% — softer than the buttons */
  color: var(--green-800);
}
.mouth-badge::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green-600);
}
.mouth-badge[data-state="open"] { background: rgba(255, 150, 113, 0.25); color: var(--orange-700); }
.mouth-badge[data-state="open"]::before { background: var(--orange-600); }
.mouth-badge[data-state="noface"] { background: rgba(253, 211, 56, 0.3); color: var(--blue-800); }
.mouth-badge[data-state="noface"]::before { background: var(--yellow-600); }

.cam-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-medium);
  overflow: hidden;
  background: var(--blue-200);
}
.cam-wrap[hidden] { display: none; }
.cam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror — feels natural */
  display: block;
}
/* "Gesicht erkannt / Kein Gesicht" chip on the preview */
.cam-status {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: rgba(35, 101, 93, 0.85); /* green/800 */
  color: var(--white);
}
.cam-status[data-state="lost"] { background: rgba(183, 87, 52, 0.9); } /* orange/700 */

.score-head {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
}
.score-num { color: var(--green-700); }
.score-track {
  position: relative;
  height: 14px;
  border-radius: var(--r-full);
  background: var(--blue-200);
  overflow: hidden;
}
.score-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--r-full);
  background: var(--green-500);
  transition: width 100ms linear, background-color 150ms ease;
}
.score-fill.is-open { background: var(--orange-500); }
.score-threshold {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  border-radius: 2px;
  background: var(--blue-800);
  opacity: 0.55;
  transform: translateX(-50%);
}

.control-row { display: flex; flex-direction: column; gap: 8px; }
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--blue-200);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-500);
  border: 3px solid var(--white);
  box-shadow: var(--shadow-low);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-500);
  border: 3px solid var(--white);
  box-shadow: var(--shadow-low);
  cursor: pointer;
}
.slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--blue-400);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  cursor: pointer;
}
.toggle-row input { width: 22px; height: 22px; accent-color: var(--green-600); }

/* ---------- tips panel ---------- */
.tips {
  background: var(--beige-100);
  border-radius: var(--r-input);
  padding: 12px 14px;
}
.tips.is-urgent { background: var(--orange-200); }
.tips-summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--blue-800);
  -webkit-tap-highlight-color: transparent;
}
.tips.is-urgent .tips-summary { color: var(--orange-700); }
.tips-list {
  margin: 10px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tips-list li {
  font-size: 14px;
  line-height: 1.45;
  color: var(--blue-800);
}
/* lead line of each tip: Fredoka Medium on its own line */
.tips-list li strong {
  display: block;
  font-weight: 500;
}

.monitor-foot {
  font-size: 13px;
  color: var(--blue-400);
  margin: 0;
  text-align: center;
}

/* ---------- responsive: stack on narrow / portrait ---------- */
@media (max-width: 820px) {
  .player-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .app-main { padding: 8px 18px 24px; }
  .start-card { padding: 28px 22px; }
}

/* ---------- footer links ---------- */
.footer-links {
  margin-top: 8px;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--blue-400);
  text-decoration: none;
}
.footer-links a:hover { color: var(--text); text-decoration: underline; }

/* ---------- legal pages (Impressum / Datenschutz) ---------- */
.app-main.legal { max-width: 768px; padding-bottom: 48px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue-400);
  text-decoration: none;
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--text); }
.legal-content { text-align: left; }
.legal-content h1 { font-size: clamp(30px, 5vw, 42px); margin-bottom: 24px; }
.legal-content h2 { font-size: 22px; margin: 30px 0 10px; }
.legal-content p { font-size: 17px; line-height: 1.6; margin: 0 0 14px; }
.legal-content ul { margin: 0 0 14px; padding-left: 22px; }
.legal-content li { font-size: 17px; line-height: 1.6; margin-bottom: 8px; }
.legal-content a { color: var(--orange-700); }
.legal-content .addr { line-height: 1.8; }
.legal-meta { color: var(--blue-400); font-size: 15px; margin-top: -12px; }
.legal-divider { border: none; border-top: 1px solid var(--divider); margin: 26px 0; }

/* ---------- before / after section ---------- */
.before-after {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  width: 100%;
}
.ba-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 0 1 360px;
  min-width: 240px;
}
.ba-photo { width: 100%; height: auto; display: block; }
.ba-cap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--blue-800);
}
.ba-cap strong { font-weight: 500; }
.ba-icon { flex: none; width: 30px; height: 30px; display: block; }
.ba-arrow { flex: none; width: 28px; height: auto; margin-bottom: 40px; }

@media (max-width: 720px) {
  .before-after { flex-direction: column; }
  .ba-card { flex-basis: auto; width: 100%; max-width: 380px; }
  .ba-arrow { transform: rotate(90deg); margin: 0; }
}
