/* ============================================================
   快乐校园 · style.css 最终完整版
   ============================================================ */

/* ========== 1. 全局与基础 ========== */
:root {
  --cream: #fffaf2;
  --orange: #ffa94d;
  --orange-dark: #f08c00;
  --ink: #5b4a3f;
  --ink-soft: #8a7767;
  --shadow: 0 6px 18px rgba(180, 140, 100, .18);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fff6e8 0%, #eaf6ff 100%);
  min-height: 100vh;
}
a { color: inherit; }

/* ========== 2. 登录与表单 UI ========== */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  padding: 30px 16px;
  background:
    radial-gradient(circle at 20% 10%, #ffe9c9 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, #d9f2ff 0%, transparent 45%),
    #fff8ee;
}
.auth-wrap { width: 100%; max-width: 420px; text-align: center; }
.auth-wrap.wide { max-width: 520px; }
.logo { font-size: 30px; margin: 0 0 6px; letter-spacing: 2px; }
.sub { color: var(--ink-soft); margin: 0 0 20px; font-size: 14px; }
.tabs { display: flex; gap: 8px; background: #fff1de; padding: 6px; border-radius: 999px; margin-bottom: 16px; }
.tab { flex: 1; padding: 10px 0; border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--ink-soft); }
.tab.on { background: #fff; color: var(--orange-dark); box-shadow: 0 3px 8px rgba(200, 160, 120, .2); }
.card {
  background: #fff; border-radius: 22px; padding: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; text-align: left;
}
.card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=number], input:not([type]) {
  width: 100%; padding: 11px 14px; border-radius: 14px;
  border: 2px solid #ffe3c2; background: #fffdf9;
  font-size: 15px; font-family: inherit; color: var(--ink);
  outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--orange); }
