/* VOID FORGE — retro-futuristic incremental aesthetic */

:root {
  --void: #050508;
  --void-deep: #0a0a12;
  --surface: #12121c;
  --surface-raised: #1a1a28;
  --border: #2a2a3e;
  --border-glow: #3d3d5c;

  --shard: #00f0d4;
  --shard-dim: #00a896;
  --shard-glow: rgba(0, 240, 212, 0.35);

  --paradox: #ff6b9d;
  --paradox-glow: rgba(255, 107, 157, 0.35);

  --amber: #ffb347;
  --text: #e8e6f0;
  --text-dim: #8a8799;

  --font-display: 'Syne', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 4px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-mono);
  background: var(--void);
  color: var(--text);
  overflow-x: hidden;
  cursor: crosshair;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  opacity: 0.4;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── HUD ── */

.hud {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, rgba(10, 10, 18, 0.95) 0%, rgba(5, 5, 8, 0.85) 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-glyph {
  font-size: 2rem;
  color: var(--shard);
  text-shadow: 0 0 20px var(--shard-glow);
  animation: pulse-glyph 3s ease-in-out infinite;
}

@keyframes pulse-glyph {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

.hud-brand h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  line-height: 1.1;
}

.tagline {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-stats {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  justify-content: center;
}

.stat-block {
  text-align: center;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--surface);
  min-width: 140px;
}

.stat-block.primary {
  border-color: var(--shard-dim);
  box-shadow: inset 0 0 30px rgba(0, 240, 212, 0.05);
}

.stat-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--shard);
  text-shadow: 0 0 15px var(--shard-glow);
  font-variant-numeric: tabular-nums;
}

.stat-value.paradox {
  color: var(--paradox);
  text-shadow: 0 0 15px var(--paradox-glow);
}

.stat-rate {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.hud-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Layout ── */

.layout {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  min-height: calc(100vh - 80px);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ── Forge Panel ── */

.forge-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  padding: 2rem;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

@media (max-width: 900px) {
  .forge-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 380px;
  }
}

.forge-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
  pointer-events: none;
}

.ring-outer {
  width: 340px;
  height: 340px;
  border-color: rgba(0, 240, 212, 0.08);
  animation: spin-slow 40s linear infinite;
}

.ring-mid {
  width: 260px;
  height: 260px;
  border-color: rgba(255, 107, 157, 0.12);
  border-style: dashed;
  animation: spin-slow 25s linear infinite reverse;
}

.ring-inner {
  width: 180px;
  height: 180px;
  border-color: rgba(255, 179, 71, 0.15);
  animation: spin-slow 15s linear infinite;
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

.forge-core {
  position: relative;
  z-index: 5;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--shard);
  background: radial-gradient(circle at 35% 35%, #1a2830 0%, var(--void-deep) 60%, var(--void) 100%);
  color: var(--shard);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow:
    0 0 40px var(--shard-glow),
    inset 0 0 30px rgba(0, 240, 212, 0.08);
  font-family: var(--font-display);
}

.forge-core:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 60px var(--shard-glow),
    0 0 100px rgba(0, 240, 212, 0.15),
    inset 0 0 40px rgba(0, 240, 212, 0.12);
}

.forge-core:active {
  transform: scale(0.92);
  border-color: var(--amber);
  box-shadow:
    0 0 80px rgba(255, 179, 71, 0.4),
    inset 0 0 50px rgba(255, 179, 71, 0.15);
}

.forge-core.clicked {
  animation: core-flash 0.15s ease-out;
}

@keyframes core-flash {
  0% { filter: brightness(2); }
  100% { filter: brightness(1); }
}

.core-icon {
  font-size: 2rem;
  line-height: 1;
}

.core-label {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.core-power {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--amber);
  opacity: 0.9;
}

.forge-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-num {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--shard);
  text-shadow: 0 0 10px var(--shard-glow);
  pointer-events: none;
  animation: float-up 0.9s ease-out forwards;
  z-index: 20;
}

.float-num.crit {
  color: var(--amber);
  font-size: 1.4rem;
  text-shadow: 0 0 15px rgba(255, 179, 71, 0.6);
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-80px) scale(0.6);
  }
}

