:root {
  --bg: #0b0e11;
  --surface: #141920;
  --border: #242c36;
  --text: #e8edf2;
  --muted: #8a97a6;
  --accent: #4c9a7b;
  --accent-glow: rgba(76, 154, 123, 0.32);
  --speaking: #5b8def;
  --speaking-glow: rgba(91, 141, 239, 0.35);
  --danger: #d15b5b;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  overscroll-behavior: none;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.ghost-btn:active {
  background: var(--surface);
  color: var(--text);
}

.drive-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding-bottom: 24px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.talk-orb {
  position: relative;
  width: min(64vw, 260px);
  height: min(64vw, 260px);
  border-radius: 50%;
  border: 2px solid var(--border);
  background: radial-gradient(circle at 35% 30%, #1c242e, #10151b);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}

.talk-orb:active {
  transform: scale(0.96);
}

.orb-core {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.talk-orb[data-state="listening"] {
  border-color: var(--accent);
  box-shadow: 0 0 48px var(--accent-glow);
}

.talk-orb[data-state="speaking"] {
  border-color: var(--speaking);
  box-shadow: 0 0 56px var(--speaking-glow);
}

.talk-orb[data-state="connecting"],
.talk-orb[data-state="saving"] {
  border-color: var(--muted);
  opacity: 0.8;
}

.mode-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mode-chip {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.mode-chip.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(76, 154, 123, 0.15);
}

.caption-box {
  width: 100%;
  max-width: 480px;
  min-height: 76px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.caption-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.sheet {
  width: min(94vw, 520px);
  max-height: 85dvh;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.sheet-inner {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-header h2 {
  margin: 0;
  font-size: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.primary-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #0b0e11;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.meta-text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 62dvh;
}

.history-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg);
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.history-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
