:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #000000;
  --accent: #446084;
  --brand-bar: #1e73be;
  --accent-2: #0647a1;
  --muted: #5d6b7a;
  --link: #0647a1;
  --link-hover: #4699e1;
  --shadow: rgba(10, 20, 30, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  border-top: 24px solid var(--brand-bar);
  background: var(--paper);
}

body.embedded-mode .site-header {
  display: none;
}

body.embedded-mode .hero {
  padding-top: 20px;
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 5vw;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
}

.site-logo img {
  height: 72px;
  width: auto;
  display: block;
  background: #ffffff;
  clip-path: inset(0 0 0 6px);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.site-nav a {
  color: var(--link);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--link-hover);
}

.hero {
  padding: 40px 5vw 24px;
  display: grid;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
}

.brand-title {
  font-size: 28px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.hero-panel {
  background: var(--paper);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 40px var(--shadow);
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 15px;
}

.field span {
  color: var(--muted);
  letter-spacing: 0.02em;
}

input, select {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #c8d2df;
  font-size: 16px;
  background: #fff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

button {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

button:hover {
  background: #3a5271;
}

.secondary-btn {
  background: #e8edf4;
  color: #35506e;
}

.secondary-btn:hover {
  background: #dce6f2;
}

.quick-lists {
  padding: 0 5vw 6px;
  display: grid;
  gap: 10px;
}

.quick-title,
.link-btn {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--link);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e9edf3;
  color: #34506f;
  font-size: 14px;
}

.status {
  font-size: 14px;
  color: var(--muted);
}

.pronunciation {
  display: none;
}

.helper {
  font-size: 14px;
  color: var(--muted);
}

.reader-warning {
  background: #fff3cd;
  border: 1px solid #e6c674;
  color: #5b4b1a;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.results {
  padding: 10px 5vw 40px;
  display: grid;
  gap: 20px;
}

.result-card {
  background: #fff;
  border-radius: 18px;
  padding: 16px 18px 20px;
  box-shadow: 0 12px 30px var(--shadow);
  display: grid;
  gap: 10px;
}

.cue-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.cue-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 132px;
}

.say-row {
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.say-btn {
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.say-btn:disabled {
  background: #9fb0c3;
  cursor: not-allowed;
}

.result-title {
  font-size: 20px;
  font-weight: 700;
}

.result-meta {
  color: var(--muted);
  font-size: 14px;
}

.image-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.image-row--sequence {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
}

.image-row img {
  width: 140px;
  height: auto;
  border-radius: 12px;
  background: #f4f7fb;
  padding: 8px;
}

.stress-line {
  width: 100px;
  height: 5px;
  border-radius: 999px;
}

.stress-line.primary {
  background: #0b5ed7;
}

.stress-line.secondary {
  background: #63a4ff;
}

.stress-line.none {
  background: transparent;
}

.audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-btn {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--link);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.play-btn:hover {
  background: var(--link-hover);
}

.controls-wrap {
  display: grid;
  gap: 10px;
  padding-top: 8px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.control-btn {
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}

.speed-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d7e1ee;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f5f8fc;
}

.speed-picker span {
  font-size: 13px;
  font-weight: 700;
  color: #35506e;
}

.speed-select {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #c8d2df;
  background: #fff;
  color: #244261;
  font-size: 14px;
  min-width: 90px;
}

.editor-panel {
  margin-top: 10px;
  border: 1px solid #d7e1ee;
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
  display: grid;
  gap: 10px;
}

.editor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-cue {
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  display: grid;
  gap: 6px;
  justify-items: center;
  cursor: grab;
}

.editor-cue img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.editor-cue button {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.add-sound-grid {
  width: 100%;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #d7e1ee;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.add-sound-item {
  border: 1px solid #d7e1ee;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #244261;
  font-size: 12px;
  text-align: left;
}

.add-sound-item img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
  background: #f5f8fc;
}

.editor-actions select,
.editor-actions input {
  min-width: 170px;
}

.muted {
  font-size: 13px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 28, 44, 0.55);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(840px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.25);
}

.modal-card--small {
  width: min(520px, 96vw);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.modal-body h3 {
  margin-top: 14px;
  margin-bottom: 6px;
}

.icon-btn {
  background: #e9edf3;
  color: #1f3b57;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
}

.favorite-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f8;
}

.footer {
  padding: 20px 5vw 40px;
  color: var(--muted);
  font-size: 14px;
}

.mono {
  font-family: "Courier New", monospace;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1fr 1.3fr;
    align-items: center;
  }
}

@media (max-width: 700px) {
  .site-header__inner {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}
