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

:root {
  color-scheme: light;
  --bg-top: #edf4ff;
  --bg-bottom: #f7faff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --surface-soft: rgba(255, 255, 255, 0.56);
  --border: rgba(255, 255, 255, 0.84);
  --border-soft: rgba(120, 150, 196, 0.18);
  --text: #182437;
  --text-soft: #5a6b82;
  --text-faint: #7c8ca3;
  --accent: #1d6cff;
  --accent-soft: rgba(29, 108, 255, 0.12);
  --success: #15946f;
  --danger: #d44966;
  --warning: #d77d2d;
  --shadow-lg: 0 26px 64px rgba(107, 137, 179, 0.2);
  --shadow-md: 0 14px 36px rgba(114, 144, 184, 0.12);
  --shadow-sm: 0 10px 20px rgba(119, 147, 184, 0.08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

html, body {
  min-height: 100%;
  font-family: "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(143, 197, 255, 0.34), transparent 34%),
    radial-gradient(circle at bottom right, rgba(190, 223, 255, 0.32), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  overflow: auto;
}

body {
  position: relative;
}

.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(12px);
}

.orb-a {
  width: 280px;
  height: 280px;
  top: -100px;
  right: -72px;
  background: radial-gradient(circle, rgba(161, 205, 255, 0.82), rgba(161, 205, 255, 0));
}

.orb-b {
  width: 260px;
  height: 260px;
  left: -90px;
  bottom: 48px;
  background: radial-gradient(circle, rgba(190, 223, 255, 0.78), rgba(190, 223, 255, 0));
}

.orb-c {
  width: 220px;
  height: 220px;
  left: 42%;
  top: 26%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0));
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 14px;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.95fr);
  gap: 14px;
  min-height: calc(100vh - 28px);
}

.glass-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.56));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.left-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px;
  gap: 14px;
}

.left-pane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-copy {
  display: grid;
  gap: 6px;
}

.panel-eyebrow,
.shell-eyebrow,
.info-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.panel-copy h1,
.panel-copy h2,
.shell-heading h2 {
  letter-spacing: -0.03em;
}

.panel-copy h1 {
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.1;
}

.panel-copy h2 {
  font-size: 24px;
}

.panel-subtitle {
  color: var(--text-soft);
}

.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a3b2c7;
  transition: background 0.24s ease, box-shadow 0.24s ease;
}

.status-dot.listening {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(21, 148, 111, 0.14);
  animation: pulse 1.8s infinite;
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(212, 73, 102, 0.14);
}

.status-text {
  font-size: 13px;
}

.recognized-shell,
.results-shell {
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.recognized-shell {
  flex-shrink: 0;
}

.results-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.shell-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.recognized-text {
  min-height: 76px;
}

.recognized-text:empty::before {
  content: "开始听取后，这里会显示面试官当前的问题。";
  display: block;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-faint);
}

.recognized-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

.recognized-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.recognized-item.interim .recognized-badge {
  color: var(--accent);
  background: var(--accent-soft);
}

.recognized-item.final .recognized-badge {
  color: var(--success);
  background: rgba(21, 148, 111, 0.12);
}

.recognized-copy {
  font-size: 16px;
  color: var(--text);
  word-break: break-word;
}

.results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.results::-webkit-scrollbar,
.right-pane::-webkit-scrollbar,
.card-body::-webkit-scrollbar,
.paste-area::-webkit-scrollbar {
  width: 5px;
}

.results::-webkit-scrollbar-thumb,
.right-pane::-webkit-scrollbar-thumb,
.card-body::-webkit-scrollbar-thumb,
.paste-area::-webkit-scrollbar-thumb {
  background: rgba(113, 137, 168, 0.34);
  border-radius: 999px;
}

.search-time-bar {
  margin-bottom: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
}

.empty-state,
.no-match {
  text-align: center;
  padding: 44px 18px;
}

.empty-state {
  color: var(--text-soft);
}

.empty-state .hint,
.no-match .search-time {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

.no-match {
  color: var(--danger);
}

.result-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.7));
  border-radius: 22px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-md);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.card-title::after {
  content: "⌄";
  font-size: 13px;
  color: var(--text-faint);
  transition: transform 0.2s ease;
}

