:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #151515;
  --panel-2: #202020;
  --line: #2d2d2d;
  --text: #f5f5f5;
  --muted: #9ca3af;
  --muted-2: #6f7680;
  --red: #ff454f;
  --amber: #f6b23c;
  --green: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #101010;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.phone-shell {
  position: relative;
  width: min(100vw, 430px);
  height: min(100vh, 920px);
  min-height: 760px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid #262626;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.status-bar {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber);
}

.screen {
  position: absolute;
  inset: 42px 0 78px;
  display: none;
  overflow-y: auto;
  padding: 18px;
}

.screen.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted-2);
  font-size: 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.pill,
.progress-list span,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.record-stage {
  min-height: 620px;
  display: grid;
  grid-template-rows: 1fr auto auto auto 1fr;
  place-items: center;
}

.timer {
  margin: 20px 0 86px;
  color: #f1f1f1;
  font-size: 58px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  max-width: 260px;
  margin: 14px auto 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.record-button {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: white;
  cursor: pointer;
}

.record-button span {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: white;
}

.record-button.idle span {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-radius: 0;
  background: transparent;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid white;
}

.record-upload {
  width: 100%;
  max-width: 220px;
  margin-top: 22px;
}

.record-upload .secondary-button {
  width: 100%;
  min-height: 42px;
}

.progress-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.progress-list span {
  justify-content: center;
  color: var(--muted);
}

.progress-list span.done {
  color: var(--green);
}

.progress-list span.failed {
  color: var(--red);
}

.error-note {
  margin: -2px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 91, 100, 0.28);
  border-radius: 8px;
  background: rgba(255, 91, 100, 0.08);
  color: #ffb5ba;
  font-size: 12px;
  line-height: 1.55;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.content-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.audio-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.audio-panel h2 {
  margin-bottom: 6px;
}

.audio-panel p {
  max-width: 210px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-player {
  width: 100%;
  margin: 0 0 14px;
  accent-color: var(--amber);
}

.content-panel p {
  margin-bottom: 0;
  color: #e6e6e6;
  font-size: 15px;
  line-height: 1.75;
}

.content-panel .style-note {
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.content-panel.tall {
  min-height: 330px;
}

.content-panel.result {
  margin-top: 14px;
}

.detail-panel p,
.focus-panel p {
  white-space: pre-wrap;
}

.focus-panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(246, 178, 60, 0.28);
  border-radius: 8px;
  background: rgba(246, 178, 60, 0.08);
}

.focus-panel h2 {
  color: #ffd78a;
}

.focus-panel p {
  margin: 0;
  color: #f1d9a7;
  font-size: 13px;
  line-height: 1.7;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  background: #f5f5f5;
  color: #111;
  font-weight: 700;
}

.primary-button.compact {
  min-height: 46px;
}

.secondary-button {
  background: var(--panel-2);
  color: var(--text);
}

.wide-button {
  width: 100%;
  margin-bottom: 12px;
}

.ghost-button {
  min-height: 34px;
  padding: 0 12px;
  background: var(--panel-2);
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: 0;
}

.field input {
  height: 48px;
  padding: 0 14px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.6;
}

.search-box {
  height: 50px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.search-box input {
  height: 46px;
  border: 0;
  background: transparent;
}

.list {
  display: grid;
  gap: 10px;
}

.doc-item,
.evidence-item,
.setting-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.clickable-card {
  cursor: pointer;
}

.clickable-card:active {
  border-color: #4a4a4a;
  background: #1a1a1a;
}

.doc-item h3,
.evidence-item h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--muted-2);
  font-size: 12px;
}

.snippet {
  margin: 0;
  color: #d8d8d8;
  font-size: 13px;
  line-height: 1.65;
}

mark {
  border-radius: 4px;
  background: rgba(246, 178, 60, 0.24);
  color: #ffd78a;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px;
}

.source-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.source-list h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.source-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.source-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.source-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.service-status {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.setting-item.warning strong {
  color: #ffb3b8;
}

.diagnostic-list {
  display: grid;
  gap: 8px;
}

.diagnostic-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.diagnostic-item strong {
  color: var(--text);
  font-size: 13px;
}

.diagnostic-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.diagnostic-item span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.diagnostic-item.pass span {
  color: var(--green);
}

.diagnostic-item.warn span {
  color: #ffd78a;
}

.diagnostic-item.fail span {
  color: var(--red);
}

.settings-section {
  margin-top: 22px;
}

.settings-action {
  margin-top: 16px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.setting-item strong {
  color: var(--text);
  font-size: 14px;
}

.audio-file-item,
.job-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.audio-file-main,
.job-main {
  min-width: 0;
}

.audio-file-main h3,
.job-main h3 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
}

.audio-file-main p,
.job-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.job-error {
  margin-top: 6px !important;
  color: #ffb3b8 !important;
  overflow-wrap: anywhere;
}

.test-result {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.test-result p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.test-result strong {
  color: var(--text);
}

.delete-audio-button,
.retry-job-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 69, 79, 0.34);
  border-radius: 8px;
  background: rgba(255, 69, 79, 0.1);
  color: #ff8b92;
  cursor: pointer;
}

.retry-job-button {
  border-color: rgba(246, 178, 60, 0.34);
  background: rgba(246, 178, 60, 0.1);
  color: #ffd78a;
}

.delete-audio-button:disabled,
.retry-job-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(100%, 394px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.5);
}

.modal-card h2 {
  margin-bottom: 10px;
  font-size: 19px;
}

.modal-file {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.danger-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.bottom-nav {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: calc(100% - 34px);
  height: 62px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(37, 37, 37, 0.94);
  backdrop-filter: blur(16px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nav-item span {
  font-size: 17px;
  line-height: 1;
}

.nav-item small {
  font-size: 11px;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 5;
  min-height: 38px;
  padding: 10px 14px;
  transform: translateX(-50%) translateY(18px);
  border-radius: 999px;
  background: #f5f5f5;
  color: #111;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 460px) {
  body {
    display: block;
    background: var(--bg);
  }

  .phone-shell {
    width: 100vw;
    height: 100vh;
    min-height: 700px;
    border: 0;
    box-shadow: none;
  }
}
