:root {
  --bg: #0a0c10;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --text: #ffffff;
  --muted: #8b949e;
  --accent: #00bfff;
  --accent-dark: #008db3;
  --accent-glow: rgba(0, 191, 255, 0.3);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(0, 191, 255, 0.04), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(0, 206, 209, 0.03), transparent 50%);
  background-attachment: fixed;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.panel,
.hero-card,
.sidebar {
  border-radius: 24px;
}

button {
  border: 0;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px var(--accent-glow);
}

button:hover {
  transform: translateY(-2px);
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 6px 20px var(--accent-glow);
}

button.secondary {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateY(-1px);
}

button:disabled,
select:disabled,
input:read-only {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

button:disabled:hover {
  transform: none;
  background: var(--surface-strong);
  color: var(--text);
}

input,
textarea,
select {
  width: 100%;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

pre {
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: #c9d1d9;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  min-height: 100vh;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.sidebar,
.hero-card,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
}

.sidebar-top {
  display: grid;
  gap: 1.2rem;
}

.logo-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: -2rem -2rem 0 -2rem;
  border-radius: 23px 23px 0 0;
  overflow: hidden;
}

.logo-container img {
  width: 100%;
  height: auto;
  display: block;
}

.sidebar h1 {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.menu {
  display: grid;
  gap: 0.5rem;
}

.session-area {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.session-badge {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 191, 255, 0.08);
  color: #9fdfff;
  font-size: 0.85rem;
  word-break: break-word;
}

.logout-sidebar-btn {
  width: 100%;
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  border-radius: 10px;
  box-shadow: none;
}

.menu button {
  text-align: left;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  box-shadow: none;
  padding: 1rem 1.2rem;
  border-radius: 12px;
}

.menu button:hover {
  background: var(--surface-strong);
  color: var(--text);
  transform: none;
}

.menu button.active {
  background: rgba(0, 191, 255, 0.1);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
}

.menu-toggle {
  display: none;
}

.content {
  display: grid;
  align-items: start;
}

.hero-card,
.panel {
  padding: 2.5rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

h2 {
  margin: 0 0 1.5rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
}

.actions,
.panel-head,
.two-col {
  display: grid;
  gap: 1.5rem;
}

.actions {
  grid-template-columns: repeat(2, max-content);
  margin-top: 2rem;
}

.panel-head {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 2rem;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.recorder-hero {
  text-align: center;
  padding: 4rem 2rem;
}

.hero-title {
  font-size: 2.5rem;
}

.capture-options {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.capture-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.capture-option input {
  width: auto;
}

.hero-actions {
  grid-template-columns: 1fr;
  max-width: 400px;
  margin: 0 auto;
  gap: 1rem;
}

#start-recording {
  font-size: 1.25rem;
  padding: 1.25rem;
  border-radius: 100px;
}

#stop-recording {
  border-radius: 100px;
}

#recorder-status {
  margin-top: 1.5rem;
  color: var(--muted);
}

.hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.wave-shell {
  margin-top: 3rem;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wave-track {
  width: 100%;
  max-width: 300px;
  height: 2px;
  background: var(--line);
  position: relative;
}

.wave-icon {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  opacity: 0.5;
}

.recordings-list {
  display: grid;
  gap: 1rem;
}

.recording-item {
  padding: 1.2rem 1.4rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  transition: background 0.2s, border-color 0.2s;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.recording-item:hover {
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.2);
}

.recording-item p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 2rem;
}

.recording-summary {
  display: grid;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.meta-text,
.soft-text {
  color: var(--muted);
}

.meta-text {
  margin: 0.4rem 0 0;
}

.audio-player-container audio {
  width: 100%;
}

.transcript-output {
  min-height: 420px;
  max-height: 600px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  padding: 1.5rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-column {
  display: flex;
  flex-direction: column;
}

.chat-history {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 1rem;
  flex: 1;
}

.chat-bubble {
  padding: 1rem 1.25rem;
  border-radius: 18px 18px 18px 4px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  line-height: 1.5;
  max-width: 85%;
}

.chat-bubble p {
  margin: 0.35rem 0 0;
}

.chat-bubble[data-role="user"] {
  background: rgba(0, 191, 255, 0.1);
  border-color: rgba(0, 191, 255, 0.2);
  border-radius: 18px 18px 4px 18px;
  margin-left: auto;
}

.chat-form {
  margin-top: 1.5rem;
}

.chat-input-shell {
  position: relative;
}

.chat-input-shell textarea {
  padding-right: 4rem;
  resize: none;
}

.chat-submit {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--text);
}

.chat-submit:hover {
  transform: translateY(-50%);
}

.settings-panel {
  max-width: 600px;
  margin: 0 auto;
}

.settings-grid,
form {
  display: grid;
  gap: 1.2rem;
}

.styled-select {
  appearance: none;
}

.login-grid {
  max-width: 900px;
  margin: 0 auto;
}

.tight-title {
  margin-bottom: 0.5rem;
}

.auth-status {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--accent);
}

#logout-btn {
  margin-top: 0.75rem;
}

.register-panel {
  background: rgba(0, 191, 255, 0.02);
}

::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .sidebar {
    padding: 1rem;
  }

  .sidebar-top {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .logo-container {
    margin: -1rem -1rem 0 -1rem;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .menu {
    display: none;
  }

  .menu.is-open {
    display: grid;
    margin-top: 1rem;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .panel,
  .hero-card {
    padding: 1.4rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .panel-head,
  .view-header,
  .recording-item {
    grid-template-columns: 1fr;
    display: grid;
  }

  .recording-item {
    align-items: start;
  }

  .recording-item button {
    width: 100%;
  }
}

/* Custom Premium Audio Player */
.audio-player-container {
  width: 100%;
  margin-top: 1rem;
}

.custom-player {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.play-pause-btn {
  background: var(--accent);
  color: #000 !important;
  border: none;
  border-radius: 50% !important;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 4px 12px var(--accent-glow);
  padding: 0;
}

.play-pause-btn:hover {
  transform: scale(1.05);
  background: var(--accent-dark);
}

.player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}

.progress-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  box-shadow: 0 0 10px var(--accent-glow);
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100px;
}

.volume-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  padding: 0;
  border: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
}

@media (max-width: 480px) {
  .custom-player {
    flex-wrap: wrap;
  }
  .volume-container {
    display: none;
  }
}

/* Transcript Bubbles */
.transcript-output {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: transparent !important;
  border: none !important;
  font-family: inherit !important;
  overflow-y: auto;
}

.chat-bubble {
  max-width: 85%;
  display: flex;
  flex-direction: column;
}

.chat-bubble.p1 { align-self: flex-start; }
.chat-bubble.p2 { align-self: flex-end; }
.chat-bubble.p3 { align-self: flex-start; }

.bubble-meta {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-bottom: 0.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-bubble.p1 .bubble-meta { color: var(--accent); opacity: 0.8; }

.bubble-content {
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-bubble.p1 .bubble-content {
  background: rgba(0, 210, 255, 0.07);
  border-left: 3px solid var(--accent);
}

.chat-bubble.p2 .bubble-content {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.chat-bubble.p3 .bubble-content {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #888;
}

/* Assistant Chat Styles */
.chat-history {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.chat-history article {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 90%;
}

.chat-history article[data-role="user"] {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-history article[data-role="assistant"] {
  align-self: flex-start;
  background: rgba(0, 191, 255, 0.03);
  border: 1px solid rgba(0, 191, 255, 0.1);
}

.chat-history article strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  opacity: 0.6;
  letter-spacing: 0.05em;
}

/* Summary Card */
.summary-card {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.05), rgba(0, 210, 255, 0.01)) !important;
  border: 1px solid rgba(0, 210, 255, 0.2) !important;
  margin-bottom: 1.5rem;
}

.summary-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-mini {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-mini:hover {
  background: rgba(0, 210, 255, 0.1);
  border-color: var(--accent);
}

.tutorial-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.tutorial-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 1.2rem 0;
}

.tutorial-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tutorial-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.tutorial-steps li strong {
  color: var(--text);
}

.step-number {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 191, 255, 0.12);
  border: 1px solid rgba(0, 191, 255, 0.3);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
