* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #111;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#hp-bar-container {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 180px;
  height: 22px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #555;
  border-radius: 11px;
  overflow: hidden;
}

#hp-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #e74c3c, #e67e22);
  transition: width 0.2s ease;
  border-radius: 9px;
}

#hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
}

#xp-bar-container {
  position: absolute;
  top: 38px;
  left: 12px;
  width: 180px;
  height: 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #555;
  border-radius: 6px;
  overflow: hidden;
}

#xp-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(to right, #3498db, #8e44ad);
  transition: width 0.2s ease;
  border-radius: 4px;
}

#xp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
}

#wave-counter {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 2px 2px 4px #000;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 14px;
  border-radius: 8px;
}

#level-name {
  position: absolute;
  top: 38px;
  right: 12px;
  font-size: 12px;
  color: #888;
  text-shadow: 1px 1px 3px #000;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 10px;
  border-radius: 6px;
}

#level-name:empty {
  display: none;
}

#score-display {
  position: absolute;
  top: 56px;
  right: 12px;
  font-size: 15px;
  font-weight: bold;
  text-shadow: 2px 2px 4px #000;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 12px;
  border-radius: 8px;
  color: #f1c40f;
}

#enemy-counter {
  position: absolute;
  top: 84px;
  right: 12px;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 2px 2px 4px #000;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 12px;
  border-radius: 8px;
  color: #e74c3c;
}

#boss-hp-container {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  text-align: center;
}

#boss-hp-container.hidden {
  display: none;
}

#boss-name {
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 3px #000;
  color: #e74c3c;
}

#boss-hp-bar {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #e74c3c;
  border-radius: 7px;
  overflow: hidden;
  margin-top: 4px;
}

#boss-hp-bar::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #c0392b, #e74c3c);
  transition: width 0.2s ease;
}

#ability-icons {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap-reverse;
  max-width: 200px;
  justify-content: flex-end;
}

.ability-icon {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #888;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
}

.ability-icon .cooldown-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  transition: height 0.1s linear;
}

.ability-icon .level-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #3498db;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wave-countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: bold;
  text-shadow: 3px 3px 6px #000;
  opacity: 0.8;
}

#wave-countdown.hidden {
  display: none;
}

/* Menu */
#menu-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 70%, #1a1015 0%, #080408 50%, #000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#menu-screen.hidden {
  display: none;
}

.menu-logo {
  font-size: 72px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(192, 57, 43, 0.6));
  animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(192, 57, 43, 0.4)); }
  50% { filter: drop-shadow(0 0 30px rgba(192, 57, 43, 0.8)); }
}

#menu-screen h1 {
  font-size: 52px;
  margin-bottom: 8px;
  text-shadow: 0 0 30px rgba(192, 57, 43, 0.4), 0 2px 4px rgba(0,0,0,0.8);
  color: #ecf0f1;
  letter-spacing: 3px;
  font-variant: small-caps;
}

.menu-tagline {
  color: #888;
  margin-bottom: 32px !important;
  text-align: center;
  max-width: 360px;
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
}

#menu-screen p {
  color: #bbb;
  margin-bottom: 24px;
  text-align: center;
  max-width: 360px;
}

#start-btn {
  padding: 16px 52px;
  font-size: 22px;
  background: linear-gradient(135deg, #c0392b, #96281b);
  border: 1px solid rgba(231, 76, 60, 0.3);
  box-shadow: 0 0 20px rgba(192, 57, 43, 0.3);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#start-btn:hover {
  box-shadow: 0 0 30px rgba(192, 57, 43, 0.5);
}

.controls-hint {
  font-size: 12px;
  color: #555 !important;
  margin-top: 12px !important;
  line-height: 1.6;
}

button {
  padding: 14px 40px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  transition: transform 0.1s, box-shadow 0.1s;
  pointer-events: auto;
}

button:active {
  transform: scale(0.96);
}

/* Game Over */
#game-over-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#game-over-screen.hidden {
  display: none;
}

#game-over-screen h2 {
  font-size: 48px;
  color: #e74c3c;
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

#final-wave {
  font-size: 18px;
  color: #bbb;
  margin-bottom: 8px;
}

#final-score {
  font-size: 28px;
  font-weight: bold;
  color: #f1c40f;
  text-shadow: 0 0 12px rgba(241, 196, 15, 0.4);
  margin-bottom: 8px;
}

#kill-breakdown {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
  max-width: 400px;
}

#kill-breakdown .kill-entry {
  font-size: 13px;
  color: #bbb;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Pause Button */
