:root {
  --bg-0: #080315;
  --bg-1: #130625;
  --panel: rgba(16, 20, 45, 0.65);
  --border: rgba(124, 106, 255, 0.35);
  --text: #eff3ff;
  --muted: #adb5d6;
  --neon-cyan: #00f5ff;
  --neon-pink: #ff4dd8;
  --neon-green: #47ffb5;
  --neon-red: #ff6b8c;
  --shadow-cyan: 0 0 12px rgba(0, 245, 255, 0.4), 0 0 30px rgba(0, 245, 255, 0.2);
  --shadow-pink: 0 0 12px rgba(255, 77, 216, 0.45), 0 0 30px rgba(255, 77, 216, 0.22);
}

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

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 20%, #20114f 0%, transparent 38%),
    radial-gradient(circle at 85% 10%, #381651 0%, transparent 42%),
    radial-gradient(circle at 45% 80%, #0d3c59 0%, transparent 45%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem 1rem 3rem;
}

.bg-orb {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  filter: blur(30px);
  z-index: -2;
  animation: drift 14s ease-in-out infinite alternate;
}

.orb-a {
  left: -5rem;
  top: 6rem;
  background: rgba(0, 245, 255, 0.22);
}

.orb-b {
  right: -3rem;
  top: 60vh;
  background: rgba(255, 77, 216, 0.24);
  animation-duration: 16s;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.015) 50%);
  background-size: 100% 3px;
  pointer-events: none;
}

.app {
  width: min(100%, 28rem);
  display: grid;
  gap: 1rem;
}

.hero {
  text-align: center;
  padding: 0.25rem 0.75rem;
}

.hero-kicker {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan);
}

.hero h1 {
  margin-top: 0.35rem;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.55rem, 4.6vw, 2rem);
  text-transform: uppercase;
  line-height: 1.15;
  text-shadow: var(--shadow-pink);
}

.hero-subtitle {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(6, 6, 22, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.balance-card {
  text-align: center;
}

.balance-card p {
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#balance {
  margin-top: 0.35rem;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan);
}

#balance.negative {
  color: #ff90a9;
  text-shadow: 0 0 10px rgba(255, 107, 140, 0.5), 0 0 30px rgba(255, 107, 140, 0.2);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.summary-card p {
  color: var(--muted);
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-card span {
  display: block;
  margin-top: 0.35rem;
  font-family: "Orbitron", sans-serif;
  font-size: 1.15rem;
  word-break: break-word;
}

.income-card span {
  color: var(--neon-green);
  text-shadow: 0 0 12px rgba(71, 255, 181, 0.3);
}

.expense-card span {
  color: var(--neon-red);
  text-shadow: 0 0 12px rgba(255, 107, 140, 0.35);
}

.form-card h3,
.history-card h3 {
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

.input-stack {
  display: grid;
  gap: 0.5rem;
}

.input-stack label {
  color: var(--muted);
  font-size: 0.85rem;
}

input,
select,
button {
  width: 100%;
  border-radius: 0.7rem;
  border: 1px solid rgba(154, 142, 255, 0.35);
  font: inherit;
}

input,
select {
  padding: 0.65rem 0.75rem;
  background: rgba(11, 15, 36, 0.8);
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: #8f96bb;
}

input:focus,
select:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.2);
}

button {
  padding: 0.66rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

#addBtn {
  margin-top: 0.28rem;
  color: #041522;
  background: linear-gradient(135deg, #00f5ff, #00f0a4);
  border-color: rgba(0, 245, 255, 0.8);
  box-shadow: var(--shadow-cyan);
}

#clearBtn {
  color: #fff2fc;
  background: linear-gradient(135deg, #d938ff, #ff4dd8);
  border-color: rgba(255, 77, 216, 0.7);
  box-shadow: var(--shadow-pink);
}

#addBtn:hover,
#clearBtn:hover {
  transform: translateY(-1px);
  filter: saturate(1.07);
}

#addBtn:active,
#clearBtn:active {
  transform: translateY(0);
}

.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

#recordCount {
  font-size: 0.76rem;
  color: var(--muted);
}

#transactionList {
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.62rem 0.72rem;
  border-radius: 0.75rem;
  background: rgba(7, 11, 29, 0.9);
  border: 1px solid rgba(119, 127, 178, 0.3);
}

.tx-item.income {
  border-left: 4px solid var(--neon-green);
}

.tx-item.expense {
  border-left: 4px solid var(--neon-red);
}

.tx-title {
  flex: 1;
  font-weight: 500;
  word-break: break-word;
}

.tx-amount {
  font-family: "Orbitron", sans-serif;
  font-size: 0.9rem;
  white-space: nowrap;
}

.tx-item.income .tx-amount {
  color: var(--neon-green);
}

.tx-item.expense .tx-amount {
  color: var(--neon-red);
}

.delete-btn {
  width: auto;
  min-width: 2rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 0.78rem;
}

.delete-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.empty-state {
  text-align: center;
  padding: 1rem 0.75rem;
  border: 1px dashed rgba(179, 188, 232, 0.35);
  border-radius: 0.72rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes drift {
  from {
    transform: translateY(-20px) translateX(-12px);
  }
  to {
    transform: translateY(16px) translateX(14px);
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem 2.5rem;
  }

  .card {
    padding: 0.85rem;
  }
}
