:root {
  --bg: #f5f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #dbe6ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --shadow: 0 24px 70px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #dbeafe 0, transparent 35%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  height: 100vh;
  padding: 24px;
}

.panel,
.main {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 10px;
  font-size: 32px;
  line-height: 1.1;
}

.muted {
  color: var(--muted);
}

.card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  background: #fbfdff;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 12px 14px;
  resize: vertical;
}

select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

button {
  border: 0;
  border-radius: 16px;
  background: #e9eef6;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  padding: 12px 16px;
}

button.primary {
  background: var(--primary);
  color: #fff;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.final-score {
  border-top: 1px solid var(--border);
  background: #fbfdff;
  color: var(--text);
  max-height: 280px;
  overflow-y: auto;
  padding: 20px 24px;
  white-space: pre-wrap;
}

.final-score.hidden {
  display: none;
}

.score {
  color: var(--success);
  font-size: 30px;
  font-weight: 800;
}

.chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 24px;
}

.msg {
  border-radius: 20px;
  max-width: 780px;
  padding: 14px 16px;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: #dbeafe;
}

.turn-assessment {
  align-self: flex-end;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  color: #1e3a8a;
  display: grid;
  font-size: 13px;
  gap: 4px;
  margin-top: -8px;
  max-width: 780px;
  padding: 10px 12px;
}

.ise-log {
  margin-top: 4px;
}

.ise-log summary {
  cursor: pointer;
  font-weight: 700;
}

.ise-log pre {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1f2937;
  font-size: 11px;
  margin: 6px 0;
  max-height: 180px;
  max-width: 720px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
}

.msg.assistant {
  align-self: flex-start;
  background: #f1f5f9;
}

.voice-pad {
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 24px 22px;
}

.hold-record {
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.25);
  color: #fff;
  font-size: 18px;
  min-width: 260px;
  padding: 18px 32px;
  touch-action: none;
  user-select: none;
}

.hold-record.recording {
  background: #dc2626;
  box-shadow: 0 18px 42px rgba(220, 38, 38, 0.28);
  transform: scale(1.03);
}

.hold-record.canceling {
  background: #6b7280;
}

.cancel-hint {
  background: rgba(17, 24, 39, 0.86);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  padding: 8px 14px;
}

.cancel-hint.hidden {
  display: none;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel,
  .main {
    min-height: 420px;
  }
}
