:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --danger: #f97316;
  --card: rgba(255, 255, 255, 0.06);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(168, 85, 247, 0.08), transparent 35%),
    var(--bg);
  color: var(--fg);
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-shell {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
  gap: 12px;
  padding: 16px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.status-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quota-info {
  font-size: 12px;
  color: var(--muted);
  max-width: 320px;
  min-height: 16px;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-email {
  font-size: 12px;
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  background: var(--card);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

/* 上段：ライブエリア */
.live-area {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.live-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.live-text {
  font-size: clamp(18px, 2.5vw + 10px, 28px);
  line-height: 1.4;
  word-break: break-word;
  min-height: 60px;
}

/* 下段：2カラムログ */
.log-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.log-panel {
  background: var(--card);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.log-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

/* Desktop: expand log scroll area */
@media (min-width: 768px) {
  .log-scroll {
    min-height: 300px;
  }
}

.log-entry {
  font-size: 14px;
  line-height: 1.5;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  word-break: break-word;
}

.log-entry:first-child {
  padding-top: 0;
}

.log-entry.translation {
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 10px;
}

.cta {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: none;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  background: linear-gradient(135deg, #38bdf8, #22d3ee);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.35);
  cursor: pointer;
}

.cta.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

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

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
}

.downloads a {
  color: var(--accent);
}

.a2hs {
  font-size: 13px;
  color: var(--muted);
  display: none;
}

#a2hs.show {
  display: block;
}

.modal {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 18px;
  min-width: 280px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 10px;
}

.modal label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

.modal input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Preset buttons in settings modal */
.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 12px;
  color: var(--muted);
}

button.small,
.modal button.small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: background 0.15s;
}

button.small:hover {
  background: rgba(255, 255, 255, 0.15);
}

button.small:active {
  background: var(--accent);
  color: var(--bg);
}

/* Quota breakdown in settings modal */
.quota-breakdown-section {
  margin-bottom: 8px;
}

.quota-breakdown-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.quota-breakdown {
  font-size: 13px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breakdown-row.total {
  font-weight: 600;
  color: var(--accent);
  border-bottom: none;
  padding-top: 6px;
}

.breakdown-row.reset {
  color: var(--muted);
  font-size: 12px;
  border-bottom: none;
}

.settings-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 12px 0;
}

@media (orientation: landscape) and (max-width: 900px) {
  .live-text {
    min-height: 160px;
  }
}

/* Dev Panel Styles */
.dev-only {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.4);
  font-size: 12px;
}

.dev-modal {
  max-width: 400px;
}

.dev-section {
  margin-bottom: 16px;
}

.dev-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
  letter-spacing: 0.05em;
}

.dev-status {
  font-size: 13px;
  line-height: 1.6;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  white-space: pre-line;
}

.dev-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dev-actions button {
  font-size: 12px;
  padding: 8px 12px;
}