.milestone-track {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.milestone {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface);
  transition: all var(--transition);
}

.milestone.unlocked {
  border-color: var(--shard-dim);
  color: var(--shard);
  box-shadow: 0 0 10px var(--shard-glow);
}

/* ── Shop Panel ── */

.shop-panel {
  display: flex;
  flex-direction: column;
  background: var(--void-deep);
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tab {
  flex: 1;
  padding: 0.85rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--shard);
  border-bottom-color: var(--shard);
  background: rgba(0, 240, 212, 0.04);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.tab-content.active {
  display: block;
}

.panel-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  line-height: 1.5;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shop-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--transition);
  cursor: default;
}

.shop-item.affordable {
  border-color: var(--shard-dim);
  cursor: pointer;
}

.shop-item.affordable:hover {
  background: var(--surface-raised);
  box-shadow: 0 0 20px rgba(0, 240, 212, 0.08);
  transform: translateX(2px);
}

.shop-item.owned-max {
  opacity: 0.5;
  border-color: var(--border);
}

.shop-item.locked {
  opacity: 0.35;
  filter: grayscale(0.5);
}

.item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid var(--border-glow);
  background: var(--void-deep);
}

.item-info h4 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.item-info p {
  font-size: 0.6rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.item-meta {
  text-align: right;
  min-width: 80px;
}

.item-cost {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--shard);
}

.item-cost.expensive {
  color: var(--text-dim);
}

.item-cost.paradox-cost {
  color: var(--paradox);
}

.item-owned {
  font-size: 0.55rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* ── Ascension ── */

.ascension-hero {
  text-align: center;
}

.ascension-hero h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--paradox);
  margin-bottom: 0.5rem;
}

.ascension-hero > p {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.ascension-preview {
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 1rem;
  text-align: left;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  font-size: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.preview-row:last-child {
  border-bottom: none;
}

.preview-row.highlight {
  background: rgba(255, 107, 157, 0.06);
  color: var(--paradox);
  font-weight: 500;
}

.preview-row.highlight span:last-child {
  font-family: var(--font-display);
  font-weight: 800;
}

.paradox-shop {
  margin-top: 1.5rem;
  text-align: left;
}

.paradox-shop h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Buttons ── */

.btn {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn:hover:not(:disabled) {
  border-color: var(--shard-dim);
  color: var(--shard);
}

.btn.ghost {
  background: transparent;
}

.btn.danger:hover:not(:disabled) {
  border-color: #ff4444;
  color: #ff4444;
}

.btn.ascension {
  width: 100%;
  padding: 0.85rem;
  border-color: var(--paradox);
  color: var(--paradox);
  background: rgba(255, 107, 157, 0.08);
  font-size: 0.75rem;
}

.btn.ascension:hover:not(:disabled) {
  background: rgba(255, 107, 157, 0.15);
  box-shadow: 0 0 30px var(--paradox-glow);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Event Log ── */

.event-log {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 10;
  width: 260px;
  max-height: 160px;
  background: rgba(10, 10, 18, 0.9);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  overflow: hidden;
  pointer-events: none;
}

@media (max-width: 900px) {
  .event-log {
    display: none;
  }
}

.log-header {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

#log-entries {
  list-style: none;
  padding: 0.4rem 0.6rem;
  overflow-y: auto;
  max-height: 120px;
}

#log-entries li {
  font-size: 0.55rem;
  color: var(--text-dim);
  padding: 0.15rem 0;
  line-height: 1.4;
  animation: log-in 0.3s ease-out;
}

#log-entries li.highlight {
  color: var(--shard);
}

@keyframes log-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Toasts ── */

.toast-zone {
  position: fixed;
  top: 5rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.6rem 1rem;
  border: 1px solid var(--shard-dim);
  background: rgba(10, 10, 18, 0.95);
  font-size: 0.65rem;
  color: var(--shard);
  animation: toast-in 0.3s ease-out, toast-out 0.3s ease-in 2.7s forwards;
  backdrop-filter: blur(8px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Scrollbar ── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--void);
}

::-webkit-scrollbar-thumb {
  background: var(--border-glow);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--shard-dim);
}
