/* ============================================================================
   ASH OF LIGHT (Namakemono 2.0) — 16:9 WebGL2 Stage, Fantasy HUD & Reward Modal
   ============================================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #243114 0%, #11180b 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #f8f2e4;
}

#status {
  position: fixed;
  top: 14px;
  right: 16px;
  background: rgba(24, 18, 14, 0.88);
  color: #f7dfa6;
  padding: 9px 14px;
  z-index: 9999;
  font-family: Georgia, serif;
  font-size: 13px;
  border: 1px solid rgba(232, 168, 56, 0.65);
  border-radius: 8px;
}

.aol-root {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.aol-stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  overflow: hidden;
  background: #18210f;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.65);
}

#ash-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ── Top-Left Hearts ──────────────────────────────────────────────────────── */

.aol-hearts {
  position: absolute;
  top: 16px;
  left: 18px;
  display: flex;
  gap: 6px;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.aol-heart-svg {
  width: 26px;
  height: 24px;
}

/* ── Top-Center Checkpoint Toast ──────────────────────────────────────────── */

.aol-toast {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Marcellus', 'Cinzel', Georgia, serif;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: #fcf7e8;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 14px rgba(255, 224, 130, 0.35);
  pointer-events: none;
  z-index: 12;
  padding: 4px 16px;
  white-space: nowrap;
}

/* ── Top-Right Zone Title, Coins & Editor Toggles ─────────────────────────── */

.aol-top-right {
  position: absolute;
  top: 14px;
  right: 18px;
  text-align: right;
  z-index: 14;
}

.aol-zone-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #f7f0df;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.78);
  pointer-events: none;
}

.aol-bgm-pill {
  margin-top: 2px;
  font-family: 'Marcellus', Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #f2da95;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  opacity: 0.92;
  pointer-events: none;
}

.aol-meta-row {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.aol-chapter-row {
  flex-wrap: wrap;
  max-width: 245px;
  margin-left: auto;
}

.aol-coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(18, 24, 16, 0.62);
  border: 1px solid rgba(242, 206, 118, 0.38);
  font-size: 12px;
  font-weight: 700;
  color: #ffe388;
}

.aol-coin-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff5a8, #e6a825);
  border: 1px solid #754b0e;
}

.aol-mini-btn {
  height: 22px;
  min-width: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(255, 244, 214, 0.28);
  background: rgba(18, 26, 22, 0.72);
  color: #f5eedb;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aol-mini-btn:hover {
  background: rgba(34, 48, 38, 0.9);
  border-color: #ffe066;
}

.aol-mini-wide {
  padding: 0 8px;
  font-family: 'Inter', sans-serif;
  color: #ffe8a6;
}

.aol-mini-btn.active {
  background: rgba(224, 172, 63, 0.32);
  border-color: #ffe066;
  color: #fff6cf;
}

/* ── Bottom-Left Weapon & Item Slots ──────────────────────────────────────── */

.aol-bottom-left {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.aol-weapon-wrap {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.aol-item-row {
  display: flex;
  gap: 8px;
}

.aol-slot {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 6px;
  border: 1.5px solid rgba(176, 212, 232, 0.55);
  background: linear-gradient(180deg, rgba(20, 32, 42, 0.82), rgba(12, 20, 28, 0.88));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #f6efe0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.aol-slot:hover {
  transform: translateY(-1px);
  border-color: #ffe285;
}

.aol-slot:active {
  transform: scale(0.95);
}

.aol-slot-weapon {
  width: 56px;
  height: 56px;
  border-color: rgba(162, 214, 245, 0.78);
}

.aol-slot-empty {
  opacity: 0.62;
  border-color: rgba(160, 184, 198, 0.34);
}

.aol-slot.equipped {
  opacity: 1;
  border-color: #ffd859;
  box-shadow: 0 0 14px rgba(255, 214, 88, 0.45), inset 0 0 10px rgba(102, 196, 255, 0.25);
}

.aol-sub-weapon {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  border: 1px solid rgba(160, 192, 210, 0.35);
  background: rgba(14, 22, 30, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.78;
  pointer-events: none;
}

.aol-key-tag {
  position: absolute;
  top: -6px;
  left: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 4px;
  background: #233c54;
  border: 1px solid #8cc7f0;
  color: #eef7ff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.aol-key-gold {
  background: #473210;
  border-color: #f7c948;
  color: #fff2b2;
}

.aol-slot-count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #f7f1e0;
  text-shadow: 0 1px 3px #000;
}

.aol-swap-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1d2f40;
  border: 1px solid #96cdf0;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e8f5ff;
}

.aol-charm-mini {
  width: 32px;
  height: 36px;
  image-rendering: pixelated;
}

/* ── Bottom-Center KING JELLY Boss Bar ────────────────────────────────────── */

.aol-boss-hud {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 52%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 11;
}

.aol-boss-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #fff9e6;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.65);
}

