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

:root {
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #eaebf0;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-sub: #475569;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  
  --green: #16a34a;
  --green-bg: #dcfce7;
  --orange: #d97706;
  --orange-bg: #fef3c7;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  
  --item-bg: #fafafa;
  --item-border: #f1f5f9;
}

:root[data-theme="dark"] {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.15);
  --orange: #fbbf24;
  --orange-bg: rgba(251, 191, 36, 0.15);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, 0.15);
  
  --item-bg: #182234;
  --item-border: #2c3b52;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* NAVBAR */
.navbar {
  width: 100%;
  border-bottom: 1px solid var(--card-border);
  background: var(--card-bg);
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--item-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--card-border);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* MAIN CONTENT */
.main-content {
  max-width: 760px;
  width: 100%;
  margin: 40px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* PAGE HEADER */
.page-header {
  text-align: center;
  margin-bottom: 8px;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.badge-dot {
  font-size: 10px;
  opacity: 0.7;
}

.main-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* CARDS COMMON */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* CUE CARD */
.cue-card {
  padding: 24px 28px;
}

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

.cue-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: opacity 0.15s ease;
}

.btn-text:hover {
  opacity: 0.8;
}

.cue-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 16px;
}

.cue-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.cue-bullets li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.4;
}

.cue-bullets li::before {
  content: "•";
  position: absolute;
  left: 4px;
  top: -1px;
  color: var(--primary);
  font-size: 16px;
}

.cue-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}

/* RECORDING BAR */
.recording-bar {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.mic-btn:hover {
  transform: scale(1.04);
}

.mic-btn.recording {
  background: #ef4444;
  color: #ffffff;
  animation: pulse-red 1.5s infinite;
}

.timer-display {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 36px;
  flex: 1;
}

.bar {
  width: 3px;
  height: 8px;
  background: var(--primary);
  border-radius: 2px;
  opacity: 0.4;
  transition: height 0.2s ease, opacity 0.2s ease;
}

.waveform.active .bar {
  opacity: 0.8;
  animation: wave 1s ease-in-out infinite;
}

.waveform.active .bar:nth-child(2n)  { animation-delay: 0.1s; }
.waveform.active .bar:nth-child(3n)  { animation-delay: 0.2s; }
.waveform.active .bar:nth-child(4n)  { animation-delay: 0.35s; }
.waveform.active .bar:nth-child(5n)  { animation-delay: 0.5s; }

.btn-finish {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

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

.btn-finish:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.square-icon {
  font-size: 10px;
}

/* LOADING CONTAINER */
.loading-container {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-container.active {
  display: flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* RESULTS CARD & TABS */
.results-card {
  overflow: hidden;
}

.tabs-header {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--card-border);
  padding: 0 24px;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 16px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content {
  padding: 24px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* FEEDBACK GRID */
.feedback-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background: var(--item-bg);
  border: 1px solid var(--item-border);
}

.feedback-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feedback-icon.green {
  background: var(--green-bg);
  color: var(--green);
}

.feedback-icon.orange {
  background: var(--orange-bg);
  color: var(--orange);
}

.feedback-icon.blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.feedback-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.feedback-title.green { color: var(--green); }
.feedback-title.orange { color: var(--orange); }
.feedback-title.blue { color: var(--blue); }

.feedback-desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.5;
}

.pane-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-sub);
  white-space: pre-wrap;
}

/* ANIMATIONS */
@keyframes wave {
  0%, 100% { height: 6px; }
  50% { height: 26px; }
}

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

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@media (max-width: 640px) {
  .nav-right { gap: 14px; }
  .recording-bar { flex-wrap: wrap; justify-content: center; }
  .waveform { display: none; }
}

/* MODAL STYLING */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  max-width: 520px;
  width: 90%;
  padding: 24px 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

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

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

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

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-modal-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

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