/* =========================
   CSS RESET (light)
========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  background: #f7f8fa;
  color: #222;
  line-height: 1.5;
}

/* =========================
   LAYOUT
========================= */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.section {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

h1, h2, h3 {
  margin-top: 0;
  font-weight: 600;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* =========================
   TOOLBAR
========================= */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.app-name {
  font-size: 1.1rem;
}

.app-subtitle {
  font-size: 0.75rem;
  color: #666;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

/* =========================
   INPUTS
========================= */
textarea {
  width: 100%;
  resize: vertical;
  font-size: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  outline: none;
}

textarea:focus {
  border-color: #3b82f6;
}

/* =========================
   BUTTONS
========================= */
button {
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: #3b82f6;
  color: #fff;
}

.primary:hover {
  background: #2563eb;
}

.secondary {
  background: #e5e7eb;
  color: #111;
}

.full-width {
  width: 100%;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* =========================
   AUDIO
========================= */
audio {
  width: 100%;
  margin-top: 10px;
}

/* =========================
   PROCESSING
========================= */
.processing {
  color: #d97706;
  font-weight: 500;
  margin-bottom: 10px;
  display: none;
}

/* =========================
   RESULTS
========================= */
.results {
  margin-bottom: 10px;
}

.score {
  font-weight: 600;
  margin-bottom: 6px;
}

.transcript {
  font-size: 0.95rem;
  color: #444;
}

/* =========================
   HIGHLIGHTED WORDS
========================= */
.highlighted-text {
  font-size: 1rem;
  line-height: 1.8;
}

.word {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px 2px;
  border-radius: 6px;
  cursor: pointer;
}

/* Correct = subtle */
.word.correct {
  background: #eef2ff;
  color: #1e3a8a;
}

/* Close = warm hint */
.word.mispronounced {
  background: #fff7ed;
  color: #9a3412;
}

/* Missing = soft red, not aggressive */
.word.missing {
  background: #fef2f2;
  color: #991b1b;
  text-decoration: line-through;
}

/* Extra words */
.word.extra {
  background: #f3f4f6;
  color: #6b7280;
}

/* Selected word */
.word.selected {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* =========================
   PHONEME PANEL
========================= */
.phoneme-panel {
  display: none;
}

.phoneme-panel.active {
  display: block;
}

#phonemeWord {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.phoneme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phoneme-list span {
  background: #f1f5f9;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.hint {
  font-size: 0.8rem;
  color: #666;
  margin-top: 8px;
}

/* =========================
   ADS
========================= */
.ad-container {
  background: #fafafa;
  text-align: center;
  border: 1px dashed #ddd;
}

/* =========================
   COOKIE BANNER
========================= */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
}

.cookie-banner a {
  color: #60a5fa;
}

.cookie-banner button {
  background: #60a5fa;
  color: #000;
  border-radius: 6px;
  padding: 6px 10px;
}

/* =========================
   FOOTER
========================= */
.footer {
  text-align: center;
  font-size: 0.8rem;
  margin: 30px 0;
}

/* =========================
   DESKTOP ENHANCEMENTS
========================= */
@media (min-width: 768px) {
  h2 {
    font-size: 1.25rem;
  }

  .toolbar {
    padding: 12px 24px;
  }

  .container {
    padding: 24px;
  }
}

/* =========================
   MODE TABS
========================= */
.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid #e5e7eb;
}

.mode-tabs .tab {
  flex: 1;
  padding: 10px;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  background: #e5e7eb;
  color: #333;
  cursor: pointer;
}

.mode-tabs .tab.active {
  background: #3b82f6;
  color: white;
  font-weight: 600;
}

/* =========================
   PAGE VISIBILITY
========================= */
.page {
  display: none;
}

.page.active {
  display: block;
}

.mic-active {
  background: #d62828;
  color: #fff;
  animation: pulse 1.2s infinite;
}

.mic-button.error {
  background: #ff4d4f;
  animation: none;
}


@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(214,40,40,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(214,40,40,0); }
  100% { box-shadow: 0 0 0 0 rgba(214,40,40,0); }
}

/* ================= INFO SECTIONS ================= */

.info-section {
  margin-top: 12px;
}

.info-section h2 {
  margin-bottom: 10px;
}

.info-section p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 10px;
}

.how-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.how-item h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.how-item ol {
  padding-left: 18px;
  font-size: 14px;
  color: var(--muted);
}

.how-item li {
  margin-bottom: 6px;
}

/* Desktop enhancement */
@media (min-width: 768px) {
  .how-grid {
    flex-direction: row;
  }
}
