/* Pupupula 小房子闹钟 · 用户端 Web 配置页
   设计基调：暖阳治愈手绘风（奶油白底 / 暖橘主色 / 木棕点缀 / 大圆角 / 圆润字体） */

:root {
  --cream: #FBF7F0;      /* 底 */
  --cream-2: #F3ECE0;    /* 次底/分隔 */
  --card: #FFFFFF;
  --orange: #E8955A;     /* 主色 */
  --orange-d: #D97F42;
  --wood: #8A6D52;       /* 木棕点缀/次要文字 */
  --ink: #4A3F35;        /* 主文字（暖棕黑）*/
  --ink-soft: #8C7E70;
  --line: #EBE2D4;
  --ok: #6FA86B;
  --warn: #E7A400;
  --danger: #D9695A;
  --shadow: 0 6px 20px rgba(138,109,82,0.10);
  --radius: 22px;
  --radius-sm: 14px;
  font-family: "Nunito", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--cream); color: var(--ink); }
body { min-height: 100dvh; }

.app { max-width: 480px; margin: 0 auto; padding: 0 18px 96px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(251,247,240,0.9); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); }
.brand .logo { width: 30px; height: 30px; }
.status-pill { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #CBB; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(111,168,107,.18); }

/* 卡片 / 分区 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.section-title { font-size: 13px; font-weight: 800; color: var(--wood); letter-spacing: .04em; margin: 22px 4px 10px; display: flex; align-items: center; gap: 6px; }
.hint { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }

/* 按钮 */
.btn { border: none; border-radius: 999px; font-weight: 800; font-family: inherit; cursor: pointer; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--orange); color: #fff; padding: 14px 22px; font-size: 15px; box-shadow: 0 8px 18px rgba(232,149,90,.35); }
.btn-primary:hover { filter: brightness(1.03); }
.btn-primary:disabled { background: #E7DAC8; color: #B7A48C; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--cream-2); color: var(--wood); padding: 10px 16px; font-size: 13px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* 环境看板 */
.env-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.env-item { text-align: center; }
.env-val { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.env-val small { font-size: 15px; color: var(--ink-soft); font-weight: 700; }
.env-label { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* 开关 toggle */
.toggle { width: 46px; height: 27px; border-radius: 999px; background: #E3D8C8; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.toggle.on { background: var(--orange); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on::after { transform: translateX(19px); }

/* 段选（12/24H、℃℉、延时预设）*/
.seg { display: inline-flex; background: var(--cream-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; font-family: inherit; }
.seg button.active { background: #fff; color: var(--orange-d); box-shadow: 0 2px 6px rgba(138,109,82,.15); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: none; }
.row .label { font-size: 14px; font-weight: 700; color: var(--ink); }
.row .sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* 闹钟卡 */
.alarm { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; background: #fff; }
.alarm .time { font-size: 26px; font-weight: 800; color: var(--ink); }
.alarm.off .time, .alarm.off .meta { opacity: .4; }
.alarm .meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.alarm .theme-ico { font-size: 22px; }
.alarm .grow { flex: 1; }

/* 星期多选 */
.week { display: flex; gap: 6px; flex-wrap: wrap; }
.week button { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--cream-2); color: var(--ink-soft); font-weight: 800; font-size: 13px; cursor: pointer; font-family: inherit; }
.week button.on { background: var(--orange); color: #fff; }

/* 主题网格 */
.themes { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.themes button { border: 2px solid var(--line); background: #fff; border-radius: var(--radius-sm); padding: 10px 4px; font-size: 24px; cursor: pointer; }
.themes button.on { border-color: var(--orange); background: #FFF6EE; }
.themes button .name { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 4px; }

/* 时间输入 */
.timepick { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 40px; font-weight: 800; color: var(--ink); }
.timepick input { width: 84px; text-align: center; font-size: 40px; font-weight: 800; border: none; background: var(--cream-2); border-radius: var(--radius-sm); padding: 6px 0; color: var(--ink); font-family: inherit; }

/* 输入 / 滑块 */
input[type="range"] { width: 100%; accent-color: var(--orange); }
.select { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 13px; font-family: inherit; background: #fff; color: var(--ink); }
.field { display: flex; gap: 6px; align-items: center; }
.field input[type="number"] { width: 54px; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px; font-family: inherit; font-size: 14px; }

/* 警告横幅 */
.banner { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; line-height: 1.5; margin-top: 10px; display: flex; gap: 8px; }
.banner.warn { background: #FFF6E0; color: #8a6d1a; border: 1px solid #F0DFA8; }

/* 空状态 */
.empty { text-align: center; padding: 26px 10px; color: var(--ink-soft); }
.empty .ill { font-size: 46px; }
.empty p { margin-top: 8px; font-size: 13px; line-height: 1.6; }

/* 设备管理（隐藏区）*/
.device-admin { margin-top: 26px; }
.device-admin summary { cursor: pointer; color: var(--ink-soft); font-size: 12px; list-style: none; padding: 6px 4px; }
.device-admin summary::-webkit-details-marker { display: none; }
.admin-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.admin-item.danger .label { color: var(--danger); }

/* 全屏页（连接页 / iOS 拦截）*/
.fullscreen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; gap: 18px; }
.fullscreen .hero-ill { font-size: 72px; }
.fullscreen h1 { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.3; }
.fullscreen .lead { color: var(--ink-soft); font-size: 15px; line-height: 1.6; max-width: 320px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--wood); }

/* Toast */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); animation: pop .2s; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(74,63,53,.4); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 24px; }
.modal { background: #fff; border-radius: var(--radius); padding: 22px; max-width: 340px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { font-size: 17px; margin-bottom: 8px; }
.modal p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; }
.hidden { display: none !important; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
