: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'><g transform='rotate(60 16 16)'><rect x='13' y='18' width='6' height='22' fill='%23000'/><rect x='14' y='18' width='4' height='22' fill='%238B5A2B'/><rect x='17' y='18' width='1' height='22' fill='%236B3A1B'/><polygon points='0,14 4,10 28,10 32,14 28,18 4,18' fill='%23000'/><polygon points='2,14 5,11 27,11 30,14 27,17 5,17' fill='%23C0C0C0'/><rect x='7' y='12' width='10' height='1' fill='%23E8E8E8'/></g></svg>") 1 18, 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'><g transform='rotate(-15 16 16)'><rect x='13' y='18' width='6' height='22' fill='%23000'/><rect x='14' y='18' width='4' height='22' fill='%238B5A2B'/><rect x='17' y='18' width='1' height='22' fill='%236B3A1B'/><polygon points='0,14 4,10 28,10 32,14 28,18 4,18' fill='%23000'/><polygon points='2,14 5,11 27,11 30,14 27,17 5,17' fill='%23C0C0C0'/><rect x='7' y='12' width='10' height='1' fill='%23E8E8E8'/></g><rect x='2' y='14' width='2' height='2' fill='%23FFD700'/><rect x='6' y='18' width='2' height='2' fill='%23FFFFFF'/><rect x='4' y='22' width='2' height='2' fill='%23FFD700'/></svg>") 1 18, 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: 12px;
}
.warning-body-ja {
  font-size: 12px;
  opacity: 0.75;
  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; }
}

.ad-slot {
  margin: 36px auto 0;
  padding: 18px 0 8px;
  max-width: 728px;
  width: 100%;
  border-top: 1px solid rgba(233, 27, 137, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ad-slot-label {
  font-family: "Oswald", "Helvetica Neue", sans-serif;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: rgba(90, 90, 90, 0.55);
}
.ad-slot ins.adsbygoogle {
  width: 100%;
  min-height: 90px;
}

body.legal-page {
  background: #0b0b0b;
  color: #d9d9d9;
  padding: 0 20px 80px;
}
.legal-wrap {
  max-width: 820px;
  margin: 32px auto 0;
  padding: 32px 28px 56px;
  background: #141414;
  border: 1px solid rgba(233, 27, 137, 0.18);
  border-radius: 4px;
}
.legal-section {
  margin-bottom: 34px;
}
.legal-h2 {
  font-family: "Oswald", "Helvetica Neue", sans-serif;
  font-size: 16px;
  letter-spacing: 0.15em;
  color: #E91B89;
  text-transform: uppercase;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(233, 27, 137, 0.25);
}
.legal-section p {
  font-size: 14px;
  line-height: 1.85;
  margin: 0 0 10px;
  color: #cfcfcf;
}
.legal-list {
  margin: 8px 0 0;
  padding-left: 20px;
}
.legal-list li {
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 8px;
  color: #cfcfcf;
}
.legal-list li strong {
  color: #FFD700;
  font-weight: 600;
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.legal-table th,
.legal-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}
.legal-table th {
  width: 140px;
  color: #9a9a9a;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.legal-table td {
  color: #e5e5e5;
}
.legal-section a {
  color: #5BAADE;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-section a:hover {
  color: #E91B89;
}
.legal-back {
  margin-top: 32px;
  text-align: center;
}
.legal-back-link {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid rgba(233, 27, 137, 0.35);
  color: #E91B89;
  font-family: "Oswald", "Helvetica Neue", sans-serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.2s ease;
}
.legal-back-link:hover {
  background: rgba(233, 27, 137, 0.08);
  color: #fff;
}

.footer-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
