:root {
  --bg: #0f0f12;
  --panel: #17171b;
  --panel2: #1e1e23;
  --text: #e9e7e4;
  --dim: #85848b;
  --line: #26262c;
  --accent: #7fd8c9;
  --warm: #e0a35c;
}

* { 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, "PingFang SC",
               "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  font-size: 16px;
  letter-spacing: 0.02em;
  overscroll-behavior: none;
}

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

/* ---------------------------------------------------------- header */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
  padding-top: calc(14px + env(safe-area-inset-top));
}
.who { font-size: 17px; letter-spacing: 0.16em; }
.lvl { font-size: 13px; color: var(--dim); display: flex; gap: 10px; align-items: center; }
.offline { color: var(--warm); border: 1px solid var(--warm); border-radius: 4px;
           padding: 1px 5px; font-size: 11px; letter-spacing: 0.1em; }

/* ------------------------------------------------------------ main */
main { flex: 1; overflow: hidden; position: relative; }
.tab { display: none; height: 100%; overflow-y: auto; padding: 18px; }
.tab.active { display: block; }
#tab-chat.active { display: flex; flex-direction: column; padding-bottom: 0; }

/* ----------------------------------------------------------- today */
.day { color: var(--dim); font-size: 13px; letter-spacing: 0.08em; margin-bottom: 22px; }

