* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* 怀旧木质课桌纹理背景 */
  background: 
    radial-gradient(circle at 50% 40%, rgba(255, 248, 231, 0.08), rgba(20, 12, 6, 0.65)),
    repeating-linear-gradient(
      90deg,
      #7c5333 0px,
      #7c5333 42px,
      #6e472b 42px,
      #6e472b 85px,
      #845937 85px,
      #845937 140px
    );
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Comic Sans MS", cursive, sans-serif;
  color: #1f1f1f;
}

/* 顶部课桌文具状态栏 */
#hud-bar {
  min-height: 52px;
  background: #f5efe0;
  border-bottom: 3px solid #2b2b2b;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  gap: 6px;
  z-index: 20;
  position: relative;
  flex-wrap: wrap;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notebook-title-tag {
  display: flex;
  flex-direction: column;
  border-right: 2px dashed #999;
  padding-right: 8px;
}

.tag-badge {
  font-size: 10px;
  color: #b73225;
  font-weight: 700;
  letter-spacing: 0.3px;
}

#scenario-title {
  font-size: 13px;
  font-weight: 900;
  color: #1c1c1c;
  text-shadow: 1px 1px 0 #fff;
  white-space: nowrap;
}

.scenario-switcher {
  display: flex;
  gap: 4px;
}

.corner-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #e2e8f0;
  border: 2px solid #1e3a8a;
  border-radius: 6px;
  padding: 2px 6px;
  box-shadow: 2px 2px 0 #1e3a8a;
}

.corner-label {
  font-size: 11px;
  font-weight: 900;
  color: #1e3a8a;
  white-space: nowrap;
}

.corner-btn {
  background: #fff;
  border: 1.5px solid #1e3a8a;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 800;
  color: #1e3a8a;
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
}

.corner-btn:hover {
  background: #dbeafe;
}

.corner-btn.active {
  background: #2563eb;
  color: #fff;
}

.page-tab {
  background: #e8dec5;
  border: 2px solid #2b2b2b;
  border-radius: 5px 8px 4px 6px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 800;
  color: #2b2b2b;
  cursor: pointer;
  box-shadow: 2px 2px 0 #2b2b2b;
  transition: transform 0.1s, background 0.15s;
  white-space: nowrap;
}

.page-tab:hover {
  background: #fff7df;
  transform: translateY(-1px);
}

.page-tab.active {
  background: #ffde59;
  color: #111;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #2b2b2b;
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  background: #fffdf7;
  border: 2px solid #2b2b2b;
  border-radius: 6px;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 2px 2px 0 #2b2b2b;
  font-size: 11px;
  font-weight: 700;
}

.pill-label {
  white-space: nowrap;
}

.bar-track {
  width: 64px;
  height: 10px;
  background: #e2dcd0;
  border: 1.5px solid #222;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  transition: width 0.15s ease-out;
}

.hp-fill {
  background: repeating-linear-gradient(
    -45deg,
    #2563eb,
    #2563eb 6px,
    #1d4ed8 6px,
    #1d4ed8 12px
  );
}

.rage-fill {
  background: repeating-linear-gradient(
    -45deg,
    #f59e0b,
    #f59e0b 6px,
    #dc2626 6px,
    #dc2626 12px
  );
}

.pill-val {
  font-weight: 900;
  font-family: "Courier New", monospace;
  font-size: 14px;
  white-space: nowrap;
}

.highlight-black {
  background: #1f1f1f;
  color: #ffde59;
  padding: 1px 6px;
  border-radius: 4px;
}

.overdrive-btn {
  background: #d1d5db;
  border: 2px solid #222;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
  cursor: not-allowed;
  color: #555;
}

.overdrive-btn.ready {
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  animation: pulseShake 0.6s infinite alternate;
  box-shadow: 2px 2px 0 #111;
}

@keyframes pulseShake {
  0% { transform: scale(1) rotate(-1deg); }
  100% { transform: scale(1.07) rotate(1.5deg); }
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.desk-btn {
  background: #fdfaf2;
  border: 2px solid #2b2b2b;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0 #2b2b2b;
  white-space: nowrap;
  transition: all 0.1s;
}

.desk-btn:hover {
  background: #fff3c4;
}

.desk-btn.active {
  background: #bbf7d0;
  border-color: #14532d;
}

.desk-btn.danger:hover {
  background: #fecaca;
  color: #991b1b;
}

/* 舞台与画纸区域 */
#desk-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 8px 14px;
  gap: 8px;
  min-height: 0;
}

#canvas-wrapper {
  flex: 1;
  position: relative;
  border: 3px solid #1e1e1e;
  border-radius: 4px;
  box-shadow: 
    6px 6px 0 rgba(0, 0, 0, 0.45),
    0 0 25px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  background: #fbf8ef;
  cursor: crosshair;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* BOSS 顶部血条浮层 */
#boss-hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(580px, 88%);
  background: rgba(254, 249, 235, 0.94);
  border: 3px solid #111;
  border-radius: 8px;
  padding: 8px 14px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55);
  z-index: 10;
  pointer-events: none;
}

.boss-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 15px;
  color: #991b1b;
  margin-bottom: 4px;
}

.boss-bar-outer {
  width: 100%;
  height: 16px;
  background: #e5e0d5;
  border: 2px solid #111;
  border-radius: 4px;
  overflow: hidden;
}

