:root {
  --primary: #5EC8D8;
  --primary-dark: #3AA8B8;
  --mint: #5EE0A8;
  --danger: #F07178;
  --text-light: #F5F6F8;
  --text-gray: #A1A1A6;
  --bg-dark: #000;
  --bg-card: #1C1C1E;
  --bg-elevated: #242426;
  --border: #333;
  --inset: #111;
  --header-bg: rgba(12, 12, 14, 0.82);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.6;
}
a { color: var(--primary); }
img { max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(28, 28, 30, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.site-header nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}
.logo svg { flex: 0 0 auto; }
.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem 2rem;
}
.nav-links a,
.nav-links .nav-signout {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.nav-links a:hover,
.nav-links .nav-signout:hover {
  color: var(--primary);
  background: none;
}
.nav-links a[aria-current="page"] {
  color: var(--primary);
}
.nav-links .nav-signout:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
@media (max-width: 640px) {
  .site-header nav { padding: 0.85rem 1.25rem; }
  .nav-links { gap: 1.25rem; }
}

.wrap { max-width: 640px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.wrap.wide { max-width: 980px; }
.back { display: inline-block; margin-bottom: 1.25rem; color: var(--text-gray); text-decoration: none; }
.back:hover { color: var(--primary); }

.page-head { margin-bottom: 1.75rem; }
.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 { font-size: 1.85rem; margin: 0 0 0.45rem; letter-spacing: -0.03em; }
.page-head .lead,
p { color: var(--text-gray); }
.page-head .lead { margin: 0; max-width: 40rem; }

.section { margin-top: 2.25rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.section-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; }
.section-head p { margin: 0; font-size: 0.92rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.card h2 { font-size: 1.15rem; margin: 0 0 0.4rem; }

label { display: block; font-weight: 600; margin: 0.85rem 0 0.4rem; }
label:first-child { margin-top: 0; }
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--inset);
  color: var(--text-light);
  font-size: 1rem;
}
input:focus {
  outline: 2px solid rgba(94, 200, 216, 0.35);
  border-color: var(--primary);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.75rem 1.2rem;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #041014;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: rgba(255,255,255,0.08); }
.btn-ghost {
  background: transparent;
  color: var(--text-gray);
  border: 0;
  padding: 0.55rem 0.7rem;
  margin-top: 0;
}
.btn-ghost:hover { color: var(--text-light); background: rgba(255,255,255,0.06); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.btn-row .btn, .btn-row button { margin-top: 0; }

.status { min-height: 1.4em; margin: 0.75rem 0 0; }
.status.error { color: var(--danger); }
.status.ok { color: var(--mint); }
.muted { color: var(--text-gray); font-size: 0.95rem; }
.hidden { display: none !important; }

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 760px) {
  .product-grid { grid-template-columns: 1fr 1fr; }
}

.product {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem 1.3rem 1.35rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.product-top {
  display: flex;
  gap: 0.95rem;
  align-items: flex-start;
}
.product-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--inset);
  flex: 0 0 auto;
}
.product-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-copy { min-width: 0; flex: 1; }
.product-copy h2 {
  margin: 0 0 0.15rem;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.product-tagline {
  margin: 0;
  color: var(--text-gray);
  font-size: 0.95rem;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.7rem 0 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-gray);
}
.badge.owned {
  color: #042016;
  background: var(--mint);
  border-color: transparent;
}
.badge.available {
  color: var(--primary);
  border-color: rgba(94, 200, 216, 0.35);
}

.product-body { margin-top: 0.95rem; flex: 1; }
.product-body p { margin: 0 0 0.45rem; font-size: 0.95rem; }
.product-body p:last-child { margin-bottom: 0; }
.meta { color: var(--text-gray); font-size: 0.92rem; }

.meter {
  height: 6px;
  border-radius: 999px;
  background: #2a2a2c;
  overflow: hidden;
  margin: 0.55rem 0 0.4rem;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}
.meter.low > span { background: var(--danger); }

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1.1rem;
}
.product-actions .btn,
.product-actions button { margin-top: 0; }

.empty {
  color: var(--text-gray);
  margin: 0;
  padding: 1.4rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: #0c0c0e;
}

.purchase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.purchase-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.purchase-table th,
.purchase-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.purchase-table th {
  color: var(--text-gray);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.purchase-table tr:last-child td { border-bottom: 0; }
.purchase-table .amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.purchase-table .btn { margin-top: 0; padding: 0.45rem 0.75rem; font-size: 0.85rem; }
.purchase-product { color: var(--text-light); font-weight: 600; }
.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--mint);
}

.account-foot {
  margin-top: 2.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-gray);
  font-size: 0.92rem;
}
.account-foot a { color: var(--text-gray); }
.account-foot a:hover { color: var(--primary); }

.skeleton {
  background: linear-gradient(90deg, #1c1c1e 0%, #262628 50%, #1c1c1e 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 16px;
  min-height: 8.5rem;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.55rem; }
  .purchase-table th:nth-child(3),
  .purchase-table td:nth-child(3) { display: none; }
}