#pause-btn {
  position: absolute;
  top: 12px;
  left: 200px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #555;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  z-index: 20;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#pause-btn:hover {
  border-color: #aaa;
  background: rgba(0, 0, 0, 0.8);
}

/* Pause Overlay */
#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

#pause-overlay.hidden {
  display: none;
}

#pause-overlay h2 {
  font-size: 64px;
  margin-bottom: 32px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  color: #ecf0f1;
  letter-spacing: 12px;
}

#pause-overlay button {
  padding: 14px 48px;
  font-size: 22px;
}

/* World Map */
#world-map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, #0d1117 0%, #010409 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 30px;
  z-index: 90;
}

#world-map.hidden {
  display: none;
}

#world-map h2 {
  font-size: 32px;
  color: #f1c40f;
  text-shadow: 0 0 15px rgba(241, 196, 15, 0.4);
  margin-bottom: 4px;
}

.world-map-subtitle {
  color: #888;
  font-size: 14px;
  margin-bottom: 20px;
}

#world-map-nodes {
  position: relative;
  width: 90%;
  max-width: 700px;
  height: 70vh;
  max-height: 600px;
}

.world-map-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.world-map-lines .path-unlocked {
  stroke: #3498db;
  stroke-width: 0.5;
  stroke-dasharray: 2 1;
}

.world-map-lines .path-locked {
  stroke: #333;
  stroke-width: 0.3;
  stroke-dasharray: 1 1;
}

.world-node {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s;
  pointer-events: auto;
}

.world-node.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.world-node.unlocked:hover, .world-node.unlocked:active {
  transform: translate(-50%, -50%) scale(1.15);
}

.node-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

.world-node.cleared .node-icon {
  filter: drop-shadow(0 0 10px rgba(46, 204, 113, 0.5));
}

.node-name {
  font-size: 12px;
  font-weight: bold;
  color: #ccc;
  white-space: nowrap;
  text-shadow: 1px 1px 3px #000;
}

.world-node.cleared .node-name {
  color: #2ecc71;
}

.world-node.locked .node-name {
  color: #555;
}

.node-check {
  position: absolute;
  top: -5px;
  right: -10px;
  font-size: 16px;
  color: #2ecc71;
  font-weight: bold;
  text-shadow: 0 0 5px #2ecc71;
}

.node-lock {
  position: absolute;
  top: -5px;
  right: -10px;
  font-size: 14px;
}

/* Level Clear Screen */
#level-clear-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

#level-clear-screen.hidden {
  display: none;
}

#level-clear-title {
  font-size: 42px;
  color: #2ecc71;
  text-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
  margin-bottom: 24px;
}

#level-clear-stats {
  display: flex;
  gap: 30px;
  margin-bottom: 24px;
}

.clear-stat {
  text-align: center;
}

.clear-stat-label {
  display: block;
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.clear-stat-value {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #f1c40f;
}

#level-clear-stars {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
}

.star {
  font-size: 48px;
  opacity: 0;
  animation: starPop 0.4s ease forwards;
}

.star.earned {
  color: #f1c40f;
  text-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
}

.star.unearned {
  color: #333;
  text-shadow: none;
}

@keyframes starPop {
  0% { opacity: 0; transform: scale(0.3) rotate(-30deg); }
  60% { opacity: 1; transform: scale(1.3) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

#continue-btn {
  padding: 12px 36px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  pointer-events: auto;
  transition: transform 0.1s;
}

#continue-btn:active {
  transform: scale(0.96);
}

/* Class Picker */
#class-picker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 70%, #1a1015 0%, #080408 50%, #000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 95;
}

#class-picker.hidden {
  display: none;
}

#class-picker h2 {
  font-size: 24px;
  margin-bottom: 28px;
  text-shadow: 0 0 15px rgba(192, 57, 43, 0.3);
  color: #ccc;
  font-style: italic;
  font-weight: normal;
}

#class-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 800px;
  padding: 0 16px;
}

.class-card {
  width: 170px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #555;
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  pointer-events: auto;
}

.class-card:hover, .class-card:active {
  transform: scale(1.06);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.class-icon {
  font-size: 42px;
  margin-bottom: 6px;
}

.class-name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 6px;
}

.class-desc {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 12px;
  line-height: 1.3;
}

.class-stats {
  margin-bottom: 10px;
}

.class-stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 10px;
  font-weight: bold;
  color: #888;
  width: 28px;
  text-align: right;
}

.stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.stat-value {
  font-size: 10px;
  color: #aaa;
  width: 28px;
  text-align: left;
}

.class-ability {
  font-size: 10px;
  color: #f1c40f;
  line-height: 1.3;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Skill Tree Panel */
#skill-tree-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 85;
  overflow-y: auto;
  padding: 20px;
}

