:root {
  color-scheme: light;
  --ink: #18222f;
  --muted: #687385;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --line: #d9e0e8;
  --line-strong: #b8c3d1;
  --focus: #2f6fda;
  --ok: #1d8758;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
}

.pokemon-background {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

.pokemon-background img {
  height: 72px;
  image-rendering: pixelated;
  position: absolute;
  transform: translate(-50%, -50%);
  user-select: none;
  width: 72px;
}

#confetti {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 20;
}

.sheet-shell {
  margin: 0 auto;
  max-width: 1100px;
  padding: 28px 18px calc(48px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.sheet-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: calc(1.5rem + 64px);
}

h1 {
  font-size: 1.25rem;
  letter-spacing: 0;
  line-height: 1;
  margin: 0;
}

.count {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  font-size: 1rem;
  height: 38px;
  justify-content: center;
  min-width: 48px;
  padding: 0 12px;
}

.sheet {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: visible;
}

.sheet-row {
  background: var(--panel);
  display: grid;
  grid-template-columns: minmax(128px, 180px) minmax(0, 1fr);
  min-height: 58px;
}

.sheet-row + .sheet-row {
  border-top: 1px solid var(--line);
}

.sheet-row > div {
  padding: 6px;
}

.sheet-row > div + div {
  border-left: 1px solid var(--line);
}

.sheet-head {
  align-items: center;
  background: #eef2f6;
  color: #3a4654;
  font-size: 0.82rem;
  min-height: 40px;
  position: sticky;
  top: 0;
  text-transform: lowercase;
  z-index: 5;
}

.sheet-head > div {
  padding-bottom: 5px;
  padding-top: 5px;
}

.sheet-head > div:first-child,
.date-cell {
  left: 0;
  position: sticky;
  z-index: 3;
}

.sheet-head > div:first-child {
  background: #eef2f6;
  z-index: 6;
}

.sheet-row.today {
  background: #f8fbff;
}

.date-cell {
  align-items: center;
  background: inherit;
  color: #334155;
  display: flex;
  font-size: 0.9rem;
}

.exercise-cell {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.exercise-chips {
  display: contents;
  list-style: none;
  margin: 0;
  padding: 0;
}

.exercise-chips li {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 8px;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 8px 6px 10px;
}

.exercise-chips span {
  font-size: 0.9rem;
  line-height: 1.2;
}

.exercise-chips form,
.add-form {
  margin: 0;
}

.exercise-chips button {
  align-items: center;
  background: #eef2f6;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #536273;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  height: 24px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 24px;
}

.trash-button svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.exercise-chips button:hover,
.exercise-chips button:focus-visible {
  border-color: var(--line-strong);
  color: var(--ink);
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.add-form {
  display: inline-grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 340px);
}

.add-form select {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  min-width: 0;
  padding: 0 10px;
}

@media (max-width: 680px) {
  .sheet-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .sheet-row {
    grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
  }

  .sheet-row > div {
    padding: 5px;
  }

  .date-cell {
    font-size: 0.8rem;
    overflow-wrap: anywhere;
  }

  .add-form {
    background: rgba(247, 248, 250, 0.96);
    border-top: 1px solid var(--line-strong);
    bottom: 0;
    box-shadow: 0 -8px 22px rgba(24, 34, 47, 0.08);
    gap: 10px;
    grid-template-columns: minmax(0, 1fr);
    left: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 10;
  }

  .add-form select {
    font-size: 16px;
    min-height: 44px;
  }
}
