:root {
  --pink: #E91B89;
  --purple: #7B37A8;
  --blue: #5BAADE;
  --gold: #FFD700;
  --ink: #1A1A1A;
  --ink-2: #2C2C2C;
  --text: #EDEDED;
  --text-dim: #9A9A9A;
  --font-head: 'Oswald', 'Zen Kaku Gothic New', system-ui, sans-serif;
  --font-body: 'Inter', 'Zen Kaku Gothic New', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;
}

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

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.brand-header {
  width: 100%;
  max-width: 720px;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--ink-2);
  text-align: center;
}
.brand-mark {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--pink);
  text-transform: uppercase;
}
.brand-title {
  font-family: var(--font-head);
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 6px;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
}

.stage {
  width: 100%;
  max-width: 760px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hud {
  background: var(--ink-2);
  border-left: 3px solid var(--pink);
  padding: 14px 18px;
}
.hud-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.hud-sub { margin-top: 6px; flex-wrap: wrap; }
.hud-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--text-dim);
}
.hud-value {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}
.hud-value-sm {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hud-divider {
  width: 1px; height: 14px; background: var(--text-dim); opacity: 0.5;
}

.mine-wrap {
  position: relative;
  background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%);
  border: 1px solid var(--ink-2);
  aspect-ratio: 1 / 1;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' shape-rendering='crispEdges'><polygon points='8,0 16,8 8,16 0,8' fill='%23000'/><polygon points='8,2 14,8 8,14 2,8' fill='%23B0B0B0'/><polygon points='8,3 11,6 8,9 5,6' fill='%23EEEEEE'/><rect x='12' y='10' width='2' height='2' fill='%23000'/><rect x='14' y='12' width='2' height='2' fill='%23000'/><rect x='16' y='14' width='2' height='2' fill='%23000'/><rect x='18' y='16' width='2' height='2' fill='%23000'/><rect x='20' y='18' width='2' height='2' fill='%23000'/><rect x='22' y='20' width='2' height='2' fill='%23000'/><rect x='24' y='22' width='2' height='2' fill='%23000'/><rect x='26' y='24' width='2' height='2' fill='%23000'/><rect x='28' y='26' width='2' height='2' fill='%23000'/><rect x='14' y='10' width='2' height='2' fill='%238B5A2B'/><rect x='16' y='12' width='2' height='2' fill='%238B5A2B'/><rect x='18' y='14' width='2' height='2' fill='%238B5A2B'/><rect x='20' y='16' width='2' height='2' fill='%238B5A2B'/><rect x='22' y='18' width='2' height='2' fill='%238B5A2B'/><rect x='24' y='20' width='2' height='2' fill='%238B5A2B'/><rect x='26' y='22' width='2' height='2' fill='%238B5A2B'/><rect x='28' y='24' width='2' height='2' fill='%236B3A1B'/></svg>") 8 8, crosshair;
  user-select: none;
  touch-action: manipulation;
}
.mine-wrap #mine { cursor: inherit; }
.mine-wrap.striking {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' shape-rendering='crispEdges'><polygon points='8,0 16,8 8,16 0,8' fill='%23000'/><polygon points='8,2 14,8 8,14 2,8' fill='%23B0B0B0'/><polygon points='8,3 11,6 8,9 5,6' fill='%23EEEEEE'/><rect x='10' y='12' width='2' height='2' fill='%23000'/><rect x='10' y='14' width='2' height='2' fill='%23000'/><rect x='10' y='16' width='2' height='2' fill='%23000'/><rect x='10' y='18' width='2' height='2' fill='%23000'/><rect x='10' y='20' width='2' height='2' fill='%23000'/><rect x='10' y='22' width='2' height='2' fill='%23000'/><rect x='10' y='24' width='2' height='2' fill='%23000'/><rect x='10' y='26' width='2' height='2' fill='%23000'/><rect x='10' y='28' width='2' height='2' fill='%23000'/><rect x='12' y='12' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='14' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='16' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='18' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='20' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='22' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='24' width='2' height='2' fill='%238B5A2B'/><rect x='12' y='26' width='2' height='2' fill='%236B3A1B'/><rect x='16' y='4' width='2' height='2' fill='%23FFD700'/><rect x='0' y='4' width='2' height='2' fill='%23FFD700'/><rect x='14' y='12' width='2' height='2' fill='%23FFFFFF'/></svg>") 8 8, crosshair;
}
#mine {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}
.mine-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--pink);
  pointer-events: none;
  animation: pulse 1.8s ease-in-out infinite;
}
.mine-hint.hidden { display: none; }
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Depth bar */
.depth-bar {
  background: var(--ink-2);
  border-left: 3px solid var(--blue);
  padding: 10px 16px 12px;
}
.depth-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}
.depth-left, .depth-right {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.depth-value {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.depth-theme-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  background: var(--ink);
  padding: 2px 6px;
}
.depth-progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.depth-track {
  width: 100%;
  height: 4px;
  background: var(--ink);
  overflow: hidden;
  position: relative;
}
.depth-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--pink));
  transition: width 0.3s ease-out;
  width: 0%;
}

