/* 车机优先：深色、大字、大触控区。不依赖 hover。 */

:root {
  --bg: #101215;
  --card: #1a1e24;
  --card-2: #232830;
  --text: #f1f3f5;
  --muted: #9aa3ae;
  --line: #2c323b;
  --accent: #2f7cf6;
  --accent-2: #1f66d8;
  --ok: #22a06b;
  --danger: #e5484d;
}

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

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 18px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.screen { height: 100%; display: flex; flex-direction: column; }

/* --------------------------------------------------------------- 通用控件 */

.btn {
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:active { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .5; }

input, textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

code {
  background: var(--card-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .9em;
}

.error { color: var(--danger); margin-top: 12px; }
.hint { margin-top: 10px; font-size: 16px; }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }

/* ------------------------------------------------------------------ 登录 */

#login { align-items: center; justify-content: center; }
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  text-align: center;
}
.big-emoji { font-size: 44px; }
.login-card h1 { margin: 8px 0 22px; font-size: 24px; }
.login-card input { text-align: center; letter-spacing: 4px; font-size: 22px; }
.login-card .btn { width: 100%; }

/* ------------------------------------------------------------------ 配置 */

#setup { overflow-y: auto; padding: 24px; align-items: center; }
.setup-card {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
}
.setup-card h2 { margin: 0 0 20px; }
.step { padding: 18px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: none; padding-top: 0; }
.step-head { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.step-head .num {
  display: inline-block;
  width: 28px; height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  font-size: 16px;
}
.step p { margin: 0 0 14px; font-size: 16px; }

.chat-list { display: grid; gap: 8px; margin-bottom: 12px; }
.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.chat-item.active { border-color: var(--accent); }
.chat-item .tag { font-size: 14px; color: var(--accent); }

/* -------------------------------------------------------------- 主界面 */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.to { font-size: 17px; color: var(--muted); }
.to b { color: var(--text); }
.icon-btn {
  width: 48px; height: 48px;
  font-size: 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
}

/* 核心：一屏放下的大按钮网格，行驶中一次点击就发出 */
.grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 14px 20px;
  overflow: hidden;
}
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 18px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  word-break: break-word;
}
.tile:active { background: var(--accent); border-color: var(--accent); }
.tile.sending { opacity: .55; }
.tile.sent { background: var(--ok); border-color: var(--ok); }

/* 发送成功的全屏反馈：开车时余光就能确认 */
.flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(34, 160, 107, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 700;
}
.flash.bad { background: rgba(229, 72, 77, .94); font-size: 26px; padding: 40px; text-align: center; }

/* -------------------------------------------------------------- 设置面板 */

.panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, .6);
  overflow-y: auto;
  padding: 24px;
}
.panel-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
}
.panel-card h2 { margin: 0 0 18px; }
.field { padding: 16px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: none; padding-top: 0; }
.field label { display: block; font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.panel-actions { display: flex; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.panel-actions .btn { flex: 1; }

.history { max-height: 240px; overflow-y: auto; display: grid; gap: 8px; }
.msg { padding: 10px 14px; border-radius: 12px; background: var(--card-2); font-size: 16px; }
.msg.out { background: rgba(47, 124, 246, .18); }
.msg .meta { font-size: 13px; color: var(--muted); margin-bottom: 2px; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  background: #000;
  border: 1px solid var(--line);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
}
.toast.bad { background: var(--danger); border-color: var(--danger); }

/* 竖屏 / 小屏：单列 */
@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; overflow-y: auto; }
  .tile { font-size: 22px; min-height: 84px; }
}
