/* ─── Google Fonts ────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;600;700&family=Noto+Sans+JP:wght@400;700;900&display=swap');

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

:root {
  --gold:    #C8922A;
  --gold-lt: #FFD95A;
  --red:     #C62828;
  --blue:    #1565C0;
  --bg:      #FFFDF5;
  --surface: #FFFFFF;
  --text:    #2C1810;
  --muted:   #7B6B5A;
  --radius:  16px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── Header (shared with style.css) ─────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #8B0000 0%, #C8922A 60%, #1565C0 100%);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: #FFD95A;
  text-decoration: none;
  white-space: nowrap;
  padding: 12px 0;
  text-shadow: 1px 1px 4px rgba(0,0,0,.4);
}

.site-logo .logo-sub {
  display: block;
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255,255,255,.85);
  letter-spacing: .05em;
  font-family: 'Sarabun', sans-serif;
}

.site-nav { display: flex; gap: 4px; margin-left: auto; }

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255,255,255,.85);
  font-size: 0.7rem;
  transition: background .2s, color .2s;
  line-height: 1.3;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,.2);
  color: #FFD95A;
}

.nav-icon { font-size: 1.3rem; }

.voice-warning {
  display: none;
  background: #FFF3CD;
  border-bottom: 2px solid #FFC107;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: #856404;
  align-items: center;
  gap: 8px;
  justify-content: center;
  text-align: center;
}

/* ─── Main ────────────────────────────────────────────────────────────────── */
main { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* ─── Situation Tabs ──────────────────────────────────────────────────────── */
.tabs-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  border: 2px solid #ddd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: opacity .2s;
}

.scroll-arrow-left  { left:  0; }
.scroll-arrow-right { right: 0; }
.scroll-arrow.hidden { opacity: 0; pointer-events: none; }

.situation-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 44px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.situation-tabs::-webkit-scrollbar { display: none; }

.sit-tab {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  font-family: 'Noto Sans JP', sans-serif;
}

.sit-tab:hover {
  border-color: var(--sit-color);
  transform: translateY(-2px);
}

.sit-tab.active {
  background: var(--sit-color);
  border-color: var(--sit-color);
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.tab-icon  { font-size: 1.4rem; }
.tab-label { font-size: 0.7rem; font-weight: 700; }

/* ─── Gender Toggle ───────────────────────────────────────────────────────── */
.gender-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.gender-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.gender-btn {
  padding: 6px 16px;
  border: 2px solid #ccc;
  border-radius: 30px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: all .2s;
  color: var(--text);
}

.gender-btn:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.gender-btn.active[data-gender="male"] {
  background: #1565C0;
  border-color: #1565C0;
  color: white;
  box-shadow: 0 3px 8px rgba(21,101,192,.3);
}

.gender-btn.active[data-gender="female"] {
  background: #C2185B;
  border-color: #C2185B;
  color: white;
  box-shadow: 0 3px 8px rgba(194,24,91,.3);
}

/* ─── Controls ────────────────────────────────────────────────────────────── */
.phrase-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: transform .15s, box-shadow .15s;
}

#playAllBtn {
  background: linear-gradient(135deg, var(--gold), #e8a830);
  color: white;
  box-shadow: 0 3px 10px rgba(200,146,42,.3);
}

#stopBtn {
  background: #F44336;
  color: white;
  display: none;
}

#toggleJaBtn {
  background: #EEF;
  color: #333;
  border: 2px solid #BBC;
}

.ctrl-btn:hover { transform: translateY(-2px); }

/* ─── Dialog Area ─────────────────────────────────────────────────────────── */
#dialogArea {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.dialog-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.row-left  { align-self: flex-start; align-items: flex-start; }
.row-right { align-self: flex-end;   align-items: flex-end; }

.dialog-role {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 3px;
  font-weight: 600;
}

.dialog-bubble {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background .2s;
  position: relative;
}

.row-left  .dialog-bubble { border-radius: 4px 16px 16px 16px; }
.row-right .dialog-bubble { border-radius: 16px 4px 16px 16px; }

.row-left  .dialog-bubble { border-left:  4px solid var(--sit-color, #999); }
.row-right .dialog-bubble { border-right: 4px solid var(--gold); }

.dialog-bubble:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
}

.dialog-bubble.active {
  border-color: var(--sit-color, var(--gold));
  background: color-mix(in srgb, var(--sit-color, var(--gold)) 8%, white);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.bubble-th {
  font-family: 'Sarabun', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.bubble-rom {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  margin-top: 2px;
}

.bubble-ja {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  border-top: 1px solid #eee;
  padding-top: 4px;
}

.bubble-play {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: .4;
  transition: opacity .2s;
}

.dialog-bubble:hover .bubble-play { opacity: 1; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 40px;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .dialog-row { max-width: 90%; }
  .bubble-th  { font-size: 1rem; }
  .nav-link   { padding: 8px 8px; font-size: 0.65rem; }
}