/* Bonuses panel */
.bonuses {
  background: var(--ink-2);
  border-left: 3px solid var(--purple);
  padding: 10px 16px 12px;
}
.bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 14px;
  margin-top: 6px;
}
.bonus-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.bonus-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
.bonus-value {
  font-family: var(--font-head);
  font-size: 16px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
@media (max-width: 480px) {
  .bonus-grid { grid-template-columns: repeat(2, 1fr); }
}

.pyramid-wrap {
  background: linear-gradient(180deg, #0b0b0b 0%, #1a1a1a 100%);
  border: 1px solid var(--ink-2);
  padding: 14px 18px 12px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--pink);
  margin-bottom: 8px;
}
#pyramid {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}
.pyramid-note {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-top: 6px;
  text-align: right;
}

.shop {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.shop-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  padding: 4px 0;
}
.shop-tier-label {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--purple);
  padding: 8px 0 2px;
  border-top: 1px dashed var(--ink-2);
}
.shop-tier-label:first-child { border-top: none; padding-top: 0; }
.shop-item {
  background: var(--ink-2);
  border: 1px solid transparent;
  border-left: 3px solid var(--purple);
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
  font-family: var(--font-body);
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  transition: all 0.15s;
}
.shop-item:hover:not(:disabled) {
  border-left-color: var(--pink);
  background: #333;
}
.shop-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.shop-item.affordable {
  border-left-color: var(--gold);
}
.shop-item.new-unlock {
  animation: newUnlockPulse 2s ease-out 3;
}
@keyframes newUnlockPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233, 27, 137, 0); }
  50% { box-shadow: 0 0 0 4px rgba(233, 27, 137, 0.4); }
}
.shop-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--pink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  padding: 2px 5px;
  border-radius: 2px;
}
.shop-item { position: relative; }

.unlock-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--ink-2);
  border-left: 3px solid var(--pink);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  padding: 12px 20px;
  z-index: 50;
  opacity: 0;
  transition: all 0.4s ease-out;
  pointer-events: none;
  white-space: nowrap;
}
.unlock-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.unlock-toast strong {
  color: var(--pink);
  margin-right: 8px;
}
.shop-name {
  font-family: var(--font-head);
  font-size: 14px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.shop-desc {
  font-size: 10px;
  color: var(--text-dim);
  grid-column: 1 / 2;
}
.shop-cost {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold);
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  text-align: right;
}
.shop-owned {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  text-align: right;
}

.brand-footer {
  width: 100%;
  max-width: 720px;
  padding: 16px 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--ink-2);
  margin-top: auto;
}
.credit {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--text-dim);
}
.footer-actions {
  display: flex;
  gap: 8px;
}
.reset-btn {
  background: transparent;
  border: 1px solid var(--ink-2);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  padding: 6px 12px;
  cursor: pointer;
}
.reset-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
}

/* Achievement toast */
.ach-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--ink-2);
  border-left: 3px solid var(--gold);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 12px 18px;
  z-index: 60;
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.3s ease-out;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  max-width: 280px;
}
.ach-toast.show { opacity: 1; transform: translateX(0); }
.ach-toast strong {
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.25em;
}
.ach-toast-name {
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.05em;
}
.ach-toast-bonus {
  font-size: 9px;
  color: var(--pink);
  letter-spacing: 0.15em;
}

/* Achievement modal */
.ach-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
  overflow-y: auto;
}
.ach-modal.hidden { display: none; }
.ach-modal-box {
  background: var(--ink-2);
  border-left: 3px solid var(--gold);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.ach-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  border-bottom: 1px solid #222;
  padding-bottom: 14px;
}
.ach-modal-title {
  font-family: var(--font-head);
  font-size: 24px;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-top: 4px;
}
.ach-close {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  padding: 8px 14px;
  cursor: pointer;
}
.ach-close:hover { border-color: var(--pink); color: var(--pink); }

.ach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ach-cat-label {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--purple);
  padding: 12px 0 4px;
  border-top: 1px dashed #222;
}
.ach-cat-label:first-child { border-top: none; padding-top: 4px; }
.ach-item {
  background: var(--ink);
  border-left: 2px solid #333;
  padding: 10px 12px;
  opacity: 0.5;
}
.ach-item.unlocked {
  opacity: 1;
  border-left-color: var(--gold);
}
.ach-item.secret {
  border-left-color: var(--purple);
  opacity: 0.45;
}
.ach-name {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
}
.ach-desc {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}
.ach-bonus {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--pink);
  margin-top: 4px;
  letter-spacing: 0.1em;
}
.ach-item:not(.unlocked) .ach-bonus { color: #555; }

@media (max-width: 480px) {
  .ach-grid { grid-template-columns: 1fr; }
  .ach-toast { right: 10px; left: 10px; min-width: 0; }
}

/* Photosensitivity warning modal */
.warning-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.warning-modal.hidden { display: none; }
.warning-box {
  background: var(--ink-2);
  border-left: 3px solid var(--pink);
  max-width: 420px;
  padding: 28px 24px;
}
.warning-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--pink);
}
.warning-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 14px;
  letter-spacing: 0.05em;
}
.warning-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.warning-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.warning-btn {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.warning-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
}
.warning-btn-primary {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}
.warning-btn-primary:hover {
  background: transparent;
  color: var(--pink);
}

@media (max-width: 480px) {
  .shop { grid-template-columns: 1fr; }
  .brand-title { font-size: 28px; }
}
