:root {
  --bg-color: #07090e;
  --surface-color: #121722;
  --surface-border: #1f2937;
  --primary-color: #00ffcc;
  --primary-glow: rgba(0, 255, 204, 0.35);
  --danger-color: #ff3366;
  --warning-color: #ffbb00;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* 頂部列 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(18, 23, 34, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-border);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-color);
  box-shadow: 0 0 10px var(--primary-color);
}

.pulse-dot.offline {
  background: var(--warning-color);
  box-shadow: 0 0 10px var(--warning-color);
}

.app-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--primary-color);
}

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

.badge {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 12px;
  background: #374151;
  color: #fbbf24;
  font-weight: bold;
}

.badge.hidden {
  display: none;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

/* 核心巨大盲按區域 */
.main-touch-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  cursor: pointer;
  outline: none;
}

.ring-container {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.mic-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #162032, #0d121c);
  border: 3px solid var(--primary-color);
  box-shadow: 0 0 25px var(--primary-glow);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 2;
}

.mic-icon {
  font-size: 3.5rem;
  transition: transform 0.2s;
}

/* 錄音波紋動畫 */
.ripple {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.recording .mic-circle {
  border-color: var(--danger-color);
  box-shadow: 0 0 35px rgba(255, 51, 102, 0.6);
  transform: scale(1.08);
}

.recording .ripple {
  animation: pulse-ring 1.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  border-color: var(--danger-color);
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.9);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* 大字體狀態提示 */
.status-box {
  text-align: center;
  margin-bottom: 20px;
}

.status-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #ffffff;
}

.status-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

/* 字幕卡 */
.transcript-box {
  width: 92%;
  max-width: 520px;
  min-height: 56px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 16px;
}

.transcript-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e5e7eb;
  word-break: break-word;
}

/* 分流結果展示卡 */
.result-card {
  width: 92%;
  max-width: 520px;
  background: #111a28;
  border: 2px solid var(--primary-color);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card.hidden {
  display: none;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.slot-icon {
  font-size: 1.5rem;
}

.slot-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-color);
}

.result-detail {
  font-size: 1.05rem;
  color: #ffffff;
  margin-bottom: 6px;
  font-weight: 500;
}

.sync-status {
  font-size: 0.85rem;
  color: #10b981;
  font-weight: 600;
}

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

/* 底部口語示範標籤 */
.bottom-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(18, 23, 34, 0.5);
  border-top: 1px solid var(--surface-border);
}

.hint-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #182234;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid #233148;
}

/* 設定彈窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 90%;
  max-width: 480px;
  background: #151b28;
  border: 1px solid #2a374f;
  border-radius: 16px;
  padding: 24px;
}

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

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 12px;
  margin-bottom: 6px;
  color: #d1d5db;
}

.modal-body input[type="text"],
.modal-body input[type="url"],
.modal-body input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  background: #0a0d14;
  border: 1px solid #2b3952;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.95rem;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.toggle-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374151;
  transition: 0.3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.divider {
  border: 0;
  height: 1px;
  background: var(--surface-border);
  margin: 18px 0;
}

.test-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-primary {
  padding: 10px 18px;
  background: var(--primary-color);
  color: #07090e;
  font-weight: bold;
  font-size: 0.95rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:active {
  opacity: 0.8;
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