.result-card.collapsed .card-title::after {
  transform: rotate(-90deg);
}

.card-body {
  padding: 0 16px 14px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.result-card.collapsed .card-body {
  display: none;
}

.card-source {
  padding: 0 16px 14px;
  font-size: 12px;
  color: var(--text-faint);
}

.card-body p,
.card-body ul,
.card-body ol,
.card-body table,
.card-body blockquote,
.card-body pre {
  margin-top: 10px;
}

.card-body code {
  background: rgba(29, 108, 255, 0.08);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 13px;
}

.card-body pre {
  padding: 12px;
  border-radius: 16px;
  background: rgba(236, 242, 250, 0.96);
  overflow-x: auto;
}

.card-body pre code {
  background: transparent;
  padding: 0;
}

.card-body ul,
.card-body ol {
  padding-left: 20px;
}

.card-body strong,
.card-body h1,
.card-body h2,
.card-body h3,
.card-body h4,
.card-body h5,
.card-body h6 {
  color: #0c4ac0;
}

.card-body blockquote {
  padding: 10px 12px;
  border-left: 3px solid rgba(29, 108, 255, 0.26);
  background: rgba(29, 108, 255, 0.05);
  border-radius: 12px;
  color: var(--text-soft);
}

.card-body table {
  width: 100%;
  border-collapse: collapse;
}

.card-body th,
.card-body td {
  border: 1px solid rgba(150, 173, 205, 0.34);
  padding: 8px;
  text-align: left;
}

.card-body th {
  background: rgba(255, 255, 255, 0.56);
}

.right-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.control-card,
.guide-card,
.info-card {
  padding: 18px;
}

.control-card {
  display: grid;
  gap: 14px;
}

.btn {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn:focus-visible,
.search-input:focus-visible,
.card-title:focus-visible,
.paste-title:focus-visible,
.paste-area:focus-visible {
  outline: 2px solid rgba(29, 108, 255, 0.28);
  outline-offset: 2px;
}

.btn-voice {
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(17, 102, 255, 0.96), rgba(91, 148, 255, 0.92));
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(29, 108, 255, 0.24);
}

.btn-voice.active {
  background: linear-gradient(135deg, rgba(21, 148, 111, 0.96), rgba(60, 189, 148, 0.88));
  box-shadow: 0 18px 36px rgba(21, 148, 111, 0.2);
}

.btn-sm {
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.btn:hover,
.btn:active {
  transform: translateY(-1px);
}

.btn-danger {
  color: var(--danger);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.search-group {
  display: grid;
  gap: 8px;
}

.search-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.search-input,
.paste-title,
.paste-area {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.search-input {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 18px;
  outline: none;
}

.search-input::placeholder,
.paste-title::placeholder,
.paste-area::placeholder {
  color: var(--text-faint);
}

.guide-card {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-soft);
}

.guide-card strong {
  color: var(--text);
}

.dismiss {
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.info-card {
  display: grid;
  gap: 8px;
}

#kbInfo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(21, 28, 40, 0.28);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  width: min(100%, 520px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-soft);
}

.paste-title {
  margin: 14px 18px 0;
  padding: 10px 14px;
  border-radius: 16px;
  outline: none;
}

.paste-area {
  margin: 12px 18px;
  padding: 12px 14px;
  border-radius: 18px;
  outline: none;
  resize: none;
  flex: 1;
  min-height: 220px;
  line-height: 1.7;
}

.btn-paste-confirm {
  margin: 0 18px 18px;
  min-height: 48px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(17, 102, 255, 0.96), rgba(91, 148, 255, 0.92));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.92); }
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .left-pane,
  .right-pane {
    min-height: auto;
  }

  .results-shell {
    min-height: 420px;
  }
}

@media (max-width: 540px) {
  #app {
    padding: 12px;
  }

  .left-pane,
  .control-card,
  .guide-card,
  .info-card {
    padding: 16px;
  }

  .left-pane-header {
    flex-direction: column;
  }

  .action-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-copy h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