.dev-log-area {
  font-family: monospace;
  font-size: 11px;
  line-height: 1.4;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.dev-cache-help {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  padding: 12px;
  border-left: 3px solid var(--accent);
}

.dev-cache-help strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.dev-cache-help ol {
  margin: 0;
  padding-left: 18px;
}

.dev-notice {
  margin-top: 10px;
  font-size: 12px;
  color: var(--accent);
  min-height: 16px;
}

/* Settings textarea */
.settings-textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.settings-textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.settings-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

/* Dictionary CSV Upload */
.dictionary-upload-section {
  margin: 12px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.dictionary-upload-section label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9em;
  color: var(--muted);
}

.settings-file-input {
  display: block;
  margin: 8px 0;
  font-size: 0.9em;
}

.upload-result {
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  font-size: 0.85em;
  white-space: pre-wrap;
}

.upload-result.success {
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
}

.upload-result.error {
  background: rgba(244, 67, 54, 0.2);
  color: #e57373;
}

/* Dictionary Section */
.dictionary-section {
  margin: 12px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.dictionary-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dictionary-count {
  font-size: 0.85em;
  color: var(--muted);
}

.dictionary-manual-add {
  margin: 12px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.dictionary-manual-add h4 {
  margin: 0 0 8px 0;
  font-size: 0.9em;
  color: var(--muted);
}

.dictionary-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dictionary-add-form input {
  flex: 1;
  min-width: 100px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.9em;
}

.dictionary-list {
  margin-top: 12px;
}

.dictionary-list h4 {
  margin: 0 0 8px 0;
  font-size: 0.9em;
  color: var(--muted);
}

.dict-loading,
.dict-empty {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9em;
}

.dict-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}

.dict-table th,
.dict-table td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dict-table th {
  color: var(--muted);
  font-weight: 500;
}

.dict-cell-source {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dict-cell-target {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dict-cell-note {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.dict-cell-actions {
  white-space: nowrap;
}

.dict-cell-actions button {
  margin-left: 4px;
  padding: 4px 8px;
  font-size: 0.8em;
}

.dict-edit-btn {
  /* default secondary style */
}

.dict-delete-btn.danger {
  background: rgba(244, 67, 54, 0.2) !important;
  color: #e57373 !important;
}

#dictLoadMore {
  margin-top: 12px;
  width: 100%;
}

/* CSV format hint */
.csv-format-hint {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.csv-format-hint small {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  line-height: 1.6;
}

.csv-format-hint code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
}

/* Dictionary View (separate page via hash route #/dictionary) */
.dictionary-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.dictionary-view-container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
}

.dictionary-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.dictionary-view-header h2 {
  margin: 0;
  flex: 1;
}

.dictionary-view .dictionary-actions-row {
  margin-bottom: 16px;
}

.dictionary-view .dictionary-upload-section {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.dictionary-view .dictionary-manual-add {
  margin-bottom: 16px;
}

.dictionary-view .dictionary-add-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dictionary-view .dictionary-add-form input {
  flex: 1;
  min-width: 100px;
}

/* Horizontal scrollable table wrapper for mobile */
.dict-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Dictionary summary in settings modal */
.dictionary-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 12px;
}

.dictionary-summary .dictionary-count {
  flex: 1;
  color: var(--muted);
}

/* Summary section */
.summary-section {
  margin-top: 8px;
  padding: 12px;
  background: var(--card);
  border-radius: 12px;
}

.summary-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.summary-output {
  margin: 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.summary-output:empty {
  display: none;
}

/* Settings select styling */
.settings-select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-size: 14px;
}

/* Billing section */
.billing-section {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  text-align: center;
}

.billing-status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.billing-status.success {
  color: #4ade80;
}

.billing-status.error {
  color: #f87171;
}

.billing-status.pending {
  color: #fbbf24;
}

/* Billing success banner */
.billing-success-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  padding: 16px;
  text-align: center;
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

.billing-success-banner.pending {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.billing-success-banner button {
  margin-left: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.billing-success-banner button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Network Disconnect Banner */
.network-disconnect-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  padding: 16px;
  text-align: center;
  z-index: 1001;
  animation: slideDown 0.3s ease-out;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.network-disconnect-banner span {
  flex: 1;
  text-align: center;
}

.network-disconnect-banner button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.network-disconnect-banner button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Company Section */
.company-section {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.company-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.company-note {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 12px;
  opacity: 0.8;
}

.company-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.company-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.company-form input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-size: 13px;
}

.company-form input::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.tax-id-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.company-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.company-status {
  font-size: 12px;
  color: var(--muted);
}

.company-status.success {
  color: #4ade80;
}

.company-status.error {
  color: #f87171;
}

/* Support / Legal links in settings */
.support-section {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.support-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.support-note {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.support-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.support-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.support-links a:hover {
  text-decoration: underline;
}

/* Ticket Purchase Modal */
.ticket-modal {
  max-width: 400px;
  width: 90vw;
}

.ticket-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.ticket-modal h2 {
  margin: 0;
  font-size: 18px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.ticket-pack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.ticket-pack:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.ticket-pack:active {
  transform: translateY(0);
  background: var(--accent);
  color: var(--bg);
}

.ticket-pack:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ticket-minutes {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ticket-price {
  font-size: 14px;
  color: var(--muted);
}

.ticket-pack:active .ticket-price {
  color: var(--bg);
}

/* Pro required badge for Free users */
.pro-required-note {
  font-size: 12px;
  color: var(--danger);
  margin-top: 8px;
  text-align: center;
}

/* Pulse animation for attention */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px 4px rgba(99, 102, 241, 0.6);
  }
}

.pulse {
  animation: pulse 0.5s ease-in-out 2;
}

/* Disabled button style for Pro-only features */
button.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 360px) {
  .ticket-grid {
    grid-template-columns: 1fr;
  }

  .ticket-modal {
    width: 95vw;
  }
}

/* SW Update Banner */
.sw-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  font-weight: 500;
}

.sw-update-btn {
  background: white;
  color: #667eea;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sw-update-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

.sw-update-btn:active {
  transform: scale(0.95);
}

/* Build info in settings */
.build-info {
  margin-top: 8px;
  padding: 8px;
  background: var(--card);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.build-sha {
  color: var(--muted);
  font-family: 'Courier New', monospace;
  font-size: 11px;
}

/* Diagnostics section in settings */
.diagnostics-section {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diagnostics-status {
  color: var(--muted);
  font-size: 12px;
}

/* ========== Result Card (after Stop) ========== */
.result-card {
  margin-top: 12px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-card-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--fg);
}

.result-card-timestamp {
  font-size: 11px;
  color: var(--muted);
}

.result-card-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.result-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.result-file-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.result-card-summary {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 12px;
}

/* ========== History View ========== */
.history-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.history-view-container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
}

.history-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.history-view-header h2 {
  margin: 0;
  flex: 1;
}

.hist-loading,
.hist-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-title {
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.history-item-actions {
  display: flex;
  gap: 8px;
}

/* ========== History Detail View ========== */
.history-detail-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 1001;
  overflow-y: auto;
  padding: 20px;
}

.history-detail-container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
}

.history-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.history-detail-header h2 {
  margin: 0;
  flex: 1;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-detail-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-detail-section {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.history-detail-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-detail-text {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.history-detail-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========== Footer Nav ========== */
.home-policy-summary {
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.home-policy-summary p {
  margin: 0;
}
.home-policy-summary a {
  color: var(--accent);
  text-decoration: none;
}
.home-policy-summary a:hover {
  text-decoration: underline;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.footer-nav span {
  color: var(--muted);
  font-size: 13px;
}

/* ========== STT Settings Section ========== */
.stt-settings-section {
  margin: 8px 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.stt-settings-section summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}

.stt-settings-section summary:hover {
  color: var(--fg);
}

.stt-settings-section[open] summary {
  margin-bottom: 8px;
}

.stt-settings-section label {
  font-size: 12px;
}

.stt-vad-custom {
  margin-left: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  margin-bottom: 8px;
}

.stt-vad-custom label {
  font-size: 11px;
}

.stt-debug-payload {
  margin-top: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  font-size: 11px;
}

.stt-debug-payload small {
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.stt-debug-payload pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 10px;
  color: var(--accent);
  max-height: 150px;
  overflow-y: auto;
}
