/* Home AI 遥控器 —— 移动端优先，浅色主题 */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6e9f2;
  --text: #1b1f2a;
  --muted: #7c869c;
  --brand: #2f6bff;
  --brand-soft: #eaf0ff;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .05), 0 8px 24px rgba(20, 30, 60, .06);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #f7f9ff 0%, #eef2fb 100%);
}
.login-box {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--card); border-radius: 20px; padding: 28px 22px;
  box-shadow: var(--shadow);
}
.login-logo { font-size: 40px; }
.login-box h1 { font-size: 20px; margin: 8px 0 6px; }
.login-tip { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-tip code { background: #eef1f8; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.login-box input[type=text], .login-box input[type=password] {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; color: var(--text); outline: none;
}
.login-box input:focus { border-color: var(--brand); background: #fff; }
.remember {
  display: flex; align-items: center; gap: 7px; justify-content: center;
  font-size: 13px; color: var(--muted); margin: 4px 0 14px; cursor: pointer;
}
.remember input { width: auto; margin: 0; }
.login-err { color: var(--bad); font-size: 13px; min-height: 20px; margin: 10px 0 0; }

/* ---------------- 布局 ---------------- */
.app { padding-bottom: 28px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(244, 246, 251, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.brand-icon { font-size: 18px; }
.status {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.dot.off { background: var(--bad); }
.icon-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%; font-size: 15px; cursor: pointer;
}

.tabs { display: flex; gap: 8px; padding: 12px 14px 4px; }
.tab {
  flex: 1; padding: 10px 4px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 14px; font-weight: 500;
}
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

main { padding: 8px 14px 0; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
  box-shadow: var(--shadow);
}
.card.center { display: flex; flex-direction: column; align-items: center; }
.row-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; color: var(--muted); margin-bottom: 10px;
}
.row-label .value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* ---------------- 控件 ---------------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 15px; cursor: pointer;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.block { width: 100%; margin-top: 6px; padding: 12px; }
.btn:active { transform: scale(.98); }

.power-btn {
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 30px;
}
.power-emoji { font-size: 62px; line-height: 1; filter: grayscale(1) opacity(.35); transition: .2s; }
.power-btn.on .power-emoji { filter: none; text-shadow: 0 0 22px rgba(255, 196, 0, .55); }
.power-label { font-size: 15px; color: var(--muted); }
.power-btn.on .power-label { color: var(--text); font-weight: 600; }

.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 999px; background: linear-gradient(90deg, var(--brand-soft), var(--brand-soft));
  outline: none; margin: 6px 0 12px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand);
  box-shadow: 0 2px 6px rgba(20, 30, 60, .25); cursor: pointer;
}
.slider.warm::-webkit-slider-thumb { border-color: #f59e0b; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.chip:active { background: var(--brand-soft); }
.chip.on { background: var(--brand-soft); border-color: #c7d7ff; color: var(--brand); }

/* ---------------- 音乐 ---------------- */
.now { text-align: center; }
.now-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.now-artist { font-size: 13px; color: var(--muted); min-height: 20px; }
.progress { margin-top: 14px; }
.progress-bar { height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--brand); transition: width .8s linear; }
.progress-time {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.round {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: 18px; cursor: pointer; display: grid; place-items: center;
}
.round.big { width: 62px; height: 62px; font-size: 24px; background: var(--brand); border-color: var(--brand); color: #fff; }
.round:active { transform: scale(.95); }

.search-row { display: flex; gap: 8px; }
.search-row input[type=search], .search-row input[type=text] {
  flex: 1; min-width: 0; padding: 11px 13px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; color: var(--text);
  outline: none;
}
.search-row input:focus { border-color: var(--brand); background: #fff; }

.list { margin-top: 10px; }
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .a { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }

/* 曲库浏览：面包屑 + 可滚动列表 */
.crumb { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.crumb .path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list.scroll { max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags .chip { font-size: 13px; }

/* ---------------- 语音 ---------------- */
.chatlog { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.chatlog .q { align-self: flex-end; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 12px 12px 3px 12px; max-width: 85%; font-size: 14px; }
.chatlog .a { align-self: flex-start; background: var(--brand-soft); color: var(--text); padding: 8px 12px; border-radius: 12px 12px 12px 3px; max-width: 85%; font-size: 14px; }

/* ---------------- 日志 ---------------- */
.logs { margin: 16px 0 8px; }
.loglist { list-style: none; margin: 0; padding: 0; }
.loglist li {
  display: flex; gap: 8px; font-size: 13px; color: var(--muted);
  padding: 7px 2px; border-bottom: 1px dashed var(--line);
}
.loglist li:last-child { border-bottom: none; }
.loglist .time { flex-shrink: 0; font-variant-numeric: tabular-nums; opacity: .8; }
.loglist .msg { color: var(--text); }
.loglist li.warn .msg { color: var(--warn); }
.loglist li.error .msg { color: var(--bad); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(27, 31, 42, .93); color: #fff; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; max-width: 86vw;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(180, 25, 25, .95); }
