:root {
  --bg0: #080612;
  --emerald: #34d399;
  --pink: #f472b6;
  --violet: #c084fc;
  --cyan: #67e8f9;
  --text: #f6f0ff;
  --muted: #a89bb8;
  --line: rgba(192, 132, 252, 0.35);
  --glass: rgba(18, 10, 36, 0.78);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --spine: 56px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: "Sora", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(110% 70% at 0% 0%, rgba(52, 211, 153, 0.22), transparent 50%),
    radial-gradient(90% 60% at 100% 10%, rgba(244, 114, 182, 0.2), transparent 48%),
    radial-gradient(80% 50% at 50% 100%, rgba(192, 132, 252, 0.18), transparent 55%),
    linear-gradient(165deg, #080612, #12081f 48%, #0a0614);
  background-attachment: fixed;
}

#forge {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--spine)) calc(100px + var(--safe-b)) 16px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(244, 114, 182, 0.45));
}
.brand em {
  display: block;
  font-family: "Fraunces", serif;
  font-style: normal;
  font-weight: 700;
  font-size: 1.35rem;
  background: linear-gradient(90deg, #34d399, #c084fc, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.gear {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--glass);
  padding: 7px;
  cursor: pointer;
}
.gear img { width: 100%; height: 100%; object-fit: contain; }

.pane { animation: rise 0.28s ease; }
.pane.off { display: none; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 600;
}
h1 {
  margin: 0 0 8px;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.15;
}
.lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pulse-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(192, 132, 252, 0.16), rgba(244, 114, 182, 0.14));
  border: 1px solid rgba(244, 114, 182, 0.35);
  box-shadow: 0 0 28px rgba(192, 132, 252, 0.2);
  margin-bottom: 14px;
}
.pulse-art {
  width: 64px;
  height: 64px;
  object-fit: contain;
  animation: floaty 3.4s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.pulse-hero small { color: var(--muted); font-size: 0.75rem; }
.pulse-hero b {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1.85rem;
  margin: 2px 0 4px;
}
.soft { font-size: 0.8rem; color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  padding: 14px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
}
.stat small { color: var(--muted); font-size: 0.72rem; }
.stat b {
  display: block;
  margin-top: 4px;
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
}
.neon-emerald { border-color: rgba(52, 211, 153, 0.45); box-shadow: inset 0 0 16px rgba(52, 211, 153, 0.12); }
.neon-pink { border-color: rgba(244, 114, 182, 0.45); box-shadow: inset 0 0 16px rgba(244, 114, 182, 0.12); }
.neon-violet { border-color: rgba(192, 132, 252, 0.45); box-shadow: inset 0 0 16px rgba(192, 132, 252, 0.12); }
.neon-cyan { border-color: rgba(103, 232, 249, 0.4); box-shadow: inset 0 0 16px rgba(103, 232, 249, 0.1); }

.neon-btn, .ghost, .back, .chip {
  font: inherit;
  cursor: pointer;
  border-radius: 14px;
}
.neon-btn {
  border: 0;
  color: #1a0a24;
  font-weight: 700;
  padding: 12px 16px;
  background: linear-gradient(120deg, #34d399, #c084fc, #f472b6);
  background-size: 180% 180%;
  box-shadow: 0 0 20px rgba(192, 132, 252, 0.4);
  margin-bottom: 14px;
  animation: sheen 6s ease infinite;
}
.neon-btn.slim { margin: 0; padding: 10px 14px; }
@keyframes sheen {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 12px 16px;
}
.ghost.danger { border-color: rgba(244, 114, 182, 0.5); color: var(--pink); margin-top: 12px; width: 100%; }
.back {
  border: 0;
  background: transparent;
  color: var(--cyan);
  padding: 0 0 12px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  padding: 10px 12px;
  font-weight: 700;
}

.field { display: block; margin-bottom: 12px; }
.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}
.field em { font-style: normal; opacity: 0.7; }
.field input, .field select, .field textarea, .filter-row select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 6, 22, 0.9);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 2px rgba(244, 114, 182, 0.2);
}
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.row-actions .neon-btn { margin-bottom: 0; }
.filter-row { margin-bottom: 12px; }
.filter-row.twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}
.card .title { font-weight: 600; }
.card .meta { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }
.card .amt { font-family: "Fraunces", serif; font-weight: 700; color: var(--violet); }
.empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.timer-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.timer-card img { width: 56px; height: 56px; object-fit: contain; }
.timer-card small { color: var(--muted); font-size: 0.75rem; }
.timer-card b {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
  margin: 2px 0 8px;
}
.timer-row { display: flex; gap: 8px; align-items: center; }

.bars { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}
.bar-row .track {
  height: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bar-row .track > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #34d399, #c084fc, #f472b6);
}

.settings-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass);
}
.settings-card p { margin: 0 0 6px; font-weight: 600; }
.settings-card small { color: var(--muted); display: block; margin-bottom: 8px; }

/* Unique Loom Spine nav */
.loom-spine {
  position: fixed;
  z-index: 40;
  right: max(8px, calc(50% - 230px + 8px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 14px 8px;
}
.spine-rail {
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, #34d399, #c084fc, #f472b6);
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.55);
  z-index: 0;
}
.gem {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(192, 132, 252, 0.45);
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, rgba(52, 211, 153, 0.35), rgba(12, 8, 28, 0.95));
  padding: 7px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.2);
}
.gem img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gem.active {
  border-color: rgba(244, 114, 182, 0.75);
  box-shadow: 0 0 18px rgba(244, 114, 182, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(244, 114, 182, 0.4), rgba(16, 8, 32, 0.95));
}

.forge-orb {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  padding: 10px;
  background: radial-gradient(circle at 35% 30%, #f9a8d4, #a78bfa 45%, #34d399 100%);
  box-shadow:
    0 0 0 4px rgba(8, 6, 18, 0.85),
    0 0 28px rgba(244, 114, 182, 0.55),
    0 0 48px rgba(52, 211, 153, 0.35);
  animation: orb 2.8s ease-in-out infinite;
}
.forge-orb img { width: 100%; height: 100%; object-fit: contain; }
@keyframes orb {
  0%, 100% { box-shadow: 0 0 0 4px rgba(8, 6, 18, 0.85), 0 0 28px rgba(244, 114, 182, 0.55), 0 0 48px rgba(52, 211, 153, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(8, 6, 18, 0.85), 0 0 36px rgba(192, 132, 252, 0.75), 0 0 60px rgba(103, 232, 249, 0.4); }
}

@media (max-width: 380px) {
  #forge { padding-right: calc(12px + var(--spine)); }
  .gem { width: 44px; height: 44px; }
  h1 { font-size: 1.5rem; }
}
