/* ============================================================
   幼儿园活动室布局设计 - 温馨卡通风格 (最终版)
   ============================================================ */

/* ---------- 全局重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg:           #fff8f0;
  --color-primary:      #ff8c42;
  --color-accent:       #06d6a0;
  --color-wall:         #e8c98a;
  --color-wall-dark:    #c8a060;
  --color-wall-inner:   #d4b070;
  --color-floor:        #fef5e4;
  --color-floor-line:   rgba(200,170,120,0.2);
  --color-text:         #4a3728;
  --color-text-light:   #8b6f5e;
  --color-door:         #a0522d;
  --color-door-frame:   #7a3c1a;
  --color-window:       #b8e0f7;
  --color-window-frame: #5aabcc;
  --radius-lg:          18px;
  --radius-md:          10px;
  --radius-sm:          7px;
  --shadow-card:        0 4px 18px rgba(0,0,0,0.14);
  --shadow-hover:       0 8px 28px rgba(0,0,0,0.2);
  --wall-thickness:     34px;
  --font:               'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-user-select: none;
  user-select: none;
}

/* ============================================================
   顶部统计栏
   ============================================================ */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: linear-gradient(90deg, #ff7020 0%, #ff9a38 50%, #ffcc44 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 1000;
  box-shadow: 0 3px 16px rgba(255,112,32,0.42);
  border-bottom: 3px solid rgba(0,0,0,0.07);
}

.top-bar-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: 0.4px;
}

.top-bar-title i { font-size: 20px; }

.top-bar-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-item {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.28);
}

.stat-item strong {
  font-size: 15px;
  color: #fff3cd;
  font-weight: 800;
}

.stat-divider {
  color: rgba(255,255,255,0.4);
  font-size: 22px;
  font-weight: 200;
}

.reset-btn {
  background: rgba(255,255,255,0.95);
  color: #d05010;
  border: 2px solid rgba(255,255,255,0.7);
  border-radius: 22px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: var(--font);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.reset-btn:hover {
  background: #fff3e0;
  color: #b03000;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.reset-btn:active { transform: scale(0.97); }

/* ============================================================
   主布局
   ============================================================ */
.main-layout {
  display: flex;
  position: fixed;
  top: 54px; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* ============================================================
   活动室区域
   ============================================================ */
.room-section {
  width: 60%;
  height: 100%;
  background: linear-gradient(150deg, #f2e0b8 0%, #e8cc98 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 14px;
  border-right: 4px solid var(--color-wall-dark);
}

.room-label {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-light);
  background: rgba(255,255,255,0.55);
  padding: 2px 14px;
  border-radius: 10px;
  letter-spacing: 3px;
  white-space: nowrap;
}

/* 活动室容器（含墙壁） */
.room-container {
  position: relative;
  width: 100%;
  height: calc(100% - 30px);
  background: var(--color-wall);
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 0 0 4px var(--color-wall-dark),
    inset 0 0 24px rgba(0,0,0,0.07),
    var(--shadow-card);
  overflow: hidden;
}

/* 地板 */
.room-floor {
  position: absolute;
  top: var(--wall-thickness);
  left: var(--wall-thickness);
  right: var(--wall-thickness);
  bottom: var(--wall-thickness);
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px, transparent 59px,
      var(--color-floor-line) 59px, var(--color-floor-line) 60px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px, transparent 59px,
      var(--color-floor-line) 59px, var(--color-floor-line) 60px
    ),
    var(--color-floor);
  overflow: hidden;
}

/* 地板棋盘纹理 */
.room-floor::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(
    rgba(255,210,130,0.1) 0% 25%,
    transparent 0% 50%
  ) 0 0 / 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   墙壁
   ============================================================ */
.wall { position: absolute; z-index: 10; }

.wall-top {
  top: 0; left: 0; right: 0;
  height: var(--wall-thickness);
  display: flex;
  align-items: stretch;
  background: transparent;
}

.wall-bottom {
  bottom: 0; left: 0; right: 0;
  height: var(--wall-thickness);
  display: flex;
  align-items: stretch;
  background: transparent;
}

.wall-left {
  top: 0; left: 0; bottom: 0;
  width: var(--wall-thickness);
  background: linear-gradient(90deg, var(--color-wall-dark) 0%, var(--color-wall) 100%);
  border-right: 2px solid var(--color-wall-inner);
}

.wall-right {
  top: 0; right: 0; bottom: 0;
  width: var(--wall-thickness);
  background: linear-gradient(270deg, var(--color-wall-dark) 0%, var(--color-wall) 100%);
  border-left: 2px solid var(--color-wall-inner);
}

/* 墙壁分段 */
.wall-segment {
  background: var(--color-wall);
  flex: 1;
}

.wall-top .wall-segment {
  border-bottom: 3px solid var(--color-wall-inner);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.05);
}

.wall-bottom .wall-segment {
  border-top: 3px solid var(--color-wall-inner);
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.05);
}

