/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #888;
  --accent: #5c67f2;
  --accent-hover: #4651d8;
  --chip-bg: #f0f0f0;
  --chip-miss: #fafafa;
  --chip-miss-text: #aaa;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #1c1c1e;
    --border: #2c2c2e;
    --text: #f0f0f0;
    --text-muted: #777;
    --accent: #7b87ff;
    --accent-hover: #9aa3ff;
    --chip-bg: #2c2c2e;
    --chip-miss: #1a1a1a;
    --chip-miss-text: #555;
    --shadow: 0 2px 12px rgba(0,0,0,.4);
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding: 2rem 1rem 4rem;
  display: flex;
  justify-content: center;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
main {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header { text-align: center; padding: 1rem 0 0.5rem; }

h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), #f06);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.25rem;
}

/* ── Input ───────────────────────────────────────────────────────────────── */
.input-section textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-shadow: var(--shadow);
}

.input-section textarea:focus { border-color: var(--accent); }

/* ── Output ──────────────────────────────────────────────────────────────── */
.output-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 120px;
}

.status {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
}

.emoji-output {
  font-size: 2.5rem;
  line-height: 1.3;
  word-break: break-word;
  min-height: 3.5rem;
  letter-spacing: 0.05em;
}

/* ── Copy button ─────────────────────────────────────────────────────────── */
.output-actions { display: flex; justify-content: flex-end; }

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover { background: var(--chip-bg); color: var(--text); }
.copy-btn.copied { color: #22c55e; border-color: #22c55e; }

/* ── Breakdown ───────────────────────────────────────────────────────────── */
details { font-size: 0.85rem; }

summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  padding: 0.15rem 0;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: '▶ '; font-size: 0.65em; vertical-align: middle; }
details[open] summary::before { content: '▼ '; }

.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--chip-bg);
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.chip.miss {
  background: var(--chip-miss);
  color: var(--chip-miss-text);
  text-decoration: line-through;
}

/* Semantic (approximate) matches: ≈ arrow + dotted underline on the word */
.chip.semantic .chip-word {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.chip-word { opacity: 0.7; }
.chip-arrow { opacity: 0.4; }
.chip-emoji { font-size: 1rem; }

/* ── Examples ────────────────────────────────────────────────────────────── */
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.examples-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.example-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  transition: background 0.15s, border-color 0.15s;
  box-shadow: var(--shadow);
}

.example-btn:hover { background: var(--chip-bg); border-color: var(--accent); }