.block { margin-bottom: 28px; }
.block-h {
  font-size: 12px; color: var(--dim); letter-spacing: 0.16em;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.hint { color: #55545c; letter-spacing: 0; }
.link {
  background: none; border: none; color: var(--dim); font-size: 12px;
  padding: 0; margin-left: auto; font-family: inherit; cursor: pointer;
}

.mood { display: flex; gap: 10px; }
.dot {
  flex: 1; height: 34px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--dim); cursor: pointer;
}
.dot.on { border-color: var(--accent); color: var(--accent); background: #14201f; }

.task {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 15px; margin-bottom: 9px; cursor: pointer;
}
.task .box {
  width: 17px; height: 17px; border: 1px solid #3a3a42; border-radius: 4px;
  flex: 0 0 auto; margin-top: 2px;
}
.task.done { opacity: 0.42; }
.task.done .box { background: var(--accent); border-color: var(--accent); }
.task.done .txt { text-decoration: line-through; }
.task .txt { line-height: 1.6; font-size: 15px; }

.add { display: flex; gap: 8px; margin-top: 10px; }
.add input {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; color: var(--text);
  font-size: 15px; font-family: inherit; outline: none;
}
.add input:focus { border-color: #3d3d47; }
.add button {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 0 18px; font-size: 15px; font-family: inherit;
  cursor: pointer;
}

.prog-name { font-size: 15px; margin-bottom: 10px; }
.bar { height: 5px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0; background: var(--accent);
  transition: width 0.45s cubic-bezier(.2,.8,.2,1);
}
.prog-meta { margin-top: 9px; font-size: 13px; color: var(--dim); }

/* ------------------------------------------------------------ chat */
.modes { display: flex; gap: 8px; margin-bottom: 16px; }
.mode {
  background: none; border: 1px solid var(--line); color: var(--dim);
  border-radius: 20px; padding: 6px 16px; font-size: 13px;
  font-family: inherit; cursor: pointer; letter-spacing: 0.08em;
}
.mode.active { color: var(--accent); border-color: var(--accent); }

.log { flex: 1; overflow-y: auto; padding-bottom: 14px; }

/* 她的发言：不加气泡，保住文字本身的质感 */
.m-her {
  font-size: 16px; line-height: 1.85; letter-spacing: 0.03em;
  white-space: pre-wrap; word-break: break-word;
  padding: 2px 0 2px 14px; border-left: 2px solid #2c2c33;
  margin: 0 0 22px; color: var(--text);
}
.m-me {
  margin: 0 0 22px auto; max-width: 82%; width: fit-content;
  background: var(--panel); border-radius: 12px; padding: 10px 14px;
  font-size: 15px; line-height: 1.65; white-space: pre-wrap;
  word-break: break-word; color: #cfcdc9;
}
.m-sys { color: var(--warm); font-size: 13px; margin-bottom: 20px; }
.typing { color: var(--dim); font-size: 15px; padding-left: 14px; margin-bottom: 22px; }

.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 12px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px; color: var(--text);
  font-size: 15px; font-family: inherit; line-height: 1.5;
  resize: none; max-height: 120px; outline: none;
}
.composer textarea:focus { border-color: #3d3d47; }
.composer button {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 11px 18px; font-size: 15px;
  font-family: inherit; cursor: pointer;
}

/* --------------------------------------------------------- achieve */
.lvline { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
#lv-big { font-size: 34px; letter-spacing: 0.04em; }

.ach-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ach {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 14px;
}
.ach .t { font-size: 14px; margin-bottom: 4px; }
.ach .d { font-size: 12px; color: var(--dim); line-height: 1.5; }
.ach.locked { opacity: 0.35; }
.ach.locked .t::before { content: "· "; }
.ach.got { border-color: #3a4a48; }
.ach.got .t { color: var(--accent); }

.stat-line {
  display: flex; justify-content: space-between; font-size: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--dim);
}
.stat-line span:last-child { color: var(--text); }
.dim { color: var(--dim); font-size: 13px; }

/* ------------------------------------------------------------- nav */
nav {
  display: flex; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav {
  flex: 1; background: none; border: none; color: var(--dim);
  padding: 15px 0 16px; font-size: 14px; font-family: inherit;
  letter-spacing: 0.12em; cursor: pointer;
}
.nav.active { color: var(--text); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + env(safe-area-inset-bottom));
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 20; white-space: nowrap;
}

.install {
  font-size: 13px; color: var(--dim); line-height: 1.8;
  border-top: 1px solid var(--line); padding-top: 18px; margin-top: 34px;
}
.install b { color: var(--text); font-weight: normal; }

/* ------------------------------------------------------------ 设置 */

.where {
  color: #55545c; font-size: 11px; letter-spacing: 0.1em;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

.gear {
  background: none; border: none; color: var(--dim); font-size: 20px;
  line-height: 1; padding: 0 2px; font-family: inherit; cursor: pointer;
}

.sheet {
  position: fixed; inset: 0; background: rgba(8, 8, 10, 0.94);
  z-index: 50; overflow-y: auto; padding: 24px 20px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.sheet-in { max-width: 460px; margin: 0 auto; }
.sheet-h { font-size: 17px; letter-spacing: 0.14em; margin-bottom: 22px; }
.sheet-h2 { font-size: 13px; color: var(--dim); letter-spacing: 0.14em; margin-bottom: 8px; }
.sheet-note { font-size: 13px; color: var(--dim); line-height: 1.7; margin-bottom: 14px; }
.sheet-sep { height: 1px; background: var(--line); margin: 26px 0 22px; }

.sheet label {
  display: block; font-size: 12px; color: var(--dim);
  letter-spacing: 0.1em; margin: 16px 0 7px;
}
.sheet input[type=text], .sheet input[type=password], .sheet input[type=number] {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; color: var(--text);
  font-size: 15px; font-family: inherit; outline: none;
}
.sheet input:focus { border-color: #3d3d47; }

.cfg-status {
  font-size: 13px; line-height: 1.7; margin-top: 16px;
  color: var(--warm); white-space: pre-wrap; word-break: break-all;
}

.sheet-row { display: flex; gap: 10px; margin-top: 16px; }
.sheet-row button, .sheet-row .file {
  flex: 1; text-align: center; border-radius: 10px; padding: 13px 0;
  font-size: 15px; font-family: inherit; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
}
.sheet-row .primary { background: #1f2b29; border-color: #35514c; color: var(--accent); }
.sheet-row .ghost { background: none; color: var(--dim); }
.sheet-row .wide { flex: 1; margin-top: 10px; }
.sheet-row .file { display: flex; align-items: center; justify-content: center; }

.sheet textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; color: var(--text);
  font-size: 13px; line-height: 1.7; font-family: ui-monospace, Menlo,
  Consolas, "Microsoft YaHei", monospace; outline: none; resize: vertical;
}
.sheet textarea:focus { border-color: #3d3d47; }

.cfg-content-state {
  font-size: 13px; line-height: 1.7; color: var(--dim); margin-bottom: 4px;
}
.cfg-content-state.ok { color: var(--accent); }
