/* ============================================
   ALMA — A Voz do Pai
   Design System & Complete Styles
   ============================================ */

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

:root {
  --bg: #0D0D0D;
  --surface: #1A1A2E;
  --surface-light: #222240;
  --accent: #E8C547;
  --accent-dim: rgba(232, 197, 71, 0.15);
  --blue: #4A90D9;
  --blue-dim: rgba(74, 144, 217, 0.12);
  --text: #F0F0F0;
  --text-soft: #8A8A9A;
  --text-muted: #9A9AAA;
  --msg-user: #2A2A4A;
  --msg-alma: #1E3A5F;
  --danger: #D94A4A;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --transition: 0.25s ease;
  --max-width: 720px;
  --font-title: Georgia, 'Times New Roman', serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}

a:hover {
  opacity: 0.8;
}

/* --- Utility --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ============================================
   LOGIN PAGE — Autenticação
   ============================================ */

.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 20px;
}

.login-container {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-form {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
}

.login-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: opacity var(--transition);
  margin-top: 4px;
}

.login-btn:hover {
  opacity: 0.85;
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-hint {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   INDEX PAGE — Entrada
   ============================================ */

.page-index {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 20px;
  text-align: center;
}

/* --- DB Stats --- */
.alma-stats {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 12px;
  letter-spacing: 0.05em;
}

.alma-stats span {
  color: var(--accent);
  font-weight: 600;
}

/* --- Title Section --- */
.alma-title {
  margin-bottom: 24px;
}

/* Animated gradient — Claude-style orange flow */
@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.alma-logo {
  font-family: var(--font-title);
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 0;
  background: linear-gradient(90deg, #E8954A, #D8AA32, #E8C547, #D8AA32, #E8954A);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientFlow 6s ease infinite;
  text-shadow: none;
}

.alma-divider {
  width: 120px;
  height: 1px;
  background: var(--accent);
  margin: 10px auto;
  opacity: 0.5;
}

.alma-author {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.alma-subtitle {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--text-soft);
  font-style: italic;
  margin-bottom: 8px;
}

/* --- Tone Config --- */
.tone-config {
  width: 100%;
  max-width: 560px;
  margin-bottom: 32px;
  text-align: left;
}

.tone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tone-header label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tone-status {
  font-size: 0.72rem;
  color: var(--accent);
}

.tone-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  transition: border-color var(--transition);
}

.tone-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.tone-textarea::placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.tone-save-btn {
  margin-top: 8px;
  background: var(--surface-light);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 6px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}

.tone-save-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tone-save-btn:disabled {
  opacity: 0.5;
}

/* --- Section Labels --- */
.section-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 16px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 560px;
  text-align: left;
}

/* --- Person Cards (replaces son-cards) --- */
.persons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  justify-content: center;
  margin-bottom: 16px;
}

.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  transition: all var(--transition);
  width: 150px;
}

.person-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(232, 197, 71, 0.1);
}

.person-card:active {
  transform: translateY(0);
}

/* --- Person Photo --- */
.person-photo-wrapper {
  position: relative;
  margin-bottom: 10px;
}

.person-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.person-initial {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
}

.person-photo.noah {
  background: var(--accent-dim);
  color: var(--accent);
}

.person-photo.nathan {
  background: var(--blue-dim);
  color: var(--blue);
}

.person-photo.isaac {
  background: rgba(217, 74, 74, 0.12);
  color: #E86747;
}

.person-photo.chris {
  background: rgba(168, 85, 247, 0.12);
  color: #A855F7;
}

.person-photo.leslen {
  background: rgba(236, 72, 153, 0.12);
  color: #EC4899;
}

.photo-upload-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  background: var(--surface-light);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.photo-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

.person-info h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 2px;
}

.person-info p {
  font-size: 0.75rem;
  color: var(--text-soft);
}

/* --- Footer --- */
.page-footer {
  margin-top: 48px;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.5;
}

.page-footer a {
  color: var(--text-soft);
}

/* --- Nav Links --- */
.nav-links {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.nav-links a {
  font-size: 0.82rem;
  color: var(--text-soft);
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--accent);
}

/* ============================================
   CHAT PAGE — Conversa
   ============================================ */

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

/* --- Chat Header --- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color var(--transition);
  line-height: 1;
}

.btn-back:hover {
  color: var(--accent);
}

.chat-header-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  background: linear-gradient(90deg, #E8954A, #D8AA32, #E8C547, #D8AA32, #E8954A);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientFlow 6s ease infinite;
}

.chat-header-title span {
  -webkit-text-fill-color: var(--text-soft);
  color: var(--text-soft);
  font-weight: 400;
}

.chat-header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-nav a {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-directives,
.btn-voice-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  position: relative;
}
.btn-directives:hover,
.btn-voice-toggle:hover { color: var(--accent); }

.btn-voice-toggle.active {
  color: var(--accent);
}

.btn-voice-toggle.active::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(216,170,50,0.65);
}

/* --- Directives Panel (slide-in from right) --- */
.directives-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
}
.directives-panel.open { right: 0; }

.directives-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.directives-panel-header h3 {
  font-family: var(--font-title);
  color: var(--accent);
  font-size: 0.95rem;
}
.directives-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.directives-panel-close:hover { color: var(--text); }

.directives-panel-body {
  padding: 16px 18px;
  flex: 1;
  overflow-y: auto;
}

.directives-panel-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.directives-panel-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
}
.directives-panel-textarea:focus { outline: none; border-color: var(--accent); }

