:root {
  --bg: #0b0d12;
  --panel: #161a23;
  --accent: #ff7a45;
  --accent-on: #21c07a;
  --text: #f2f4f8;
  --muted: #8b93a7;
  --me: #2a3346;
}

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

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

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 8px;
  padding-top: max(env(safe-area-inset-top), 12px);
}

.title {
  font-weight: 700;
  font-size: 18px;
}

/* モデルトグル */
.model-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.model-toggle input {
  display: none;
}
.model-toggle .slider {
  width: 42px;
  height: 24px;
  background: #2a3040;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}
.model-toggle .slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.model-toggle input:checked + .slider {
  background: var(--accent);
}
.model-toggle input:checked + .slider::after {
  transform: translateX(18px);
}

/* 会話ログ */
main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}
.log {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 17px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.me {
  align-self: flex-end;
  background: var(--me);
  border-bottom-right-radius: 4px;
}
.bubble.friday {
  align-self: flex-start;
  background: var(--panel);
  border-bottom-left-radius: 4px;
}
.bubble .who {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* フッター：押して話すボタン */
footer {
  padding: 12px 16px max(env(safe-area-inset-bottom), 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.talk {
  width: 100%;
  max-width: 420px;
  height: 110px;
  border: none;
  border-radius: 24px;
  background: var(--accent);
  color: #1a1207;
  font-size: 26px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  transition: transform 0.08s, background 0.15s;
}
.talk:active,
.talk.recording {
  background: var(--accent-on);
  transform: scale(0.98);
  color: #04240f;
}
.talk.busy {
  background: #444b5c;
  color: var(--muted);
}
.status {
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

/* トークン入力モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}
.modal.hidden {
  display: none;
}
.modal-box {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-box input,
.modal-box button {
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
}
.modal-box input {
  background: #0b0d12;
  color: var(--text);
}
.modal-box button {
  background: var(--accent);
  color: #1a1207;
  font-weight: 700;
}
