:root {
  --bg: #0f1115;
  --fg: #e6e8ee;
  --muted: #8a90a0;
  --panel: #171a21;
  --accent: #3b82f6;
  --accent-active: #2563eb;
  --danger: #dc2626;
  --disabled: #2a2f3a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  flex: none;
}

.gear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
}

.gear[aria-expanded="true"] {
  color: var(--fg);
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 28px;
  line-height: 1;
  padding: 8px 12px;
}

.bottom {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 20px;
}

.ptt {
  width: min(70vw, 280px);
  height: min(70vw, 280px);
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  box-shadow: 0 10px 40px rgba(59, 130, 246, 0.25);
  transition: background 120ms ease, transform 120ms ease;
}

.ptt:disabled {
  background: var(--disabled);
  color: var(--muted);
  cursor: default;
  box-shadow: none;
}

.ptt.held {
  background: var(--accent-active);
  transform: scale(0.96);
}

.ptt.cancel {
  background: var(--danger);
}

.status {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.history {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  max-width: 80%;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.caller {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.agent {
  align-self: flex-start;
  background: var(--panel);
  border-bottom-left-radius: 4px;
}

.settings {
  flex: none;
  padding: 4px 20px 12px;
  display: grid;
  gap: 12px;
}

.token {
  width: min(70vw, 280px);
}

.slider, .token {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.token input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--disabled);
  background: var(--panel);
  color: var(--fg);
  font-size: 16px;
}

.hidden { display: none; }