.aol-boss-bar-frame {
  position: relative;
  width: 100%;
  height: 18px;
  background: #231921;
  border: 3px solid #140f14;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.aol-boss-bar-trail {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: #f5dfbe;
}

.aol-boss-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(180deg, #ef4958 0%, #c92638 100%);
}

.aol-boss-diamonds {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.aol-diamond {
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: #241c24;
  border: 2px solid #110d12;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.aol-diamond.lit {
  background: linear-gradient(135deg, #fff1a6, #e8a427);
  border-color: #4f2c0b;
  box-shadow: 0 0 10px rgba(255, 206, 80, 0.78);
}

/* ── Bottom-Right Skill Diamond ───────────────────────────────────────────── */

.aol-bottom-right {
  position: absolute;
  bottom: 16px;
  right: 18px;
  z-index: 10;
}

.aol-skill-diamond {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.aol-skill-top {
  width: 50px;
  height: 50px;
  border-color: rgba(255, 218, 102, 0.45);
}

.aol-skill-top.ready {
  border-color: #ffe066;
  box-shadow: 0 0 16px rgba(255, 214, 72, 0.55), inset 0 0 12px rgba(255, 224, 102, 0.22);
}

.aol-skill-top.dim {
  opacity: 0.46;
}

.aol-star-cost {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #ffe37a;
  text-shadow: 0 1px 2px #000;
}

.aol-skill-mid-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aol-skill-side {
  width: 40px;
  height: 40px;
  opacity: 0.85;
}

.aol-mini-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #dcebf5;
}

.aol-dash-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1.5px solid rgba(154, 202, 232, 0.55);
  background: rgba(16, 28, 38, 0.84);
  color: #e6f4ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

/* ── Controls Help Card ───────────────────────────────────────────────────── */

.aol-help-card {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(16, 24, 16, 0.72);
  border: 1px solid rgba(255, 234, 175, 0.25);
  backdrop-filter: blur(4px);
  font-size: 11px;
  line-height: 1.48;
  color: #ece3cf;
  text-align: center;
  pointer-events: none;
  z-index: 9;
  white-space: nowrap;
}

.aol-help-card strong {
  color: #ffe285;
}

/* ── Blurred Victory Reward Modal (JELLY CHARM) ───────────────────────────── */

.aol-reward-modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 30, 16, 0.42);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
}

.aol-reward-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 36px;
}

.aol-reward-icon {
  width: 96px;
  height: 108px;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.aol-reward-title {
  margin-top: 14px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: #fcf4df;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.75);
}

.aol-reward-divider {
  width: 210px;
  height: 1.5px;
  margin: 12px 0;
  background: linear-gradient(90deg, transparent, #e0ac3f, transparent);
}

.aol-reward-sub {
  font-family: 'Marcellus', Georgia, serif;
  font-size: 14px;
  color: rgba(246, 238, 220, 0.86);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
}

.aol-reward-actions {
  margin-top: 26px;
  display: flex;
  gap: 12px;
}

.aol-btn-primary, .aol-btn-secondary {
  padding: 10px 20px;
  border-radius: 6px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.aol-btn-primary {
  background: linear-gradient(180deg, #e8b849, #b57c1c);
  border: 1.5px solid #fff0b3;
  color: #1f1406;
}

.aol-btn-secondary {
  background: rgba(22, 30, 24, 0.76);
  border: 1.5px solid rgba(245, 224, 170, 0.55);
  color: #f6ecd4;
}

/* ── Touch Joystick (Mobile/Tablet Only) ──────────────────────────────────── */

.aol-touch-zone {
  display: none;
  position: absolute;
  bottom: 132px;
  left: 20px;
  z-index: 15;
}

.aol-stick-base {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(16, 24, 18, 0.45);
  border: 2px solid rgba(255, 232, 165, 0.35);
  position: relative;
  touch-action: none;
}

.aol-stick-knob {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, #c9963b);
  border: 2px solid #2b1d12;
  position: absolute;
  top: 27px;
  left: 27px;
  pointer-events: none;
}

@media (pointer: coarse) {
  .aol-touch-zone { display: block; }
  .aol-help-card { display: none; }
}
