* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --primary: #e94560;
  --primary-hover: #ff6b81;
  --text: #eee;
  --text-muted: #999;
  --success: #2ecc71;
  --border: #333;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--primary);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.avatar-section {
  margin-top: 16px;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
}

.disclaimer {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.disclaimer a {
  color: var(--primary);
  text-decoration: none;
}

.disclaimer a:hover {
  text-decoration: underline;
}

/* Record button */
#record-section {
  text-align: center;
  margin-bottom: 24px;
}

.big-btn {
  width: 100%;
  padding: 24px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

.big-btn:active, .big-btn.recording {
  background: var(--primary);
  transform: scale(0.97);
}

.big-btn .icon {
  font-size: 2.5rem;
}

#timer {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  margin-top: 8px;
}

/* Upload */
#upload-section {
  margin-bottom: 24px;
}

#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: border-color 0.2s;
}

#drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(233, 69, 96, 0.1);
}

#drop-zone .small {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 8px 0;
}

.file-label {
  display: inline-block;
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.file-label:active {
  background: var(--primary);
}

/* Options */
#options-section {
  margin-bottom: 24px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.option-row label {
  font-size: 0.95rem;
}

#cleanup-toggle {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

#lang-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

/* Status */
#status-section {
  margin-bottom: 24px;
}

#status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result */
#result-section {
  margin-bottom: 24px;
}

#result-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  flex: 1;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.tab.active {
  border-color: var(--primary);
  color: var(--text);
}

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-box:focus {
  border-color: var(--primary);
}

.meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.action-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.action-btn:active {
  transform: scale(0.97);
}

.action-btn.primary {
  background: var(--primary);
  color: white;
}

.action-btn.primary:hover {
  background: var(--primary-hover);
}

.action-btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

#copy-feedback {
  text-align: center;
  color: var(--success);
  font-weight: 600;
  margin-top: 8px;
  animation: fadeIn 0.3s;
}

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

/* Utility */
.hidden {
  display: none !important;
}

/* Safe area for notch devices */
@supports (padding-top: env(safe-area-inset-top)) {
  #app {
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}
