:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #5f6965;
  --paper: #faf8f0;
  --line: #c8c0ad;
  --dash: #9c9484;
  --brand: #183d36;
  --brand-2: #295c51;
  --mark: #1e2a26;
  --warn: #b78115;
  --yes: #1f7a4d;
  --shadow: 0 12px 30px rgba(24, 61, 54, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #e7e2d5;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(24, 61, 54, 0.08) 0, transparent 28%),
    var(--paper);
}

button,
textarea {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  color: #fff;
  background: var(--brand);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.65rem, 9vw, 2.5rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

.reset-button {
  min-width: 70px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
}

.sheet {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 14px 10px 28px;
}

.legend,
.player-row,
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, 44px);
  gap: 8px;
  align-items: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.legend span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.58);
}

.legend b {
  color: var(--ink);
}

.player-row {
  position: sticky;
  top: calc(68px + env(safe-area-inset-top));
  z-index: 2;
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 2px solid var(--brand);
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
  background: rgba(250, 248, 240, 0.96);
  backdrop-filter: blur(8px);
}

.category {
  position: relative;
  margin: 0 0 18px;
  padding-left: 36px;
  border: 2px solid var(--brand);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
}

.category h2 {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  margin: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: var(--brand);
}

.rows {
  padding: 2px 0;
}

.row {
  min-height: 72px;
  padding: 8px 8px;
  background-image: linear-gradient(90deg, var(--dash) 54%, transparent 0);
  background-position: left bottom;
  background-repeat: repeat-x;
  background-size: 22px 2px;
}

.row:last-child {
  background-image: none;
}

.item-title {
  display: block;
  font-size: clamp(0.98rem, 4.3vw, 1.24rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
}

.item-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(0.78rem, 3.6vw, 0.95rem);
  font-style: italic;
  font-weight: 650;
  line-height: 1.1;
}

.cell {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid var(--mark);
  border-radius: 11px;
  color: var(--mark);
  font-size: 1.48rem;
  font-weight: 950;
  line-height: 1;
  background: rgba(255, 255, 255, 0.7);
  touch-action: manipulation;
  user-select: none;
}

.cell[data-state="no"]::before {
  content: "X";
}

.cell[data-state="maybe"] {
  border-color: var(--warn);
  color: var(--warn);
}

.cell[data-state="maybe"]::before {
  content: "?";
}

.cell[data-state="yes"] {
  border-color: var(--yes);
  color: #fff;
  background: var(--yes);
}

.cell[data-state="yes"]::before {
  content: "✓";
}

.notes-block {
  padding: 12px;
  border: 2px solid var(--brand);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.notes-block label {
  display: block;
  margin-bottom: 8px;
  color: var(--brand);
  font-size: 1rem;
  font-weight: 950;
  text-transform: uppercase;
}

.notes-block textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fffdf7;
}

@media (max-width: 380px) {
  .legend,
  .player-row,
  .row {
    grid-template-columns: minmax(0, 1fr) repeat(4, 38px);
    gap: 6px;
  }

  .cell {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    font-size: 1.28rem;
  }

  .row {
    padding-inline: 6px;
  }
}

@media (min-width: 680px) {
  .app-header {
    border-radius: 0 0 12px 12px;
  }

  .sheet {
    padding-top: 20px;
  }
}