/* ============================================================
   门
   ============================================================ */
.door {
  width: 70px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 11;
}

.door-frame {
  width: 56px;
  height: 32px;
  background: var(--color-door-frame);
  border-radius: 8px 8px 0 0;
  padding: 3px 3px 0;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.18);
}

.door-panel {
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #d89050 0%, #9a4e20 100%);
  border-radius: 5px 5px 0 0;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5px;
}

.door-window {
  width: 20px;
  height: 12px;
  background: linear-gradient(135deg, rgba(200,235,255,0.9), rgba(130,200,230,0.75));
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.5);
}

.door-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 5px;
  height: 5px;
  background: radial-gradient(circle, #ffe566, #d09000);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255,220,0,0.7);
}

.door-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--color-door-frame);
  margin-top: 1px;
  letter-spacing: 2px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* ============================================================
   窗户
   ============================================================ */
.window-frame {
  width: 90px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 11;
}

.window-sill-top {
  width: 72px;
  height: 4px;
  background: var(--color-wall-dark);
  border-radius: 2px 2px 0 0;
  margin-bottom: 0;
}

.window-pane {
  width: 70px;
  height: 22px;
  background: linear-gradient(135deg, #cceeff 0%, #7ec8e3 100%);
  border: 2.5px solid var(--color-window-frame);
  border-radius: 0 0 2px 2px;
  position: relative;
  box-shadow:
    inset 0 2px 8px rgba(255,255,255,0.65),
    0 1px 4px rgba(0,0,0,0.1);
  overflow: hidden;
}

.window-glare {
  position: absolute;
  top: 3px; left: 5px;
  width: 16px; height: 5px;
  background: rgba(255,255,255,0.5);
  border-radius: 4px;
  transform: rotate(-15deg);
}

.window-cross-h {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 2px;
  background: var(--color-window-frame);
  transform: translateY(-50%);
  opacity: 0.6;
}

.window-cross-v {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 2px;
  background: var(--color-window-frame);
  transform: translateX(-50%);
  opacity: 0.6;
}

.window-sill {
  width: 76px;
  height: 6px;
  background: linear-gradient(90deg, var(--color-wall-dark), var(--color-wall-inner), var(--color-wall-dark));
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.window-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--color-window-frame);
  margin-top: 1px;
  letter-spacing: 2px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* ============================================================
   仓库区域
   ============================================================ */
.warehouse-section {
  width: 40%;
  height: 100%;
  background: linear-gradient(180deg, #fffaf4 0%, #fff3e4 100%);
  border-left: 4px solid var(--color-wall-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.warehouse-header {
  background: linear-gradient(135deg, #2ecfc6 0%, #06d6a0 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.14);
  box-shadow: 0 3px 10px rgba(6,214,160,0.3);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.warehouse-header i { font-size: 17px; }

.warehouse-hint {
  font-size: 11px;
  color: var(--color-text-light);
  text-align: center;
  padding: 7px 8px 5px;
  background: rgba(255,255,255,0.7);
  border-bottom: 1px solid #ead8c0;
  flex-shrink: 0;
  font-weight: 500;
  line-height: 1.5;
}

.warehouse-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-content: start;
}

.warehouse-list::-webkit-scrollbar { width: 6px; }
.warehouse-list::-webkit-scrollbar-track { background: #f5e8d8; border-radius: 3px; }
.warehouse-list::-webkit-scrollbar-thumb { background: var(--color-wall-dark); border-radius: 3px; }

/* ============================================================
   仓库物品卡片
   ============================================================ */
.warehouse-item {
  background: #fff;
  border: 2px solid #e8d5c0;
  border-radius: var(--radius-md);
  padding: 10px 5px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: grab;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.15s;
  position: relative;
  box-shadow: 0 2px 7px rgba(0,0,0,0.07);
  min-height: 76px;
}

.warehouse-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 6px 18px rgba(255,140,66,0.22);
  transform: translateY(-2px);
  background: #fffcf8;
}

.warehouse-item:active {
  cursor: grabbing;
  transform: scale(0.93);
}

.warehouse-item.empty {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
}

.warehouse-item .item-icon {
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
}

.warehouse-item .item-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  line-height: 1.3;
  word-break: break-all;
}

.warehouse-item .item-count-badge {
  position: absolute;
  top: -6px; right: -6px;
  background: linear-gradient(135deg, #ff8c42, #ff5800);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(255,88,0,0.4);
  border: 1.5px solid #fff;
}

/* 各类型图标颜色 */
.warehouse-item.type-multimedia .item-icon { color: #3d5a80; background: #e8f0f8; }
.warehouse-item.type-art         .item-icon { color: #e05080; background: #ffe8f0; }
.warehouse-item.type-puzzle      .item-icon { color: #8a4cc0; background: #f3e8ff; }
.warehouse-item.type-performance .item-icon { color: #c07010; background: #fff3e0; }
.warehouse-item.type-construction .item-icon { color: #059073; background: #e8faf5; }
.warehouse-item.type-reading     .item-icon { color: #2471a3; background: #e8f4fd; }
.warehouse-item.type-table       .item-icon { color: #a07020; background: #fff8e8; }
.warehouse-item.type-chair       .item-icon { color: #2c6e8a; background: #e8f6fc; }
.warehouse-item.type-locker      .item-icon { color: #7a3545; background: #f8eaec; }
.warehouse-item.type-sink        .item-icon { color: #1971c2; background: #e7f5ff; }
.warehouse-item.type-towel       .item-icon { color: #0ca678; background: #e6fcf5; }
.warehouse-item.type-water       .item-icon { color: #1864ab; background: #e7f5ff; }
.warehouse-item.type-piano       .item-icon { color: #1a1a1a; background: #f5f5dc; }

/* ============================================================
   活动室内物品
   ============================================================ */
.room-item {
  position: absolute;
  cursor: grab;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: box-shadow 0.15s, filter 0.15s;
  z-index: 20;
  -webkit-user-select: none;
  user-select: none;
}

.room-item:hover {
  z-index: 50;
  box-shadow: 0 6px 22px rgba(0,0,0,0.28) !important;
  filter: brightness(1.07);
}

.room-item.dragging {
  cursor: grabbing;
  z-index: 100;
  opacity: 0.5;
  box-shadow: 0 14px 36px rgba(0,0,0,0.32) !important;
}

.room-item.collision {
  outline: 3px solid #ff2222;
  outline-offset: 2px;
  animation: shake 0.35s ease;
}

.room-item.snapped {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  animation: snapPulse 0.45s ease;
}

.room-item .item-icon {
  line-height: 1;
  pointer-events: none;
}

.room-item .item-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  text-align: center;
  line-height: 1.2;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 2px;
}

/* 双击提示 */
.room-item::after {
  content: '双击旋转';
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: rgba(80,55,35,0.8);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  background: rgba(255,255,255,0.9);
  padding: 2px 7px;
  border-radius: 5px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.12);
  z-index: 200;
}

.room-item:hover::after { opacity: 1; }

/* ============================================================
   物品颜色主题
   ============================================================ */
.item-multimedia {
  background: linear-gradient(135deg, #2c3e50 0%, #3d5a80 100%);
  border: 2px solid #1a2a40;
  box-shadow: 0 3px 10px rgba(44,62,80,0.36);
}
.item-multimedia .item-icon { color: #7ec8e3; }

.item-art {
  background: linear-gradient(135deg, #ff6b9d 0%, #ff8c42 100%);
  border: 2px solid #d83868;
  box-shadow: 0 3px 10px rgba(255,107,157,0.3);
}
.item-art .item-icon { color: #fff; }

.item-puzzle {
  background: linear-gradient(135deg, #c77dff 0%, #9b5de5 100%);
  border: 2px solid #7a3cc0;
  box-shadow: 0 3px 10px rgba(155,93,229,0.3);
}
.item-puzzle .item-icon { color: #fff; }

.item-performance {
  background: linear-gradient(135deg, #ffd166 0%, #f4a261 100%);
  border: 2px solid #c87818;
  box-shadow: 0 3px 10px rgba(244,162,97,0.34);
}
.item-performance .item-icon { color: #7a4000; }

.item-construction {
  background: linear-gradient(135deg, #06d6a0 0%, #1b9aaa 100%);
  border: 2px solid #048c6a;
  box-shadow: 0 3px 10px rgba(6,214,160,0.3);
}
.item-construction .item-icon { color: #fff; }

.item-reading {
  background: linear-gradient(135deg, #4ecdc4 0%, #2980b9 100%);
  border: 2px solid #1a6090;
  box-shadow: 0 3px 10px rgba(78,205,196,0.3);
}
.item-reading .item-icon { color: #fff; }

.item-table {
  background: linear-gradient(135deg, #f9c784 0%, #e89838 100%);
  border: 2px solid #b87020;
  box-shadow: 0 3px 10px rgba(232,152,56,0.34);
}
.item-table .item-icon { color: #7a4800; }

.item-chair {
  background: linear-gradient(135deg, #a8d8ea 0%, #5ab8d8 100%);
  border: 2px solid #3898b8;
  box-shadow: 0 3px 10px rgba(90,184,216,0.3);
}
.item-chair .item-icon { color: #1a5878; }

.item-locker {
  background: linear-gradient(135deg, #c8909a 0%, #9b4f5e 100%);
  border: 2px solid #7a3040;
  box-shadow: 0 3px 10px rgba(155,79,94,0.3);
}
.item-locker .item-icon { color: #fff; }

.item-sink {
  background: linear-gradient(135deg, #74c0fc 0%, #4dabf7 100%);
  border: 2px solid #2080d0;
  box-shadow: 0 3px 10px rgba(77,171,247,0.34);
}
.item-sink .item-icon { color: #0a50a0; }

.item-towel {
  background: linear-gradient(135deg, #96f2d7 0%, #38d9a9 100%);
  border: 2px solid #0ca678;
  box-shadow: 0 3px 10px rgba(56,217,169,0.3);
}
.item-towel .item-icon { color: #065040; }

.item-water {
  background: linear-gradient(135deg, #74c0fc 0%, #228be6 100%);
  border: 2px solid #1060c0;
  box-shadow: 0 3px 10px rgba(34,139,230,0.34);
}
.item-water .item-icon { color: #fff; }

.item-piano {
  background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  border: 2px solid #000;
  box-shadow: 0 3px 12px rgba(0,0,0,0.45);
}
.item-piano .item-icon { color: #f5e642; }

/* ============================================================
   拖拽幽灵
   ============================================================ */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.8;
  transform: scale(1.08);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
}

/* ============================================================
   Toast 提示
   ============================================================ */
.snap-toast,
.collision-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  padding: 9px 22px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 700;
  z-index: 9000;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.snap-toast {
  background: linear-gradient(135deg, #06d6a0, #0ca678);
  color: #fff;
  box-shadow: 0 4px 16px rgba(6,214,160,0.45);
}

.collision-toast {
  background: linear-gradient(135deg, #ff4444, #cc1111);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255,68,68,0.45);
}

.snap-toast.show,
.collision-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   放置区高亮
   ============================================================ */
.room-floor.drag-over {
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px, transparent 59px,
      rgba(6,214,160,0.16) 59px, rgba(6,214,160,0.16) 60px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px, transparent 59px,
      rgba(6,214,160,0.16) 59px, rgba(6,214,160,0.16) 60px
    ),
    #f0fdf8;
  box-shadow: inset 0 0 0 3px rgba(6,214,160,0.45);
}

/* ============================================================
   动画
   ============================================================ */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes snapPulse {
  0%   { outline-width: 3px; }
  50%  { outline-width: 5px; }
  100% { outline-width: 3px; }
}

@keyframes dropIn {
  0%   { transform: scale(0.3) translateY(-20px); opacity: 0; }
  65%  { transform: scale(1.12) translateY(3px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.room-item.drop-in {
  animation: dropIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .warehouse-list { grid-template-columns: repeat(2, 1fr); }
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-wall-dark) #f5e8d8;
}