.btn {
  display: inline-block; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 14px;
  background: #fff; color: var(--ink);
  box-shadow: 0 4px 0 #f0d9c0;
  transition: transform .12s, box-shadow .12s;
  text-decoration: none; text-align: center;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #f0d9c0; }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 #f0d9c0; }
.btn.primary { background: linear-gradient(180deg, #ffb85c, #ff9a3c); color: #fff; box-shadow: 0 4px 0 #e07f22; }
.btn.primary:hover { box-shadow: 0 6px 0 #e07f22; }
.btn.primary:active { box-shadow: 0 2px 0 #e07f22; }
.btn.tiny { font-size: 13px; padding: 8px 14px; box-shadow: 0 3px 0 #f0d9c0; }

.role-pick { display: flex; gap: 10px; }
.role-chip {
  flex: 1; flex-direction: row !important;
  align-items: center; justify-content: center; gap: 6px !important;
  padding: 12px 8px; border-radius: 14px;
  background: #fff8ee; border: 2px solid #ffe3c2;
  cursor: pointer; font-size: 13px !important;
}
.alert { background: #ffe3e3; color: #c92a2a; padding: 12px 16px; border-radius: 14px; font-size: 14px; margin-bottom: 12px; font-weight: 600; }
.notice { background: #d3f9d8; color: #2b8a3e; padding: 12px 16px; border-radius: 14px; font-size: 14px; margin-bottom: 12px; font-weight: 600; }

/* 创建角色页 */
.attr-list { display: flex; flex-direction: column; gap: 10px; }
.attr-row { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 12px !important; }
.attr-row span { font-size: 15px; color: var(--ink); }
.attr-row input { width: 90px !important; text-align: center; }
.remain { text-align: center; font-weight: 700; margin: 0; }
.gender-pick { display: flex; gap: 12px; justify-content: center; }
.gender-chip {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px 12px; border-radius: 18px;
  background: #fff8ee; border: 2px solid #ffe3c2;
  cursor: pointer; transition: .15s;
}
.gender-chip input { display: none; }
.gender-chip.active { border-color: #ff922b; background: #fff0db; box-shadow: 0 0 0 4px #ffe8cc; }
.gender-preview { position: relative; width: 70px; height: 92px; display: block; }
.gender-preview .player { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -100%) scale(.95); }
.gender-label { font-size: 14px; font-weight: 700; color: var(--ink); }

/* ========== 3. HUD 顶栏 ========== */
.hud {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid #ffe3c2;
  box-shadow: 0 4px 14px rgba(200, 160, 120, .12);
}
.hud-user {
  display: flex; align-items: center; gap: 8px; font-weight: 700;
  cursor: pointer; padding: 6px 12px; border-radius: 12px;
  transition: background .15s; white-space: nowrap;
  margin-right: 10px;
}
.hud-user:hover { background: #fff1de; }
.hud-center {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  flex: 1; 
}
.hud-group { display: flex; gap: 6px; flex-wrap: wrap; }
.hud-right { display: flex; align-items: center; white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff6e9; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); white-space: nowrap;
}
.pill b { color: var(--ink); font-size: 14px; }
.pill.warn { background: #fff0f0; }
.pill.good { background: #eefaf0; }
.pill.money { background: #fff8e1; }
.pill.score { background: #f3f0ff; }
.pill.clickable {
  cursor: pointer;
  transition: transform .12s, background .15s;
}
.pill.clickable:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}
.pill.clickable:active {
  transform: translateY(1px);
}

/* ========== 4. 场景容器与背景 ========== */
.scene-wrap {
  width: 100%; max-width: 960px;
  margin: 18px auto 0;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(180, 140, 100, .25);
}
.scene {
  position: absolute; top: 0; left: 0;
  width: 960px; height: 600px;
  transform-origin: top left;
  overflow: hidden;
  background: #f6fff6;
  border-radius: 8px;
}
.scene-bg { position: absolute; inset: 0; }
.bg-grass  { background: linear-gradient(180deg, #d3f9d8, #b2f2bb); }
.bg-town   { background: #a9a196; }
.bg-wood   { background: repeating-linear-gradient(90deg, #e6ccb2 0 60px, #d4a373 60px 62px), #e6ccb2; }
.bg-tile   { background: repeating-linear-gradient(0deg, #f1f3f5 0 40px, #dee2e6 40px 42px), repeating-linear-gradient(90deg, #f1f3f5 0 40px, #dee2e6 40px 42px); }
.bg-carpet { background: repeating-linear-gradient(45deg, #5f3dc4 0 20px, #4c2a99 20px 40px); }

/* ========== 5. 公园、街区与道路 ========== */
.block {
  position: absolute;
  background: #e3fafc;
  border-radius: 8px;
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), inset 0 0 0 1.5px rgba(255, 255, 255, 0.7);
}
.park {
  position: absolute;
  background: linear-gradient(180deg, #d8f5df 0%, #b2f2bb 100%);
  border-radius: 22px;
  box-shadow: inset 0 0 0 3px #a9e6b3, 0 4px 10px rgba(100, 160, 100, .15);
  pointer-events: none;
  z-index: 2;
}
.park::before {
  content: ""; position: absolute; inset: 0; border-radius: 22px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.45) 0 6px, transparent 7px),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,.4)  0 5px, transparent 6px),
    radial-gradient(circle at 50% 85%, rgba(255,255,255,.35) 0 4px, transparent 5px);
  pointer-events: none;
}
.road {
  position: absolute;
  background: transparent; 
  box-shadow: none;
}
.road-h::before, .road-v::before {
  content: ""; position: absolute;
  background: repeating-linear-gradient(90deg, #fff 0 24px, transparent 24px 48px);
  border-radius: 3px; opacity: .8;
}
.road-h::before {
  left: 14px; right: 14px; top: 50%; height: 2.5px; transform: translateY(-50%);
}
.road-v::before {
  top: 14px; bottom: 14px; left: 50%; width: 2.5px; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, #fff 0 24px, transparent 24px 48px);
}

/* ========== 6. 装饰与建筑 ========== */
.deco { 
  position: absolute; 
  font-size: 28px; 
  line-height: 1; 
  pointer-events: none; 
  user-select: none; 
  z-index: 3; 
}
.deco-tree { font-size: 36px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .2)); }
.deco-flower { font-size: 22px; }
.deco-bench { font-size: 26px; }
.deco-fountain { font-size: 44px; filter: drop-shadow(0 4px 6px rgba(0, 80, 160, .3)); }

.deco-slogan {
  font-size: 32px; 
  font-weight: 900;
  color: #c92a2a; 
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  letter-spacing: 6px; 
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  z-index: 3;
}
.deco-blackboard-text {
  font-size: 18px;
  color: rgba(255,255,255,0.85);
  font-family: "KaiTi", "STKaiti", serif;
  letter-spacing: 2px;
  width: 480px; 
  text-align: center;
  pointer-events: none;
  z-index: 3;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.item {
  position: absolute;
  display: flex; 
  align-items: center; 
  justify-content: center;
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08), 0 8px 18px rgba(120, 90, 60, .15);
  transition: transform .15s, box-shadow .15s;
  cursor: default; user-select: none;
  overflow: hidden;
  z-index: 4;
}
.item.interactive { cursor: pointer; }
.item:hover { transform: translateY(-2px); }
.item.near {
  transform: translateY(-4px);
  box-shadow: 0 0 0 4px #ffd43b, 0 10px 0 rgba(0, 0, 0, .08), 0 12px 26px rgba(120, 90, 60, .25);
  z-index: 15;
}

.item[data-id="blackboard"] {
  border: 6px solid #8b5a2b;
  box-shadow: inset 0 0 15px rgba(255,255,255,0.1), 0 6px 0 rgba(0,0,0,0.1);
}
.item[data-id^="desk_"] {
  border-radius: 6px;
  border-bottom: 6px solid #d4a373; 
  box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

/* 窗户框 */
.win-frame {
  width: 100%; 
  height: 100%;
  background: linear-gradient(180deg, #e3fafc, #d0ebff);
  border: 6px solid #b2f2bb;
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(255,255,255,0.8), 0 4px 10px rgba(0,0,0,0.1);
  position: relative;
}
.win-frame::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 6px; background: #b2f2bb; transform: translateY(-50%);
}
.win-frame::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; background: #b2f2bb; transform: translateX(-50%);
}

.item-icon { 
  font-size: 84px; 
  line-height: 1; 
  margin: 0;
  transition: transform .15s;
}
.item:hover .item-icon,
.item.near .item-icon {
  transform: scale(1.05);
}

.item-label { 
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  font-size: 14px; 
  font-weight: 800; 
  color: #5b4a3f; 
  padding: 4px 12px; 
  background: rgba(255, 255, 255, 0.75); 
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
  opacity: 0;
  visibility: hidden;
  transition: all .2s ease-out;
}
.item-label small {
  font-size: 11px;
  color: #8a7767;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.item:hover .item-label,
.item.near .item-label {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.item-hint {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  background: #4a3f35; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.item.near .item-hint { opacity: 1; }

.npc { 
  position: absolute; 
  font-size: 30px; 
  transform: translate(-50%, -100%); 
  pointer-events: none; 
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .2)); 
  z-index: 5;
  display: flex; flex-direction: column; align-items: center;
}
/* ========== NPC 名字显示在下方 ========== */
.npc-name {
  margin-top: 4px; /* 放到下面，原来是 margin-bottom: 2px */
  margin-bottom: 0;
  font-size: 12px; 
  font-weight: 800; 
  color: #5b4a3f;
  background: rgba(255,255,255,0.9);
  padding: 2px 8px; 
  border-radius: 8px; 
  pointer-events: none; 
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  opacity: 0;
  transition: opacity 0.2s;
}

.npc.near .npc-name,
.npc:hover .npc-name {
  opacity: 1;
}

.exit {
  position: absolute; border-radius: 14px;
  background: repeating-linear-gradient(45deg, #ffe066, #ffe066 10px, #ffd43b 10px, #ffd43b 20px);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #5b4a3f; font-size: 14px;
  box-shadow: inset 0 0 0 3px #fff, 0 4px 0 rgba(0, 0, 0, .08);
  animation: exitPulse 1.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 5;
}
@keyframes exitPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

/* ============================================================
   7. 角色基础结构
   ============================================================ */
.player {
  position: absolute;
  width: 44px; height: 64px;
  transform: translate(-50%, -100%);
  z-index: 20;
  pointer-events: none;
  --skin: #ffd9b3;
  --hair: #6b4423;
  --shirt: #4dabf7;
  --pants: #343a40;
  --shoe: #212529;
}
.player.girl {
  --skin: #ffe0c2;
  --hair: #5a3218;
  --shirt: #ff8fab;
  --pants: #845ef7;
  --shoe: #5f3dc4;
}

.p-name {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
  color: #5b4a3f;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  pointer-events: none;
  z-index: 10;
  border: 1px solid #ffe3c2;
}

.p-shadow {
  position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  width: 34px; height: 9px; background: rgba(0, 0, 0, .16);
  border-radius: 50%; filter: blur(2px);
}
.p-inner {
  position: absolute; inset: 0;
  transform-origin: 50% 100%;
  transition: transform .12s;
}
.p-hair {
  position: absolute; left: 4px; top: -2px; width: 36px; height: 18px;
  background: var(--hair); border-radius: 18px 18px 8px 8px; z-index: 3;
}
.player.girl .p-hair {
  left: 2px; top: -4px; width: 40px; height: 22px; border-radius: 20px 20px 10px 10px;
}
.player.girl .p-hair::before, .player.girl .p-hair::after {
  content: ""; position: absolute; top: 14px; width: 9px; height: 28px;
  background: var(--hair); border-radius: 5px;
}
.player.girl .p-hair::before { left: 0; }
.player.girl .p-hair::after  { right: 0; }
.p-head {
  position: absolute; left: 7px; top: 0; width: 30px; height: 30px;
  background: var(--skin); border-radius: 50%; z-index: 2;
  box-shadow: inset -2px -3px 0 rgba(0, 0, 0, .05);
}
.p-eye { position: absolute; top: 13px; width: 4px; height: 6px; background: #2b2b2b; border-radius: 50%; transition: opacity .12s; }
.p-eye.left { left: 8px; } .p-eye.right { right: 8px; }
.p-cheek { position: absolute; top: 19px; width: 6px; height: 4px; background: #ffb3c1; border-radius: 50%; opacity: .8; transition: opacity .12s; }
.p-cheek.left { left: 3px; } .p-cheek.right { right: 3px; }
.p-mouth {
  position: absolute; left: 50%; top: 21px; transform: translateX(-50%);
  width: 9px; height: 4px; border-bottom: 2px solid #c2410c;
  border-radius: 0 0 9px 9px; transition: opacity .12s, transform .12s;
}
.p-backhead {
  position: absolute; inset: 0; background: var(--hair); border-radius: 50%;
  opacity: 0; z-index: 4; transition: opacity .12s;
}
.p-backhead::after {
  content: ""; position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%);
  width: 14px; height: 7px; background: rgba(255, 255, 255, .18); border-radius: 50%;
}
.p-ear {
  position: absolute; top: 16px; width: 6px; height: 8px;
  background: var(--skin); border-radius: 50%; opacity: 0; z-index: 1; transition: opacity .12s;
}
.p-ear.left { left: -2px; } .p-ear.right { right: -2px; }

.p-body {
  position: absolute; left: 50%; top: 28px; transform: translateX(-50%);
  width: 26px; height: 20px; background: var(--shirt);
  border-radius: 9px 9px 6px 6px; z-index: 2;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .06);
  transition: width .12s, left .12s;
}
.p-arm {
  position: absolute; top: 2px; width: 6px; height: 16px;
  background: var(--shirt); border-radius: 4px;
  transform-origin: top center; transition: transform .12s ease-out;
  z-index: 3;
}
.p-arm.left { left: -4px; } .p-arm.right { right: -4px; }

.p-leg {
  position: absolute; top: 44px; width: 9px; height: 12px;
  background: var(--pants); border-radius: 4px 4px 0 0;
  transform-origin: top center;
  transition: transform .12s ease-out;
  z-index: 1;
}
.p-leg.left { left: 11px; } .p-leg.right { right: 11px; }
.p-shin {
  position: absolute; top: 100%; left: 0; width: 100%; height: 9px;
  background: var(--pants); border-radius: 0 0 4px 4px;
  transform-origin: top center;
  transition: transform .12s ease-out;
}
.p-shin::after {
  content: ""; position: absolute; left: -2px; bottom: -3px;
  width: 13px; height: 6px; background: var(--shoe); border-radius: 4px 4px 5px 5px;
}

/* ============================================================
   8. 角色朝向与侧面优化
   ============================================================ */
.player.face-down  .p-inner { transform: scaleX(1); }
.player.face-up    .p-inner { transform: scaleX(1); }
.player.face-right .p-inner { transform: scaleX(1); }
.player.face-left  .p-inner { transform: scaleX(-1); }

.player.face-up .p-eye, .player.face-up .p-cheek, .player.face-up .p-mouth { opacity: 0; }
.player.face-up .p-backhead { opacity: 1; }
.player.face-up .p-hair {
  top: -3px; height: 30px; border-radius: 50% 50% 44% 44%; z-index: 5;
}

.player.face-left .p-eye.left, .player.face-right .p-eye.left { opacity: 0; }
.player.face-left .p-cheek.left, .player.face-right .p-cheek.left { opacity: 0; }
.player.face-left .p-mouth, .player.face-right .p-mouth { transform: translateX(-50%) translateX(6px); }
.player.face-left .p-ear, .player.face-right .p-ear { opacity: 0 !important; display: none; }

.player.girl.face-left .p-hair::before, .player.girl.face-right .p-hair::before {
  top: 12px; left: -5px; width: 11px; height: 34px;
  border-radius: 5px 5px 10px 10px; transform: rotate(-12deg);
  transform-origin: top center; box-shadow: inset -2px 0 0 rgba(0, 0, 0, .10);
}
.player.girl.face-left .p-hair::after, .player.girl.face-right .p-hair::after {
  top: 4px; right: 0; width: 7px; height: 20px;
  border-radius: 10px 4px 8px 6px; transform: rotate(14deg);
  transform-origin: top center; opacity: .95; box-shadow: inset -1px 0 0 rgba(0, 0, 0, .06);
}

.player.face-left .p-body,
.player.face-right .p-body {
  width: 16px; left: 50%; transform: translateX(-50%); z-index: 2;
}
.player.face-left .p-arm.right,
.player.face-right .p-arm.right {
  z-index: 4; left: calc(50% - 2px); right: auto; filter: brightness(1.05); 
}
.player.face-left:not(.walking) .p-arm.right,
.player.face-right:not(.walking) .p-arm.right {
  transform: rotate(8deg);
}
.player.face-left .p-arm.left,
.player.face-right .p-arm.left {
  z-index: 1; left: calc(50% - 3px); right: auto; filter: brightness(0.8); 
}
.player.face-left:not(.walking) .p-arm.left,
.player.face-right:not(.walking) .p-arm.left {
  opacity: 0;
}
.player.face-left .p-leg.left,
.player.face-right .p-leg.left {
  left: calc(50% - 5px); right: auto; z-index: 1;
}
.player.face-left .p-leg.right,
.player.face-right .p-leg.right {
  left: calc(50% - 4px); right: auto; z-index: 0;
}

/* ============================================================
   9. 步态动画
   ============================================================ */
@keyframes walkFrontLegL {
  0%   { transform: translateY(-3px); }
  50%  { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}
@keyframes walkFrontShinL {
  0%   { transform: rotate(25deg); }
  50%  { transform: rotate(0deg); }
  100% { transform: rotate(25deg); }
}
@keyframes walkFrontLegR {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
@keyframes walkFrontShinR {
  0%   { transform: rotate(0deg); }
  50%  { transform: rotate(25deg); }
  100% { transform: rotate(0deg); }
}
@keyframes walkSideLegL {
  0%   { transform: rotate(20deg); }
  50%  { transform: rotate(-20deg); }
  100% { transform: rotate(20deg); }
}
@keyframes walkSideShinL {
  0%   { transform: rotate(-5deg); }
  50%  { transform: rotate(30deg); }
  100% { transform: rotate(-5deg); }
}
@keyframes walkSideLegR {
  0%   { transform: rotate(-20deg); }
  50%  { transform: rotate(20deg); }
  100% { transform: rotate(-20deg); }
}
@keyframes walkSideShinR {
  0%   { transform: rotate(30deg); }
  50%  { transform: rotate(-5deg); }
  100% { transform: rotate(30deg); }
}
@keyframes walkArmFront {
  0%, 100% { transform: rotate(8deg); }
  50%      { transform: rotate(-8deg); }
}
@keyframes walkArmSide {
  0%, 100% { transform: rotate(-45deg); }
  50%      { transform: rotate(45deg); }
}
@keyframes walkArmSideBack {
  0%, 100% { transform: rotate(45deg); }
  50%      { transform: rotate(-45deg); }
}
@keyframes walkBodyBob {
  0%, 50%, 100% { translate: 0 0; }
  25%, 75%      { translate: 0 -2px; }
}

.player.walking:not(.face-left):not(.face-right) .p-leg.left  { animation: walkFrontLegL .6s ease-in-out infinite; }
.player.walking:not(.face-left):not(.face-right) .p-shin.left { animation: walkFrontShinL .6s ease-in-out infinite; }
.player.walking:not(.face-left):not(.face-right) .p-leg.right { animation: walkFrontLegR .6s ease-in-out infinite; }
.player.walking:not(.face-left):not(.face-right) .p-shin.right{ animation: walkFrontShinR .6s ease-in-out infinite; }

.player.walking.face-left .p-leg.right,
.player.walking.face-right .p-leg.right  { animation: walkSideLegL .6s ease-in-out infinite; }
.player.walking.face-left .p-shin.right,
.player.walking.face-right .p-shin.right { animation: walkSideShinL .6s ease-in-out infinite; }
.player.walking.face-left .p-leg.left,
.player.walking.face-right .p-leg.left   { animation: walkSideLegR .6s ease-in-out infinite; }
.player.walking.face-left .p-shin.left,
.player.walking.face-right .p-shin.left  { animation: walkSideShinR .6s ease-in-out infinite; }

.player.walking:not(.face-left):not(.face-right) .p-arm.left  { animation: walkArmFront .6s ease-in-out infinite alternate; }
.player.walking:not(.face-left):not(.face-right) .p-arm.right { animation: walkArmFront .6s ease-in-out infinite alternate-reverse; }
.player.walking.face-left .p-arm.right, 
.player.walking.face-right .p-arm.right  { animation: walkArmSide .6s ease-in-out infinite alternate; }
.player.walking.face-left .p-arm.left,  
.player.walking.face-right .p-arm.left   { animation: walkArmSideBack .6s ease-in-out infinite alternate-reverse; }

.player.walking .p-inner { animation: walkBodyBob .6s ease-in-out infinite; }

/* ============================================================
   10. 弹窗、提示与家长中心
   ============================================================ */
.modal {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(80, 60, 40, .35); z-index: 100;
}
.modal.show { display: flex; }
.modal-card {
  position: relative; width: 100%; max-width: 360px;
  background: #fffdf8; border-radius: 26px; padding: 26px 22px 22px;
  text-align: center; box-shadow: 0 22px 50px rgba(120, 90, 60, .3);
  animation: pop .22s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close { position: absolute; top: 10px; right: 14px; border: none; background: none; font-size: 26px; line-height: 1; color: #c9b7a5; cursor: pointer; }
.modal-icon { font-size: 52px; }
.modal-card h2 { margin: 8px 0 6px; font-size: 20px; }
.modal-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.7; margin: 0 0 18px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(20px);
  background: #4a3f35; color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: .3s; z-index: 200; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.key-hint {
  max-width: 960px; margin: 10px auto 40px;
  display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-soft);
}
.key-hint span { background: #fff; padding: 6px 14px; border-radius: 999px; box-shadow: 0 3px 0 #f0d9c0; font-weight: 600; }

.map { max-width: 960px; margin: 0 auto; padding: 18px 14px 60px; display: flex; flex-direction: column; gap: 16px; }
.zone { border-radius: 24px; padding: 16px 16px 20px; box-shadow: var(--shadow); background: rgba(255, 255, 255, .75); }
.zone-title { margin: 0 0 14px; font-size: 17px; letter-spacing: 1px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }
.empty { color: var(--ink-soft); font-size: 14px; }
.child-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.child-card { background: #fff; border-radius: 18px; padding: 16px; box-shadow: 0 4px 0 #f0d9c0; display: flex; flex-direction: column; gap: 12px; }
.child-head { display: flex; align-items: center; gap: 10px; }
.child-avatar { font-size: 30px; }
.child-name { font-weight: 800; font-size: 16px; }
.child-sub { font-size: 12px; color: var(--ink-soft); }
.child-score { margin-left: auto; font-weight: 800; color: #7048e8; }
.child-stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.child-stats span { background: #fff8ee; border-radius: 999px; padding: 4px 10px; }
.score-form { display: flex; gap: 8px; flex-wrap: wrap; }
.score-form input[type=number] { width: 74px !important; text-align: center; }
.score-form input[name=reason] { flex: 1; min-width: 130px; }
.score-form .btn { padding: 10px 16px; font-size: 14px; }
.log-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.log-list li { background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 3px 0 #f0d9c0; }
.log-list b { color: #2b8a3e; }
.log-list .time { float: right; color: var(--ink-soft); font-size: 12px; }

/* 用户控制面板 */
.user-panel-overlay {
  position: fixed; inset: 0;
  background: rgba(80, 60, 40, .35);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.user-panel-overlay.show { display: flex; }
.user-panel-card {
  position: relative; width: 100%; max-width: 320px;
  background: #fffdf8; border-radius: 26px;
  padding: 26px 22px; text-align: center;
  box-shadow: 0 22px 50px rgba(120, 90, 60, .3);
  animation: pop .22s ease;
}
.up-header { 
  display: flex; align-items: center; gap: 14px; 
  margin-bottom: 24px; padding-bottom: 16px; 
  border-bottom: 1px dashed #ffe3c2; 
}
.up-avatar { 
  font-size: 42px; background: #fff8ee; border-radius: 50%; 
  width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; 
  border: 2px solid #ffe3c2; 
}
.up-info { text-align: left; }
.up-info h2 { margin: 0 0 4px; font-size: 20px; color: var(--ink); }
.up-info p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.up-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.up-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #8a7767; font-weight: 600; }
.up-form input { padding: 8px 12px; border-radius: 10px; border: 2px solid #ffe3c2; font-size: 14px; outline:none; }
.up-form input:focus { border-color: #ffa94d; }

@media (max-width: 520px) {
  .hud { padding: 8px 10px; gap: 8px; }
  .hud-group.right { margin-left: 0; width: 100%; }
  .pill { font-size: 12px; padding: 5px 9px; }
  .key-hint { padding: 0 12px; }
  .item-icon { font-size: 64px; }
  .item-label { font-size: 12px; top: 2px; padding: 2px 8px; }
  .deco-tree { font-size: 28px; }
}
/* ========== 窗户图标撑满容器 ========== */
.item[data-id^="window_"] .item-icon {
  font-size: 180px; /* 字号调大 */
  line-height: 1;
  margin: 0;
  transform: scaleY(1.2); /* 稍微拉长一点，适应高度 */
}
/* ★ 新增：让课桌的层级高于学生，实现坐在桌后的遮挡感 */
.item[data-id^="desk_"] {
  z-index: 6; 
}
/* 浅蓝墙面 + 浅灰地砖 */
/* 极简纯米色 */
.bg-minimal-classroom {
  background: #fffbf0;
}
/* 修复顶部栏两边贴边的问题 */
.hud-center {
  padding: 0 8px;
}
.hud {
  padding: 10px 20px; /* 整体加大左右内边距 */
}