:root {
  --bg-start: #fff8ea;
  --bg-end: #eaf7ff;
  --ink: #1c2330;
  --muted: #5b6473;
  --panel: #ffffffcc;
  --line: #d9dfeb;
  --good: #1f8f6a;
  --warn: #ba6b00;
  --accent: #0e7490;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Futura", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #fff1c9 0%, transparent 28%),
    radial-gradient(circle at 90% 0%, #d6f2ff 0%, transparent 25%),
    linear-gradient(145deg, var(--bg-start), var(--bg-end));
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.points-header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  backdrop-filter: blur(4px);
}

h1, h2, h3 {
  margin: 0;
}

h1 {
  letter-spacing: 0.05em;
}

.formula {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
  font-weight: 700;
}

.totals-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
}

.total-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
}

.total-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.total-card strong {
  font-size: 1.6rem;
}

.earned strong {
  color: var(--good);
}

.spent strong {
  color: var(--warn);
}

.remaining strong {
  color: var(--accent);
}

.formula-symbol {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--muted);
}

.layout-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.entry-form {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content 42px;
  align-items: end;
  gap: 0.6rem;
}

.inline-field {
  min-width: 0;
}

label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 0.9rem;
}

input,
button {
  font: inherit;
}

input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}

#points {
  width: 6ch;
  min-width: 6ch;
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}

#activity {
  width: 100%;
  min-width: 0;
}

.entry-form button {
  width: 42px;
  min-width: 42px;
  padding-left: 0;
  padding-right: 0;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  font-weight: 700;
  background: linear-gradient(120deg, #0ea5a6, #0284c7);
  color: white;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.list-wrap {
  margin-top: 1rem;
}

.entries-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.entry-row {
  position: relative;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
}

.entry-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.entry-points {
  white-space: nowrap;
}

.cards-block {
  margin-top: 0.8rem;
}

.item-form {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr) 42px;
  align-items: end;
  gap: 0.6rem;
}

#item-points {
  width: 6ch;
  min-width: 6ch;
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}

#item-name,
#item-image {
  width: 100%;
  min-width: 0;
}

.item-form button {
  width: 42px;
  min-width: 42px;
  padding-left: 0;
  padding-right: 0;
}

.cards-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
}

.item-card {
  position: relative;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0.65rem;
}

.item-card.locked-card {
  opacity: 0.6;
  filter: grayscale(0.45);
}

.item-card img {
  width: 100%;
  height: 108px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.item-card h4 {
  margin: 0.5rem 0 0.2rem;
}

.points-pill {
  color: var(--muted);
  font-size: 0.82rem;
}

.reward-line {
  margin: 0.5rem 0 0.4rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
}

.reward-name {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-points {
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
}

.reward-line button {
  margin-left: auto;
  width: auto;
  min-width: 0;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
}

.delete-btn {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #6b7280;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  padding: 0.25rem 0.42rem;
}

.entry-remove-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-remove-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 999px;
  background: #fff;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-note {
  padding: 0.7rem;
  background: white;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}

@media (max-width: 880px) {
  .layout-grid,
  .totals-row {
    grid-template-columns: 1fr;
  }

  .entry-form {
    grid-template-columns: 1fr;
  }

  .item-form {
    grid-template-columns: 1fr;
  }

  .formula-symbol {
    display: none;
  }
}