.directives-panel-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.directives-panel-chars {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.directives-panel-save {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.directives-panel-save:hover { opacity: 0.85; }

.directives-panel-status {
  font-size: 0.78rem;
  color: var(--accent);
}

.directives-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 899;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.directives-panel-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* --- Chat Area --- */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

.chat-messages {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Messages --- */
.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.alma {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  min-width: 36px;
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0 6px;
  white-space: nowrap;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.message.alma .message-avatar {
  background: var(--accent);
  color: var(--bg);
}

.message.user .message-avatar {
  background: var(--blue);
  color: white;
}

.message-avatar.avatar-name {
  font-size: 0.6rem;
  letter-spacing: 0.02em;
}

.message-content {
  border-radius: var(--radius);
  padding: 14px 18px;
  line-height: 1.65;
  font-size: 0.95rem;
}

.message.alma .message-content {
  background: var(--msg-alma);
  border-left: 3px solid var(--accent);
  border-top-left-radius: 4px;
}

.message.user .message-content {
  background: var(--msg-user);
  border-top-right-radius: 4px;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Markdown rendered content inside ALMA messages */
.message.alma .message-text {
  white-space: normal;
}

.message.alma .message-text p {
  margin-bottom: 0.6em;
}

.message.alma .message-text p:last-child {
  margin-bottom: 0;
}

.message.alma .message-text strong {
  color: var(--text);
  font-weight: 600;
}

.message.alma .message-text em {
  font-style: italic;
  color: var(--text);
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- Suggestions --- */
.suggestions {
  max-width: var(--max-width);
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-btn {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-soft);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
  line-height: 1.4;
}

.suggestion-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-light);
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  gap: 10px;
  align-self: flex-start;
  max-width: 85%;
}

.typing-dots {
  background: var(--msg-alma);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* --- Input Area --- */
.chat-input-area {
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.chat-input-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-container {
  flex: 1;
  position: relative;
}

.chat-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 12px 16px;
  padding-right: 50px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  min-height: 46px;
  transition: border-color var(--transition);
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.char-count {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.char-count.warn {
  color: var(--danger);
}

.btn-send {
  width: 46px;
  height: 46px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.btn-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-send svg {
  width: 20px;
  height: 20px;
  color: var(--bg);
}

/* --- Error Message --- */
.error-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  z-index: 100;
  animation: fadeIn 0.3s ease;
  max-width: 90%;
  text-align: center;
}

/* ============================================
   SOBRE PAGE — Sobre o Projeto
   ============================================ */

.page-sobre {
  min-height: 100vh;
  padding: 40px 20px 60px;
}

.sobre-header {
  text-align: center;
  margin-bottom: 48px;
}

.sobre-header .alma-logo {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.sobre-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 0.85rem;
  margin-bottom: 24px;
  transition: color var(--transition);
}

.sobre-back:hover {
  color: var(--accent);
}

.sobre-content {
  max-width: 640px;
  margin: 0 auto;
}

.sobre-section {
  margin-bottom: 40px;
}

.sobre-section h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(232, 197, 71, 0.15);
}

.sobre-section p {
  color: var(--text-soft);
  line-height: 1.75;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.sobre-quote {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 20px 24px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 16px;
}

.sobre-quote p {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 8px;
}

.sobre-quote .quote-author {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.82rem;
  color: var(--accent);
}

.sobre-footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.sobre-footer a {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity var(--transition);
}

.sobre-footer a:hover {
  opacity: 0.85;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 480px) {
  .message {
    max-width: 75%;
  }

  .person-card {
    width: 155px;
  }
}

@media (min-width: 768px) {
  .alma-logo {
    font-size: 5rem;
  }

  .alma-subtitle {
    font-size: 1.25rem;
  }

  .person-card {
    width: 165px;
  }

  .message {
    max-width: 65%;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-soft);
}

/* ============================================
   CORRECTION SYSTEM
   ============================================ */

/* --- Voice Play Button (per message) --- */
.btn-play-voice {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(216,170,50,0.35);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.76rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-play-voice:hover {
  background: rgba(216,170,50,0.08);
  border-color: var(--accent);
}

.btn-play-voice:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-play-voice.is-playing {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-play-voice.is-loading {
  color: var(--text-muted);
}

/* --- Correction Button on Messages --- */
.btn-correct {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-body);
  padding: 4px 10px;
  margin-top: 8px;
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0;
}

.message.alma:hover .btn-correct,
.message.alma .btn-correct:focus {
  opacity: 1;
}

.btn-correct:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(232, 197, 71, 0.08);
}

/* Mobile: always show the button */
@media (max-width: 768px) {
  .btn-correct {
    opacity: 0.6;
  }
}

/* --- Correction Modal --- */
.correction-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.correction-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.correction-modal {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.correction-overlay.active .correction-modal {
  transform: translateY(0);
}

.correction-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.correction-header h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--accent);
}

.correction-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition);
}

.correction-close:hover {
  color: var(--text);
}

.correction-body {
  padding: 20px 24px;
}

.correction-original {
  margin-bottom: 20px;
}

.correction-original label,
.correction-input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.correction-original-text {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
  border-left: 3px solid var(--danger);
}

.correction-input-group {
  position: relative;
}

.correction-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition);
}

.correction-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.correction-textarea::placeholder {
  color: var(--text-muted);
}

.correction-char-count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.correction-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.correction-btn-cancel {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  padding: 10px 20px;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}

.correction-btn-cancel:hover {
  border-color: var(--text-soft);
  color: var(--text);
}

.correction-btn-save {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--bg);
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}

.correction-btn-save:hover {
  opacity: 0.85;
}

.correction-btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Classification result in correction modal --- */
#classifyResult {
  animation: fadeIn 0.3s ease;
}

/* --- Toast Notifications --- */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  z-index: 1100;
  animation: fadeIn 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast-error {
  background: var(--danger);
  color: white;
}

.toast-success {
  background: #2E7D32;
  color: white;
}

/* --- Selection --- */
::selection {
  background: var(--accent);
  color: var(--bg);
}