.boss-bar-inner {
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    #dc2626,
    #dc2626 8px,
    #7f1d1d 8px,
    #7f1d1d 16px
  );
  transition: width 0.12s ease-out;
}

.boss-hint {
  font-size: 12px;
  color: #333;
  margin-top: 4px;
  font-weight: 700;
  text-align: center;
}

/* 连击涂鸦字 */
#combo-banner {
  position: absolute;
  top: 14px;
  left: 16px;
  background: #fffbeb;
  border: 3px solid #111;
  border-radius: 10px 4px 12px 6px;
  padding: 6px 14px;
  box-shadow: 4px 4px 0 #111;
  transform: rotate(-2deg);
  pointer-events: none;
  z-index: 11;
  text-align: center;
}

/* 右上角悬浮全景雷达小地图 */
.minimap-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(245, 239, 224, 0.96);
  border: 3px solid #1e1e1e;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.5);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #1f1f1f;
  gap: 6px;
}

.mini-follow-btn {
  background: #fff;
  border: 1.5px solid #222;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.mini-follow-btn.active {
  background: #2563eb;
  color: #fff;
}

.minimap-stage {
  position: relative;
  width: 224px;
  height: 168px;
  border: 2px solid #222;
  background: #fbf8ef;
}

#minimap-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.mini-corner-pin {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #1e3a8a;
  color: #1e3a8a;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 2;
  box-shadow: 1px 1px 0 #111;
}

.mini-corner-pin:hover {
  background: #dbeafe;
}

.mini-corner-pin.active {
  background: #2563eb;
  color: #fff;
}

.mini-corner-pin.nw { top: 3px; left: 3px; }
.mini-corner-pin.ne { top: 3px; right: 3px; }
.mini-corner-pin.sw { bottom: 3px; left: 3px; }
.mini-corner-pin.se { bottom: 3px; right: 3px; }

.minimap-legend {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  color: #333;
  padding: 0 2px;
}

#combo-count {
  font-size: 26px;
  font-weight: 900;
  color: #dc2626;
  text-shadow: 2px 2px 0 #111;
  line-height: 1.1;
}

#combo-sub {
  font-size: 12px;
  font-weight: 800;
  color: #222;
}

/* 浮动教学提示 */
#tutorial-toast {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 94%;
  background: rgba(255, 251, 230, 0.94);
  border: 2px dashed #333;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  color: #1f1f1f;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.25);
  pointer-events: none;
  text-align: center;
  z-index: 9;
  transition: opacity 0.4s;
}

/* 结算弹窗 */
.paper-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-1deg);
  width: min(520px, 92%);
  background: #fdfaf1;
  border: 4px solid #111;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.65);
  z-index: 30;
  text-align: center;
}

.modal-stamp {
  display: inline-block;
  border: 3px solid #dc2626;
  color: #dc2626;
  font-weight: 900;
  font-size: 15px;
  padding: 3px 12px;
  border-radius: 4px;
  transform: rotate(-4deg);
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.paper-modal h2 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
  color: #111;
}

.paper-modal p {
  font-size: 14px;
  color: #444;
  margin-bottom: 18px;
  font-weight: 600;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.m-stat {
  background: #f3ede0;
  border: 2px solid #222;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.m-label {
  font-size: 12px;
  color: #555;
  font-weight: 700;
}

.m-stat strong {
  font-size: 20px;
  color: #111;
  font-weight: 900;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.paper-btn {
  background: #fff;
  border: 2px solid #111;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 3px 3px 0 #111;
  transition: transform 0.1s;
}

.paper-btn:hover {
  transform: translateY(-2px);
  background: #fef9c3;
}

.paper-btn.primary {
  background: #ffde59;
}

.paper-btn.secondary {
  background: #e5e7eb;
}

.hidden {
  display: none !important;
}

/* 底部文具盒栏 */
#pencil-case {
  min-height: 62px;
  background: #f5efe0;
  border: 3px solid #222;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  gap: 8px;
}

.weapon-slots {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  flex: 1;
}

.weapon-card {
  position: relative;
  background: #fffdf9;
  border: 2px solid #262626;
  border-radius: 7px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 2px 2px 0 #262626;
  text-align: left;
  transition: all 0.12s;
  min-width: 0;
}

.weapon-card:hover {
  background: #fef3c7;
  transform: translateY(-2px);
}

.weapon-card.active {
  background: #fde047;
  border-color: #111;
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #111;
}

.w-key {
  background: #222;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.w-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.w-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.w-info strong {
  font-size: 12px;
  font-weight: 900;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.w-info small {
  font-size: 10px;
  color: #4b5563;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cd-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1.5px solid #111;
}

.cd-badge.cooling {
  background: #dc2626;
}

/* 迷你全景画纸导航 */
.minimap-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #e9e1cd;
  border: 2px solid #222;
  border-radius: 6px;
  padding: 3px 6px;
  flex-shrink: 0;
}

.minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #333;
  gap: 6px;
}

.mini-follow-btn {
  background: #fff;
  border: 1.5px solid #222;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.mini-follow-btn.active {
  background: #bfdbfe;
  color: #1e3a8a;
}

#minimap-canvas {
  border: 1.5px solid #333;
  background: #fbf8ef;
  cursor: pointer;
  display: block;
}
