/* ============================================================
   Myoki · Mund-Pause — 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;
  gap: 12px;
  padding: 20px 32px;
}
.wordmark-logo {
  height: 40px;
  width: auto;
  display: block;
}
.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-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: 560px;
  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);
}
.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;
}
.player-card { padding: 12px; }
.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;
  gap: 10px;
  padding: 6px 6px 6px 10px;
  border-radius: var(--r-input);
  background: var(--beige-100);
}
.queue-item.is-current { background: var(--green-300); }
.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;
  font-size: 16px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--r-full);
  background: var(--green-500);
  color: var(--blue-900);
}
.mouth-badge[data-state="open"] { background: var(--orange-500); color: var(--white); }

.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;
}

.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); }

.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; }
}
