:root {
  --paper: #f4f1ea;
  --ink: #17211c;
  --muted: #68736b;
  --line: #d8d2c6;
  --surface: #fffaf0;
  --surface-2: #ebe5d8;
  --accent: #0c6b5d;
  --accent-2: #b14d2c;
  --accent-3: #d7a928;
  --danger: #a63737;
  --ok: #1f7a4d;
  --shadow: 0 24px 60px rgba(46, 39, 28, 0.16);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 33, 28, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(23, 33, 28, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  min-height: 0;
  margin: 16px auto;
  overflow: hidden;
}

.interview-panel,
.review-panel,
.admin-shell {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--shadow);
}

.interview-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.topbar,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.audit-link,
.send-btn,
.start-btn,
.voice-btn,
.option-btn {
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
}

.audit-link {
  padding: 10px 14px;
  font-weight: 700;
}

.avatar-stage {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(12, 107, 93, 0.08), rgba(215, 169, 40, 0.12));
}

.avatar-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 164px;
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  background: radial-gradient(circle at 55% 38%, #ffe7c3 0 24%, #cf7b58 25% 38%, #17352f 39% 100%);
}

.avatar-orbit::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(255, 250, 240, 0.75);
}

.avatar-orbit.speaking {
  animation: pulse 1.2s ease-in-out infinite;
}

.avatar-orbit.listening {
  background: radial-gradient(circle at 55% 38%, #ffe7c3 0 24%, #d7a928 25% 38%, #17352f 39% 100%);
}

.avatar-face {
  position: relative;
  z-index: 1;
  width: 78px;
  height: 92px;
  border-radius: 44% 44% 48% 48%;
  background: #f2c99e;
  border: 1px solid rgba(23, 33, 28, 0.5);
}

.avatar-eye {
  position: absolute;
  top: 36px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.avatar-eye.left {
  left: 22px;
}

.avatar-eye.right {
  right: 22px;
}

.avatar-mouth {
  position: absolute;
  left: 50%;
  bottom: 25px;
  width: 24px;
  height: 8px;
  border-bottom: 2px solid var(--ink);
  transform: translateX(-50%);
}

.speaking .avatar-mouth {
  height: 14px;
  border: 2px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 20px 20px;
}

.stage-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(24px, 3vw, 38px);
}

.stage-label {
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 800;
}

.stage-copy p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.chat-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  min-height: 260px;
  padding: 4px 4px 16px;
}

.message {
  max-width: min(720px, 88%);
  border: 1px solid var(--line);
  padding: 12px 14px;
  line-height: 1.65;
  background: var(--surface);
}

.message.agent {
  align-self: flex-start;
  border-left: 5px solid var(--accent);
}

.message.user {
  align-self: flex-end;
  border-right: 5px solid var(--accent-3);
  background: #fff4d6;
}

.message.meta {
  align-self: center;
  color: var(--muted);
  background: transparent;
  border-style: dashed;
  font-size: 13px;
}

.option-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
}

.option-btn {
  min-height: 42px;
  padding: 8px 12px;
  background: #f8efe0;
}

.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.voice-btn,
.send-btn,
.start-btn {
  min-height: 48px;
  padding: 0 16px;
  font-weight: 800;
}

.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.voice-btn.recording {
  background: #f7ded3;
  color: var(--danger);
}

.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.composer input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: white;
}

.composer.is-disabled {
  opacity: 0.58;
}

.composer.is-disabled input,
.composer.is-disabled button {
  cursor: not-allowed;
}

.send-btn,
.start-btn {
  background: var(--ink);
  color: var(--surface);
}

.review-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.review-header h2,
.detail-card h2 {
  margin-bottom: 0;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.summary-row dt {
  color: var(--muted);
}

.summary-row dd {
  margin: 0;
  font-weight: 750;
  word-break: break-word;
}

.quality-box,
.detail-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
  padding: 14px;
}

.quality-box h3 {
  margin-bottom: 8px;
}

.quality-box p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.start-btn {
  margin-top: auto;
  width: 100%;
}

.admin-body {
  background: #ede8dc;
}

.admin-shell {
  width: min(1220px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
  min-height: 0;
  overflow: hidden;
}

.admin-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: calc(100vh - 128px);
}

.session-list {
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}

.session-item {
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}

.session-item.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.session-detail {
  padding: 18px;
  overflow: auto;
}

.detail-empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--muted);
  border: 1px dashed var(--line);
}

#detailContent {
  display: grid;
  gap: 14px;
}

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

.event-item {
  border-left: 4px solid var(--accent-3);
  background: rgba(255, 250, 240, 0.7);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.event-item code {
  display: block;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

@media (max-width: 860px) {
  .app-shell,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 18px, 760px);
    height: 100vh;
    margin: 9px auto;
    overflow: hidden;
  }

  .interview-panel {
    min-height: auto;
  }

  .avatar-stage {
    grid-template-columns: 108px minmax(0, 1fr);
    padding: 16px;
  }

  .avatar-orbit {
    width: 104px;
  }

  .avatar-face {
    width: 52px;
    height: 62px;
  }

  .avatar-eye {
    top: 25px;
  }

  .avatar-eye.left {
    left: 14px;
  }

  .avatar-eye.right {
    right: 14px;
  }

  .avatar-mouth {
    bottom: 16px;
  }

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

  .message {
    max-width: 96%;
  }

  .session-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 260px;
  }
}
