* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --taskbar-h: 56px;
  --win-bg: rgba(22, 27, 45, 0.92);
  --win-border: rgba(255, 255, 255, 0.12);
  --text-dim: #9aa5c4;
  --accent: #ffcb05;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #eee;
  background:
    radial-gradient(1200px 600px at 70% -10%, #2b3a67 0%, transparent 60%),
    radial-gradient(900px 500px at 10% 110%, #1f4068 0%, transparent 55%),
    linear-gradient(135deg, #141e30 0%, #16213e 100%);
  min-height: 100vh;
  padding-bottom: calc(var(--taskbar-h) + 16px);
}

/* ---------- 바탕화면 ---------- */
.desktop { max-width: 1100px; margin: 0 auto; padding: 28px 18px 12px; }

.desk-head { text-align: center; margin-bottom: 22px; }
.desk-head h1 { font-size: 26px; }
.tagline { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.back {
  display: inline-block; margin-top: 10px; color: var(--text-dim);
  font-size: 12px; text-decoration: none;
}
.back:hover { color: var(--accent); }

.windows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  align-items: start;
}

/* ---------- 창 ---------- */
.window {
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}
.titlebar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid var(--win-border);
  letter-spacing: 0.4px;
}
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.win-body { padding: 12px 14px; font-size: 13px; }

/* ---------- 영웅 정보 ---------- */
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; color: var(--text-dim);
}
.stat-row strong { color: #fff; font-variant-numeric: tabular-nums; }
.stat-row.big strong { color: var(--accent); font-size: 16px; }
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px;
  margin: 6px 0; padding: 6px 0;
  border-top: 1px dashed var(--win-border); border-bottom: 1px dashed var(--win-border);
}
.stat-grid .stat-row { font-size: 12px; }

.bar {
  position: relative; height: 14px; border-radius: 7px;
  background: rgba(0, 0, 0, 0.45); overflow: hidden; margin: 4px 0 8px;
}
.bar .fill { height: 100%; width: 0%; transition: width 0.2s; border-radius: 7px; }
.bar.hp .fill { background: linear-gradient(90deg, #2ecc71, #27ae60); }
.bar.xp .fill { background: linear-gradient(90deg, #5dade2, #2e86c1); }
.bar.xp span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

.prestige {
  width: 100%; margin-top: 10px; padding: 9px;
  border: none; border-radius: 8px; cursor: pointer;
  font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, #8e44ad, #6c3483); color: #fff;
}
.prestige:disabled { opacity: 0.45; cursor: not-allowed; }
.prestige:not(:disabled):hover { filter: brightness(1.15); }

/* ---------- 상점 ---------- */
.shop { display: flex; flex-direction: column; gap: 8px; }
.shop-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--win-border);
}
.shop-item .info { flex: 1; }
.shop-item .name { font-size: 13px; font-weight: 600; }
.shop-item .desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.shop-item button {
  min-width: 86px; padding: 7px 10px; border: none; border-radius: 7px;
  background: var(--accent); color: #222; font-weight: 700; font-size: 12px;
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.shop-item button:disabled { background: #3a4160; color: #788; cursor: not-allowed; }
.shop-item button:not(:disabled):hover { filter: brightness(1.1); }

/* ---------- 장비 ---------- */
.gear { display: flex; flex-direction: column; gap: 8px; }
.gear-slot {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--win-border);
}
.slot-icon { font-size: 22px; }
.slot-info em { display: block; font-style: normal; font-size: 11px; color: var(--text-dim); }
.item-name { font-size: 13px; font-weight: 600; }
.item-name.none { color: #5a6485; font-weight: 400; }
.gear-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* 등급 색상 */
.r0 { color: #cfd8e3; }
.r1 { color: #2ecc71; }
.r2 { color: #5dade2; }
.r3 { color: #af7ac5; }
.r4 { color: #f5b041; }

/* ---------- 전투 기록 ---------- */
.log {
  list-style: none; max-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12px; color: var(--text-dim);
}
.log li { line-height: 1.45; }
.log .good { color: #7dcea0; }
.log .bad { color: #ec7063; }
.log .loot { color: #f5b041; }
.log .sys { color: #5dade2; }

/* ---------- 작업표시줄 ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h);
  display: flex; align-items: stretch;
  background: rgba(10, 13, 24, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  z-index: 50;
}
.start-btn {
  width: 56px; border: none; cursor: pointer;
  background: transparent; color: #cfd8e3; font-size: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.start-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--accent); }

.stage-wrap { flex: 1; position: relative; overflow: hidden; }
#game { display: block; width: 100%; height: 100%; }

.tray {
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.tray-stage { color: var(--accent); font-weight: 700; }

/* ---------- 시작 메뉴 ---------- */
.startmenu {
  position: fixed; left: 8px; bottom: calc(var(--taskbar-h) + 8px);
  width: 230px; padding: 8px;
  background: var(--win-bg); border: 1px solid var(--win-border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.startmenu.hidden { display: none; }
.startmenu button {
  display: block; width: 100%; text-align: left;
  padding: 9px 10px; border: none; border-radius: 7px;
  background: transparent; color: #eee; font-size: 13px; cursor: pointer;
}
.startmenu button:hover { background: rgba(255, 255, 255, 0.08); }
.menu-about {
  margin-top: 6px; padding: 8px 10px 4px;
  border-top: 1px solid var(--win-border);
  font-size: 11px; color: #5a6485;
}

@media (max-width: 560px) {
  .windows { grid-template-columns: 1fr; }
  .tray-stage { display: none; }
}
