:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5b667a;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --border: #e3e7f0;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --card: #191d30;
    --text: #e8eaf2;
    --muted: #9aa3b8;
    --accent: #818cf8;
    --accent-soft: #23284a;
    --border: #2a3050;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

.hero h1 {
  font-size: 2rem;
  margin: 0 0 8px;
}

.hero p {
  color: var(--muted);
  margin: 0 0 32px;
}

/* Bilingual copy: pages carry both languages as lang-tagged elements,
   and <html lang> (set before first paint) decides which one shows. */
html[lang='en'] [lang='ja'],
html[lang='ja'] [lang='en'] {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.topbar .breadcrumb {
  margin-bottom: 0;
}

.lang-switch {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}

.lang-switch button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

html[lang='en'] .lang-switch [data-set-lang='en'],
html[lang='ja'] .lang-switch [data-set-lang='ja'] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(30, 40, 90, 0.12);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.card h2 {
  font-size: 1.15rem;
  margin: 0 0 8px;
}

.card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.card-cta {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.card-placeholder {
  opacity: 0.6;
}

footer {
  margin-top: 48px;
  font-size: 0.85rem;
  color: var(--muted);
}

footer a {
  color: var(--accent);
}

/* ---- transcriber app ---- */

.app {
  max-width: 640px;
}

.breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

button {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.stop {
  background: var(--danger);
}

select {
  font: inherit;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
  margin-bottom: 16px;
}

.meter-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}

.status {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.5em;
  margin-bottom: 16px;
}

.transcript {
  min-height: 120px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  white-space: pre-wrap;
  font-size: 1.05rem;
}

.transcript:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-size: 0.9rem;
}

.llm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
  cursor: pointer;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .results {
    grid-template-columns: 1fr;
  }
}

.results h3 {
  font-size: 0.9rem;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
}

.note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 20px;
}
