:root {
  --bg: #f1f2f6;
  --card: #ffffff;
  --ink: #333333;
  --muted: #747d8c;
  --green: #2ecc71;
  --green-dark: #1abc9c;
  --price-green: #24c486;
  --sell-red: #f53b57;
  --disabled-bg: #f1f2f6;
  --disabled-text: #333333;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible, input:focus-visible {
  outline: 2px solid #2ecc71;
  outline-offset: 2px;
}

/* Top neal.fun style bar */
.nav {
  background: #ffffff;
  width: 100%;
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.neal-logo {
  text-decoration: none;
  color: #111111;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.4px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.neal-star {
  color: #f59e0b;
  font-size: 19px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.how {
  background: #f1f2f6;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  padding: 7px 13px;
}

.how:hover {
  background: #e4e6ed;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 12px;
}

/* White Hero Card with Portrait + Title — exact neal.fun/spend look */
.hero {
  background: #ffffff;
  text-align: center;
  padding: 34px 20px 28px;
  margin-bottom: 10px;
}

.tycoon-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.tycoon-avatar svg {
  border-radius: 50%;
  display: block;
}

.hero h1 {
  font-size: clamp(28px, 4.5vw, 34px);
  font-weight: 700;
  color: #333333;
  margin: 0;
  letter-spacing: -0.4px;
}

.hero-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Sticky Green Money Bar — exact neal.fun/spend look */
.wallet {
  background: linear-gradient(180deg, #2ecc71 0%, #1abc9c 100%);
  color: #ffffff;
  padding: 20px;
  margin: 10px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wallet-side {
  display: flex;
  justify-content: center;
  align-items: center;
}

#balance {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

/* 3-Column Product Grid — exact neal.fun/spend layout */
.catalog {
  padding: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product {
  background: #ffffff;
  text-align: center;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.art {
  height: 135px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.art img {
  max-width: 100%;
  max-height: 125px;
  object-fit: contain;
  transition: transform 0.18s ease;
}

.product:hover .art img {
  transform: scale(1.04);
}

.product-body {
  display: flex;
  flex-direction: column;
}

.product h3 {
  font-size: 22px;
  font-weight: 700;
  color: #333333;
  margin: 0 0 6px;
  line-height: 1.25;
}

.price {
  color: var(--price-green);
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 22px;
}

/* 3-Column Controls: Pink/Red Sell | Input | Green Buy */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.controls button {
  border: none;
  padding: 10px 8px;
  border-radius: 3px;
  font-size: 16px;
  font-weight: 700;
  transition: opacity 0.12s, transform 0.08s;
}

.controls button:active:not(:disabled) {
  transform: scale(0.97);
}

.sell {
  background: linear-gradient(180deg, #ff3f6c 0%, #f53b57 100%);
  color: #ffffff;
}

.sell:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: default;
}

.buy {
  background: linear-gradient(180deg, #2ecc71 0%, #1abc9c 100%);
  color: #ffffff;
}

.buy:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: default;
}

.qty {
  width: 100%;
  border: 1px solid #b2bec3;
  background: #ffffff;
  color: #333333;
  text-align: center;
  border-radius: 3px;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 4px;
  min-width: 0;
  -moz-appearance: textfield;
}

.qty::-webkit-outer-spin-button,
.qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Your Receipt Section — exact neal.fun/spend look */
.receipt-section {
  margin: 10px 0 36px;
}

.receipt {
  background: #ffffff;
  max-width: 100%;
  margin: 0 auto;
  padding: 28px 24px 32px;
  text-align: center;
}

.receipt-title {
  font-size: 28px;
  font-weight: 700;
  color: #333333;
  margin: 0 0 20px;
}

.receipt-rows {
  max-width: 340px;
  margin: 0 auto;
  text-align: left;
}

.empty {
  text-align: center;
  font-size: 16px;
  color: var(--muted);
  margin: 12px 0;
}

.receipt-line {
  display: grid;
  grid-template-columns: 170px 55px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 18px;
  margin-bottom: 8px;
  color: #333333;
}

.r-name {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.r-qty {
  text-align: left;
  font-weight: 500;
  color: #555555;
}

.r-cost {
  text-align: right;
  font-weight: 700;
  color: var(--price-green);
}

.receipt-divider {
  max-width: 340px;
  margin: 14px auto;
  border-top: 1px solid #333333;
}

.receipt-total {
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  color: #333333;
}

.receipt-total strong {
  color: var(--price-green);
  font-size: 20px;
}

.receipt-cta {
  max-width: 340px;
  margin: 24px auto 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.print, .copy, .restart-inline {
  border: 1px solid #dfe4ea;
  background: #f1f2f6;
  color: #333333;
  border-radius: 4px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
}

.print:hover, .copy:hover, .restart-inline:hover {
  background: #e2e6ee;
}

footer {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 14px 40px;
  color: var(--muted);
  font-size: 13px;
}

footer a {
  color: #333333;
  font-weight: 600;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

dialog {
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  max-width: 430px;
  width: calc(100% - 32px);
  padding: 28px;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog h2 {
  font-size: 24px;
  margin: 0 26px 14px 0;
}

dialog p {
  color: #555;
  line-height: 1.65;
  font-size: 15px;
}

dialog .print {
  width: 100%;
  margin-top: 12px;
  background: #2ecc71;
  color: #ffffff;
  border: 0;
  padding: 12px;
  font-size: 15px;
}

.close {
  position: absolute;
  top: 9px;
  right: 15px;
  border: 0;
  background: transparent;
  font-size: 28px;
}

@media (max-width: 860px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .nav {
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
  .product h3 {
    font-size: 20px;
  }
  .receipt-line {
    grid-template-columns: 140px 50px 1fr;
    font-size: 16px;
  }
}
