/* ===== NekoClass 主题变量 ===== */
:root {
  --bg1: #fff3e9;
  --bg2: #ffe0c2;
  --text: #2b2018;
  --muted: #947f6e;
  --card: rgba(255, 255, 255, 0.55);
  --glass: rgba(255, 255, 255, 0.45);
  --border: rgba(255, 122, 47, 0.22);
  --accent: #ff7a2f;
  --accent-2: #ff9a4d;
  --good: #21a866;
  --bad: #e0506a;
  --shadow: 0 8px 24px rgba(255, 122, 47, 0.14);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg1: #18120d; --bg2: #2a1c12;
    --text: #f3e9e0; --muted: #ab9a8a;
    --card: rgba(42, 30, 22, 0.55); --glass: rgba(52, 38, 28, 0.45);
    --border: rgba(255, 138, 61, 0.28);
    --accent: #ff8a3d; --accent-2: #ffae6b;
    --good: #38d08a; --bad: #ff6b85;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}
[data-theme="dark"] {
  --bg1: #18120d; --bg2: #2a1c12;
  --text: #f3e9e0; --muted: #ab9a8a;
  --card: rgba(42, 30, 22, 0.55); --glass: rgba(52, 38, 28, 0.45);
  --border: rgba(255, 138, 61, 0.28);
  --accent: #ff8a3d; --accent-2: #ffae6b;
  --good: #38d08a; --bad: #ff6b85;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
[data-theme="light"] {
  --bg1: #fff3e9; --bg2: #ffe0c2;
  --text: #2b2018; --muted: #947f6e;
  --card: rgba(255, 255, 255, 0.55); --glass: rgba(255, 255, 255, 0.45);
  --border: rgba(255, 122, 47, 0.22);
  --accent: #ff7a2f; --accent-2: #ff9a4d;
  --good: #21a866; --bad: #e0506a;
  --shadow: 0 8px 24px rgba(255, 122, 47, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
svg { display: block; }

/* ===== 顶栏 / 毛玻璃 ===== */
.glass {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-left: none; border-right: none; border-top: none;
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo { flex: none; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.brand-sub {
  font-size: 11px; color: var(--muted);
  border-left: 1px solid var(--border); padding-left: 8px; margin-left: 2px;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--glass); color: var(--text); cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(8px);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; }

/* ===== 布局 ===== */
.app { max-width: 760px; margin: 0 auto; padding: 14px; display: grid; gap: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 11px; padding: 18px 14px 26px; }

.card {
  background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card.tight { padding: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }

/* ===== 表单 / 按钮 ===== */
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--glass);
  color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--glass); color: var(--text); cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit;
  backdrop-filter: blur(8px); transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(255,122,47,.3);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 首页角色选择 ===== */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.role {
  cursor: pointer; padding: 22px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); text-align: center;
  backdrop-filter: blur(14px); transition: .15s;
}
.role:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.role svg { width: 40px; height: 40px; margin: 0 auto 8px; color: var(--accent); }
.role .t { font-weight: 800; font-size: 16px; }
.role .d { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== 学生卡片 / 排行 ===== */
.stu {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: 12px; border: 1px solid transparent;
}
.stu:hover { border-color: var(--border); background: var(--glass); }
.stu .pet { width: 44px; height: 44px; flex: none; }
.stu .nm { font-weight: 700; }
.stu .meta { font-size: 12px; color: var(--muted); }
.rank { font-size: 12px; color: var(--muted); width: 22px; text-align: center; flex: none; }
.exp-bar { height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; margin-top: 4px; }
.exp-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ===== 宠物大图 / 状态 ===== */
.pet-hero { display: grid; place-items: center; padding: 8px 0 4px; }
.pet-hero svg { width: 150px; height: 150px; }
.stat { display: grid; grid-template-columns: 48px 1fr 38px; align-items: center; gap: 8px; margin: 6px 0; }
.stat .lab { font-size: 12px; color: var(--muted); }
.stat .bar { height: 8px; border-radius: 5px; background: var(--border); overflow: hidden; }
.stat .bar > i { display: block; height: 100%; border-radius: 5px; }
.stat .val { font-size: 12px; text-align: right; color: var(--muted); }

/* ===== 领养选项 ===== */
.pet-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pet-opt {
  cursor: pointer; padding: 10px 6px; border-radius: 12px; text-align: center;
  border: 2px solid transparent; background: var(--glass);
}
.pet-opt svg { width: 56px; height: 56px; margin: 0 auto; }
.pet-opt.sel { border-color: var(--accent); background: var(--card); }
.pet-opt .nm { font-size: 12px; margin-top: 4px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg1); padding: 10px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 50;
  box-shadow: var(--shadow); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.code-box {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 22px; font-weight: 800;
  letter-spacing: 4px; color: var(--accent); text-align: center; padding: 10px;
  background: var(--glass); border-radius: 10px; border: 1px dashed var(--border);
}
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--glass); border: 1px solid var(--border); color: var(--muted); }
.pill.acc { color: var(--accent); border-color: var(--accent); }
.stage-tag { font-size: 12px; color: var(--accent); font-weight: 700; }

/* ===== 标签栏 ===== */
.tabs {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 12px; padding: 4px;
  backdrop-filter: blur(14px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 7px 2px; border-radius: 9px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 600;
  transition: .15s;
}
.tab svg { width: 18px; height: 18px; }
.tab:hover { color: var(--text); }
.tab.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 3px 10px rgba(255,122,47,.28);
}

/* ===== 商城 ===== */
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  background: var(--glass); display: flex; flex-direction: column; gap: 6px;
}
.shop-card .ic { width: 34px; height: 34px; color: var(--accent); }
.shop-card .nm { font-weight: 700; font-size: 13px; }
.shop-card .ds { font-size: 11px; color: var(--muted); line-height: 1.4; }
.shop-card .cost {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800;
  color: var(--accent);
}
.shop-card .cost svg { width: 14px; height: 14px; }
.shop-card.cant { opacity: .55; }
.coin-bar {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  font-size: 18px; font-weight: 800; color: var(--accent);
}
.coin-bar svg { width: 20px; height: 20px; }

/* ===== PK 擂台 ===== */
.arena { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.arena .side { text-align: center; }
.arena .side svg { width: 88px; height: 88px; margin: 0 auto; }
.arena .side .nm { font-weight: 800; font-size: 13px; margin-top: 2px; }
.arena .side .pw { font-size: 12px; color: var(--muted); }
.arena .side.win svg { filter: drop-shadow(0 0 10px var(--accent)); }
.arena .vs { font-size: 15px; font-weight: 900; color: var(--accent); }
.win-note { text-align: center; font-weight: 700; margin-top: 8px; }
.pk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== 报告 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-box {
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 6px; text-align: center;
  background: var(--glass);
}
.stat-box .v { font-size: 16px; font-weight: 800; color: var(--accent); }
.stat-box .l { font-size: 11px; color: var(--muted); margin-top: 1px; }
.report-text { font-size: 13px; line-height: 1.65; }
.sug { margin: 4px 0; font-size: 13px; display: flex; gap: 6px; align-items: flex-start; }
.sug svg { width: 15px; height: 15px; flex: none; margin-top: 3px; color: var(--accent); }
.tagline { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== 报文框 ===== */
.msg-box {
  white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.7;
  background: var(--glass); border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px; max-height: 260px; overflow: auto; font-family: inherit;
}
.owned-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-tag {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}
