:root {
  --mario-red: #e52521;
  --mario-red-dark: #a81512;
  --mario-blue: #049cd8;
  --mario-sky: #5c94fc;
  --mario-gold: #fbd000;
  --mario-gold-dark: #c49a00;
  --mario-green: #43b047;
  --mario-green-dark: #287a2c;
  --brick-orange: #c84c0c;
  --brick-mortar: #f8d8b0;
  --ink: #1e1b2e;
  --muted: #57536e;
  --surface: #fffdf7;
  --border: #231f20;
  --radius: 12px;
  --shadow: 0 4px 0 var(--border);
}

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

body {
  margin: 0;
  font-family: "Fredoka", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background-color: var(--mario-sky);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sky-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.7) 0 42px, transparent 43px),
    radial-gradient(circle at 21% 21%, rgba(255, 255, 255, 0.7) 0 54px, transparent 55px),
    radial-gradient(circle at 27% 18%, rgba(255, 255, 255, 0.7) 0 38px, transparent 39px),
    radial-gradient(circle at 78% 14%, rgba(255, 255, 255, 0.65) 0 48px, transparent 49px),
    radial-gradient(circle at 84% 17%, rgba(255, 255, 255, 0.65) 0 60px, transparent 61px),
    linear-gradient(180deg, #5c94fc 0%, #8ab6ff 75%, #b8d4ff 100%);
}

.container {
  width: min(1140px, 94vw);
  margin-inline: auto;
}

/* Header */
.mario-header {
  background: var(--mario-red);
  border-bottom: 4px solid var(--border);
  box-shadow: 0 4px 0 rgba(35, 31, 32, 0.25);
  padding: 1rem 0;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.coin-badge {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  background: var(--mario-gold);
  color: var(--border);
  border: 3px solid var(--border);
  border-radius: 50%;
  box-shadow: inset -3px -3px 0 var(--mario-gold-dark), 0 3px 0 var(--border);
  font-size: 1.5rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 0.2rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
  color: var(--mario-gold);
  letter-spacing: 0.05em;
}

h1 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1rem, 2.3vw, 1.45rem);
  color: #ffffff;
  text-shadow: 3px 3px 0 var(--border);
  line-height: 1.3;
}

.hud-stats {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.hud-pill {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  box-shadow: 0 3px 0 var(--border);
  text-align: center;
  min-width: 82px;
}

.hud-pill--gold {
  background: #fff4b8;
}

.hud-pill--green {
  background: #d8f8da;
}

.hud-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hud-value {
  font-family: "Press Start 2P", monospace;
  font-size: 0.95rem;
  color: var(--ink);
}

/* Main & Cards */
.main-content {
  padding: 1.5rem 0 2.5rem;
  display: grid;
  gap: 1.5rem;
  flex: 1;
}

.card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-banner {
  background: var(--mario-gold);
  border-bottom: 3px solid var(--border);
  padding: 0.75rem 1.2rem;
}

.card-banner h2,
.table-toolbar h2 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Add Form */
.add-gift-form {
  padding: 1.15rem 1.2rem 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem 1rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.88rem;
  font-weight: 600;
}

.field input[type="text"] {
  padding: 0.62rem 0.75rem;
  border: 2.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #ffffff;
  color: var(--ink);
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--mario-blue);
  box-shadow: 0 0 0 3px rgba(4, 156, 216, 0.25);
}

.field--checkbox {
  justify-content: center;
  padding-bottom: 0.35rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--mario-green);
  cursor: pointer;
}

/* Buttons */
.btn {
  font-family: "Press Start 2P", monospace;
  font-size: 0.7rem;
  padding: 0.75rem 1rem;
  border: 3px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border);
  transition: transform 0.08s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border);
}

.btn-red {
  background: var(--mario-red);
  color: #ffffff;
  width: 100%;
}

.btn-red:hover {
  background: #f0322e;
}

.btn-green {
  background: var(--mario-green);
  color: #ffffff;
}

.btn-blue {
  background: var(--mario-blue);
  color: #ffffff;
}

.btn-sm {
  font-size: 0.62rem;
  padding: 0.42rem 0.62rem;
}

.btn-danger {
  background: #ffe3e3;
  color: var(--mario-red-dark);
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
}

.feedback {
  margin: 0.4rem 1.2rem 1rem;
  min-height: 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mario-green-dark);
}

.feedback.error {
  color: var(--mario-red-dark);
}

/* Table Section */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.2rem;
  background: #f4f7ff;
  border-bottom: 3px solid var(--border);
}

.filter-group {
  display: flex;
  gap: 0.4rem;
}

.filter-btn {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.38rem 0.8rem;
  border: 2.5px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.filter-btn.active {
  background: var(--mario-blue);
  color: #ffffff;
}

.table-wrap {
  overflow-x: auto;
}

.wishlist-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.wishlist-table th {
  background: #231f20;
  color: var(--mario-gold);
  font-family: "Press Start 2P", monospace;
  font-size: 0.66rem;
  padding: 0.85rem 0.9rem;
  white-space: nowrap;
}

.wishlist-table td {
  padding: 0.85rem 0.9rem;
  border-bottom: 2px solid #e7e2d5;
  vertical-align: top;
}

.wishlist-table tbody tr:hover {
  background: #fff9db;
}

.gift-title {
  font-weight: 700;
  font-size: 1.02rem;
}

.url-link {
  color: var(--mario-blue);
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

.muted-dash {
  color: var(--muted);
}

/* Status Pill */
.status-toggle {
  border: 2.5px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--border);
}

.status-toggle.is-assigned {
  background: var(--mario-green);
  color: #ffffff;
}

.status-toggle.is-unassigned {
  background: #f0eef7;
  color: var(--ink);
}

/* Assignees Chips + Inline Add */
.assignees-cell {
  min-width: 220px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #e3f4ff;
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.chip-remove {
  border: none;
  background: transparent;
  color: var(--mario-red-dark);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.add-assignee-row {
  display: flex;
  gap: 0.35rem;
}

.add-assignee-input {
  width: 140px;
  padding: 0.32rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
}

.empty-cell {
  text-align: center;
  padding: 2rem !important;
  color: var(--muted);
  font-weight: 600;
}

/* Brick Ground Footer */
.mario-ground {
  height: 44px;
  background-color: var(--brick-orange);
  border-top: 4px solid var(--border);
  background-image:
    linear-gradient(335deg, var(--brick-mortar) 2px, transparent 2px),
    linear-gradient(155deg, var(--brick-mortar) 2px, transparent 2px),
    linear-gradient(335deg, var(--brick-mortar) 2px, transparent 2px),
    linear-gradient(155deg, var(--brick-mortar) 2px, transparent 2px);
  background-size: 44px 22px;
  background-position: 0 0, 0 11px, 22px -11px, 22px 0;
}

@media (max-width: 720px) {
  .wishlist-table thead {
    display: none;
  }

  .wishlist-table,
  .wishlist-table tbody,
  .wishlist-table tr,
  .wishlist-table td {
    display: block;
    width: 100%;
  }

  .wishlist-table tr {
    border-bottom: 4px solid var(--border);
    padding: 0.5rem 0;
  }

  .wishlist-table td {
    border: none;
    padding: 0.45rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    text-align: right;
  }

  .wishlist-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    text-align: left;
  }

  .wishlist-table td.assignees-cell {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}
