/* 出行助手 —— 面向视障用户：高对比、大字号、大点击区 */

:root {
  --bg: #0d0f13;
  --panel: #171b22;
  --panel-2: #1f242d;
  --line: #2c333f;
  --fg: #f4f6fa;
  --fg-dim: #9aa4b4;
  --go: #16a34a;
  --careful: #eab308;
  --stop: #dc2626;
  --focus: #38bdf8;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  padding: 0 0 env(safe-area-inset-bottom);
}

/* 只给屏幕阅读器的内容 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 键盘焦点必须看得见（低视力用户可能用键盘/外接开关） */
:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

/* ---------------- 顶部 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: .02em;
}

.lang-switch { display: flex; gap: 8px; }

.lang-btn {
  background: var(--panel-2);
  color: var(--fg);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn[aria-pressed="true"] {
  background: var(--focus);
  color: #04222e;
  border-color: var(--focus);
}

/* ---------------- 布局 ---------------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------------- 安全提示 ---------------- */
.notice {
  background: #2a1d05;
  border: 2px solid #a16207;
  border-radius: var(--radius);
  padding: 14px 16px;
}

.notice[hidden] { display: none; }

.notice h2 { font-size: 19px; margin: 0 0 8px; }
.notice p { margin: 0 0 12px; font-size: 16px; color: #fde68a; }

/* ---------------- 判断结果 ---------------- */
.verdict-box {
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  font-size: clamp(34px, 11vw, 56px);
  font-weight: 800;
  letter-spacing: .04em;
  border: 3px solid var(--line);
  background: var(--panel);
  transition: background .15s, border-color .15s;
}

.verdict-idle    { color: var(--fg-dim); }
.verdict-yes     { background: #052e16; border-color: var(--go); color: #86efac; }
.verdict-careful { background: #2b2304; border-color: var(--careful); color: #fde047; }
.verdict-no      { background: #2b0707; border-color: var(--stop); color: #fca5a5; }
.verdict-unknown { background: var(--panel-2); border-color: var(--line); color: var(--fg-dim); }

.verdict-advice {
  font-size: 20px;
  margin: 12px 2px 0;
  min-height: 1.4em;
}

.meta {
  font-size: 14px;
  color: var(--fg-dim);
  margin: 6px 2px 0;
}

/* ---------------- 按钮 ---------------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  font: inherit;
  font-weight: 700;
  color: var(--fg);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-xl {
  font-size: 22px;
  padding: 22px 18px;
  min-height: 72px;
}

.btn-primary { background: #0b4f9e; border-color: #1d6fd1; }

.btn-guard[aria-pressed="true"] {
  background: var(--go);
  border-color: #4ade80;
  color: #04240f;
}

.btn-talk {
  background: #4c1d95;
  border-color: #7c3aed;
  min-height: 96px;
}

.btn-talk.recording {
  background: var(--stop);
  border-color: #f87171;
  color: #fff;
}

.row { display: flex; gap: 10px; align-items: stretch; }
.row > * { flex: 1; }

.select-wrap { display: flex; }

select, input[type="text"] {
  font: inherit;
  width: 100%;
  color: var(--fg);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.ghost {
  font: inherit;
  background: transparent;
  color: #fde68a;
  border: 2px solid #a16207;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

.fallback summary {
  cursor: pointer;
  padding: 10px 4px;
  color: var(--fg-dim);
  font-size: 16px;
}

/* ---------------- 预览 ---------------- */
.preview { display: flex; flex-direction: column; gap: 6px; }

#video {
  width: 100%;
  max-height: 42vh;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  object-fit: cover;
}

.preview-meta { font-size: 14px; color: var(--fg-dim); }

/* ---------------- 记录 ---------------- */
.log h2 { font-size: 16px; color: var(--fg-dim); font-weight: 600; margin: 0 0 6px; }

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.log-list li {
  font-size: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 8px 10px;
  word-break: break-word;
}

.log-yes     { border-left-color: var(--go); }
.log-careful { border-left-color: var(--careful); }
.log-no      { border-left-color: var(--stop); }
.log-info    { border-left-color: var(--focus); }
.log-err     { border-left-color: #f97316; color: #fdba74; }

.log-list .t { color: var(--fg-dim); font-size: 13px; margin-right: 6px; }

/* ---------------- 调试 ---------------- */
.debug summary { cursor: pointer; color: var(--fg-dim); font-size: 15px; }

#debug-out {
  background: #05070a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
}

.foot {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  color: var(--fg-dim);
  font-size: 14px;
}

.foot code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }

/* 尊重「减弱动画」偏好 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
