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

html, body {
  height: 100%;
  font-family: -apple-system, "SF Pro Display", BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  background: #0f0f14;
  color: #e8e8e8;
  overflow: hidden;
  font-size: 16px;
  -webkit-user-select: none;
  user-select: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ── PIN ── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0f0f14 0%, #1a1a25 100%);
}
.login-box {
  width: 280px;
  text-align: center;
  padding: 40px 24px;
  background: rgba(255,255,255,0.04);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}
.login-box h1 { font-size: 32px; margin-bottom: 8px; color: #7ab8e8; }
.subtitle { font-size: 14px; color: #888; margin-bottom: 24px; }
#pin-input {
  width: 100%;
  padding: 16px;
  font-size: 22px;
  text-align: center;
  letter-spacing: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  color: white;
  outline: none;
  margin-bottom: 16px;
}
#pin-input:focus { border-color: #7ab8e8; }
.error { color: #ff6b6b; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ── Header ── */
header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.ctx-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.select {
  flex: 1;
  background: rgba(100, 180, 255, 0.1);
  color: #7ab8e8;
  padding: 8px 12px;
  border: 1px solid rgba(100, 180, 255, 0.25);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237ab8e8'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  padding-right: 28px;
  outline: none;
}
.btn-tiny {
  background: rgba(255,255,255,0.08);
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}
.btn-tiny.tts-on {
  background: rgba(255, 59, 48, 0.3);
  color: #ff6b6b;
  border-color: rgba(255, 59, 48, 0.5);
}
.btn-tiny.tts-on.tts-speaker {
  background: rgba(100, 180, 255, 0.3);
  color: #7ab8e8;
  border-color: rgba(100, 180, 255, 0.5);
}
.btn-tiny.tts-on.speaking {
  background: rgba(255, 204, 0, 0.3);
  color: #ffe080;
  border-color: rgba(255, 204, 0, 0.5);
  animation: pulse 0.8s infinite;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #888;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  transition: background 0.2s;
}
.dot.recording { background: #ff3b30; animation: pulse 1.2s infinite; }
.dot.thinking { background: #ffcc00; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Answer ── */
.answer-section {
  flex-shrink: 0;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.answer-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #888;
  margin-bottom: 4px;
}
.answer {
  font-size: 17px;
  line-height: 1.5;
  color: #f0f0f0;
  max-height: 38vh;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
  padding: 8px 0;
}
.answer.thinking { color: #ffcc00; }
.answer.error { color: #ff6b6b; }

/* ── Transcript ── */
.transcript-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
  overflow: hidden;
}
.transcript {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: #888;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  -webkit-user-select: text;
  user-select: text;
  padding: 4px 0;
}

/* ── Controls ── */
.controls {
  flex-shrink: 0;
  padding: 12px 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-record {
  height: 64px;
  background: linear-gradient(180deg, #2e75b6, #1f4e79);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  -webkit-tap-highlight-color: rgba(255,255,255,0.15);
  transition: background 0.15s;
}
.btn-record:active { background: linear-gradient(180deg, #1f4e79, #14365a); }
.btn-record.recording {
  background: linear-gradient(180deg, #ff3b30, #c0271f);
  animation: pulse 1.2s infinite;
}
.btn-record #btn-record-icon { font-size: 18px; }

.ctl-row { display: flex; gap: 8px; }
.btn-secondary {
  flex: 1;
  background: rgba(100, 180, 255, 0.15);
  color: #7ab8e8;
  border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:active { background: rgba(100, 180, 255, 0.3); }
.btn-primary {
  width: 100%;
  background: linear-gradient(180deg, #2e75b6, #1f4e79);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }
