* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f4f2; color: #1c1c1c;
  display: flex; flex-direction: column; min-height: 100dvh;
}
#screen { flex: 1; overflow-y: auto; padding-bottom: 8px; }
#tabs {
  display: flex; border-top: 1px solid #ddd; background: #fff;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; padding: 12px 0; font-size: 14px; font-weight: 700;
  border: none; background: none; color: #999;
}
.tab.active { color: #2d6a4f; }

h2 { font-size: 18px; padding: 14px 14px 4px; }
.subtitle { font-size: 13px; color: #777; padding: 0 14px 10px; }
.section { background: #fff; border-radius: 12px; margin: 10px 12px; padding: 12px; }
.label { font-size: 11px; letter-spacing: .06em; color: #888; text-transform: uppercase; font-weight: 700; }

.btn {
  display: block; width: 100%; border: none; border-radius: 10px;
  background: #2d6a4f; color: #fff; font-size: 16px; font-weight: 800;
  padding: 14px; margin-top: 10px;
}
.btn.secondary { background: #e8e8e6; color: #1c1c1c; }
.btn.danger { background: #b3392f; }
.btn:disabled { opacity: .4; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kidchip {
  border: none; border-radius: 18px; padding: 9px 16px;
  font-size: 15px; font-weight: 700; background: #eee; color: #999;
}
.kidchip.on { background: #2d6a4f; color: #fff; }

.banner {
  background: #fff7e0; border: 1px solid #f0e0b0; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-top: 10px;
}

.rowline {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 4px; border-bottom: 1px solid #f0f0f0; font-size: 15px;
}
.rowline:last-child { border-bottom: none; }
.rowline .grow { flex: 1; }
.iconbtn {
  border: 1px solid #ddd; background: #fafafa; border-radius: 8px;
  font-size: 14px; padding: 5px 9px;
}

/* field */
.fieldwrap { position: relative; background: #15351f; }
.fieldwrap svg { display: block; width: 100%; }
.poschip {
  position: absolute; transform: translate(-50%, -50%);
  background: #fff; border: 2px solid transparent; border-radius: 15px;
  padding: 5px 11px; font-size: 13px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.poschip.selected { border-color: #f6a93b; background: #fff3dd; }
.poschip.dark {
  background: rgba(30,30,30,.6); color: #ccc; font-weight: 600;
  border: 1.5px dashed #bbb; box-shadow: none;
}
.gamebar {
  background: #fff; display: flex; justify-content: space-between;
  align-items: center; padding: 10px 14px; gap: 10px;
}
.gamebar .info b { font-size: 15px; display: block; }
.gamebar .info span { font-size: 12px; color: #777; }
.gamebar button {
  border: none; border-radius: 10px; padding: 11px 14px;
  font-size: 14px; font-weight: 700;
}
.gamebar .primary { background: #2d6a4f; color: #fff; }
.gamebar .plain { background: #eee; }

/* modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; z-index: 10;
}
.sheet {
  background: #fff; width: 100%; border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 75dvh; overflow-y: auto;
}
.sheet h3 { font-size: 16px; padding-bottom: 8px; }

/* tally table */
.tallywrap { overflow-x: auto; margin: 0 12px; background: #fff; border-radius: 12px; }
table.tally { border-collapse: collapse; font-size: 13px; width: 100%; }
table.tally th, table.tally td { padding: 7px 8px; text-align: center; }
table.tally th:first-child, table.tally td:first-child { text-align: left; font-weight: 700; position: sticky; left: 0; background: #fff; }
table.tally tr { border-bottom: 1px solid #f3f3f3; }
td.hi { background: #cde8cd; }
td.lo { background: #eee; color: #999; }