#skill-tree-panel.hidden {
  display: none;
}

.skill-tree-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.skill-tree-title {
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 0 10px currentColor;
}

.skill-points-display {
  font-size: 16px;
  color: #f1c40f;
}

.skill-tree-respec-btn, .skill-tree-close-btn {
  padding: 8px 20px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
}

.skill-tree-respec-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.skill-tree-close-btn {
  background: linear-gradient(135deg, #555, #333);
}

.skill-tree-branches {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 700px;
}

.skill-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 180px;
}

.branch-name {
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.skill-node {
  width: 160px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #333;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  pointer-events: auto;
  position: relative;
}

.skill-node.locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.skill-node.available {
  border-color: var(--branch-color, #f1c40f);
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
  animation: skillPulse 2s ease-in-out infinite;
}

.skill-node.purchased {
  border-color: var(--branch-color, #3498db);
  background: linear-gradient(135deg, #1a2a3e, #162e4e);
}

.skill-node.maxed {
  border-color: #f1c40f;
  background: linear-gradient(135deg, #2a2a1e, #3e3620);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.2);
}

.skill-node:hover {
  transform: scale(1.05);
}

@keyframes skillPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(241, 196, 15, 0.2); }
  50% { box-shadow: 0 0 16px rgba(241, 196, 15, 0.5); }
}

.skill-node-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.skill-node-name {
  font-size: 12px;
  font-weight: bold;
  color: #ecf0f1;
  margin-bottom: 2px;
}

.skill-node-type {
  font-size: 9px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.skill-node-pips {
  font-size: 10px;
  letter-spacing: 2px;
  margin-top: 4px;
}

.rank-pip {
  color: #555;
}

.rank-pip.filled {
  color: #f1c40f;
}

.skill-detail-panel {
  margin-top: 20px;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  min-height: 60px;
}

.detail-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #ecf0f1;
}

.detail-desc {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 8px;
}

.detail-rank {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}

.detail-current {
  font-size: 12px;
  color: #3498db;
  margin-bottom: 4px;
}

.detail-next {
  font-size: 12px;
  color: #2ecc71;
  margin-bottom: 8px;
}

.detail-maxed {
  font-size: 14px;
  color: #f1c40f;
  font-weight: bold;
}

.detail-locked {
  font-size: 12px;
  color: #e74c3c;
}

.invest-btn {
  padding: 10px 24px;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.1s;
}

.invest-btn:active {
  transform: scale(0.96);
}

/* Waystone Panel */
#waystone-panel {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 85;
  overflow-y: auto;
  padding: 20px;
}
#waystone-panel.hidden { display: none; }

.waystone-header { text-align: center; margin-bottom: 20px; }
.waystone-header h2 { font-size: 28px; color: #3498db; text-shadow: 0 0 15px rgba(52, 152, 219, 0.5); margin-bottom: 4px; }
.waystone-subtitle { font-size: 14px; color: #888; }

.waystone-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 500px;
  width: 100%;
  max-height: 50vh;
  overflow-y: auto;
}

.waystone-dest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 2px solid #333;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  pointer-events: auto;
}
.waystone-dest.unlocked:hover, .waystone-dest.cleared:hover {
  border-color: #3498db;
  transform: scale(1.02);
}
.waystone-dest.locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.waystone-dest.cleared { border-color: #2ecc71; }
.waystone-icon { font-size: 28px; }
.waystone-info { flex: 1; }
.waystone-name { font-size: 15px; font-weight: bold; color: #ecf0f1; }
.waystone-desc { font-size: 11px; color: #888; }
.waystone-status { font-size: 18px; color: #888; }
.waystone-dest.cleared .waystone-status { color: #2ecc71; }

.waystone-close-btn {
  margin-top: 20px;
  padding: 10px 30px;
  font-size: 16px;
  background: linear-gradient(135deg, #555, #333);
  border: none; border-radius: 8px;
  color: #fff; cursor: pointer;
  pointer-events: auto;
}

/* Shop Panel */
#shop-panel {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 85;
  padding: 20px;
}
#shop-panel.hidden { display: none; }

.shop-header { text-align: center; margin-bottom: 20px; }
.shop-header h2 { font-size: 28px; color: #27ae60; margin-bottom: 4px; }
.shop-gold { font-size: 18px; color: #f1c40f; }

.shop-items {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 600px;
}

.shop-item {
  width: 160px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #555;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  pointer-events: auto;
}
.shop-item.available:hover { transform: scale(1.05); border-color: #27ae60; }
.shop-item.unavailable { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.shop-item-icon { font-size: 30px; margin-bottom: 6px; }
.shop-item-name { font-size: 14px; font-weight: bold; color: #ecf0f1; margin-bottom: 4px; }
.shop-item-desc { font-size: 11px; color: #aaa; margin-bottom: 6px; }
.shop-item-price { font-size: 13px; color: #f1c40f; font-weight: bold; }
.shop-item-owned { font-size: 10px; color: #888; margin-top: 4px; }

.shop-close-btn {
  margin-top: 20px;
  padding: 10px 30px;
  font-size: 16px;
  background: linear-gradient(135deg, #555, #333);
  border: none; border-radius: 8px;
  color: #fff; cursor: pointer;
  pointer-events: auto;
}

/* Intro Screen */
#intro-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, #0a0a20 0%, #000005 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
}
#intro-screen.hidden { display: none; }

.intro-text {
  font-size: 28px;
  color: #ecf0f1;
  text-align: center;
  max-width: 600px;
  line-height: 1.6;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
  padding: 0 20px;
}

.intro-hint {
  font-size: 14px;
  color: #666;
  margin-top: 40px;
  animation: introPulse 2s ease-in-out infinite;
}

@keyframes introPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Resource Bar */
#resource-bar-container {
  position: absolute;
  top: 38px;
  left: 12px;
  width: 180px;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #555;
  border-radius: 9px;
  overflow: hidden;
}

#resource-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #3498db, #3498db);
  transition: width 0.15s ease;
  border-radius: 7px;
}

#resource-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
}

/* Bump XP bar down */
#xp-bar-container {
  top: 60px !important;
}

/* Gold Display */
#gold-display {
  position: absolute;
  top: 78px;
  right: 12px;
  font-size: 15px;
  font-weight: bold;
  text-shadow: 2px 2px 4px #000;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 12px;
  border-radius: 8px;
  color: #f1c40f;
}

/* Skill Slots */
#skill-slots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.skill-slot {
  width: 52px;
  height: 52px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #666;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.slot-icon {
  font-size: 22px;
}

.slot-label {
  font-size: 9px;
  color: #888;
  font-weight: bold;
}

/* Skill Book Panel */
#skill-book-panel {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 85;
  overflow-y: auto;
  padding: 20px;
}
#skill-book-panel.hidden { display: none; }

.skillbook-header {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 16px; flex-wrap: wrap; justify-content: center;
}
.skillbook-header h2 { font-size: 24px; color: #f1c40f; text-shadow: 0 0 10px rgba(241,196,15,0.4); }
.skillbook-gold { font-size: 15px; color: #f1c40f; }
.skillbook-level { font-size: 15px; color: #ecf0f1; }
.skillbook-close-btn {
  padding: 6px 18px; font-size: 13px;
  background: linear-gradient(135deg, #555, #333);
  border: none; border-radius: 6px; color: #fff; cursor: pointer; pointer-events: auto;
}

.skillbook-list {
  display: flex; flex-direction: column; gap: 8px;
  max-width: 650px; width: 100%;
}

.skillbook-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid #333; border-radius: 8px;
}
.skillbook-row.unlearned { opacity: 0.6; }
.skillbook-icon { font-size: 28px; }
.skillbook-info { flex: 1; }
.skillbook-name { font-size: 14px; font-weight: bold; color: #ecf0f1; }
.skillbook-desc { font-size: 11px; color: #999; margin-top: 2px; }
.skillbook-stats { font-size: 10px; color: #777; margin-top: 2px; }
.skill-pip { color: #444; font-size: 8px; }
.skill-pip.filled { color: #f1c40f; }

.skillbook-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.skillbook-learn-btn {
  padding: 5px 10px; font-size: 11px; font-weight: bold;
  background: linear-gradient(135deg, #27ae60, #229954);
  border: none; border-radius: 6px; color: #fff; cursor: pointer; pointer-events: auto;
}
.skillbook-learn-btn.disabled {
  background: #444; color: #888; cursor: not-allowed; pointer-events: none;
}
.skillbook-equip-btn {
  padding: 4px 8px; font-size: 10px;
  background: linear-gradient(135deg, #2980b9, #3498db);
  border: none; border-radius: 5px; color: #fff; cursor: pointer; pointer-events: auto;
}
.skillbook-equip-btn.active { background: linear-gradient(135deg, #f39c12, #e67e22); }
.skillbook-maxed { font-size: 11px; color: #f1c40f; font-weight: bold; }

/* Inventory Panel (placeholder) */
#inventory-panel {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 85; padding: 20px;
}
#inventory-panel.hidden { display: none; }

/* ARPG cursor */
#game-canvas {
  cursor: none;
}
