:root {
  --bg: #fbf6e9;
  --panel: #f2e9d4;
  --ink: #2f2a24;
  --muted: #6b6255;
  --pink: #c2185b;
  --teal: #0f7f76;
  --line: #ddd0b3;
  --btn: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 900px; margin: 0 auto; padding: 12px 16px 32px; }

header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 24px; letter-spacing: .5px; color: var(--pink); }
.stats { display: flex; gap: 14px; }
.stat { text-align: center; min-width: 48px; }
.lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }

#controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 8px; }
button {
  font: inherit; font-weight: 600; color: var(--ink);
  background: var(--btn); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; touch-action: manipulation;
}
button:hover { border-color: var(--teal); }
button:disabled { opacity: .45; cursor: default; border-color: var(--line); }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.pick { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
select {
  font: inherit; color: var(--ink); background: var(--btn);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}

#sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side {
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px;
  padding: 6px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 44px;
}
.side.turn { border-color: var(--teal); background: #e3f3ee; }
.who { font-weight: 700; }
.grp { font-size: 13px; color: var(--muted); }
.tray { display: flex; gap: 3px; flex-wrap: wrap; }
.chip {
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .35);
  font-size: 10px; font-weight: 700; line-height: 18px; text-align: center; color: #222;
}
.chip i { font-style: normal; display: inline-block; background: #fff; border-radius: 50%; min-width: 12px; height: 12px; line-height: 12px; }
.chip.gone { opacity: .22; }
#msg { min-height: 22px; font-size: 14px; margin: 6px 0; }

#boardWrap { position: relative; }
#table { display: block; width: 100%; border-radius: 14px; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }

#win {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
  background: #fffdf8; border: 2px solid var(--teal); border-radius: 16px;
  padding: 18px 26px; text-align: center; z-index: 10;
  box-shadow: 0 8px 24px rgba(60, 45, 20, .25);
}
#win h2 { margin: 0 0 4px; color: var(--pink); }
#win p { margin: 0 0 12px; }
.hidden { display: none; }

#shotBar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; }
#shotBar.off { opacity: .5; pointer-events: none; }
.aimRow { display: flex; align-items: center; gap: 4px; }
.cap { font-size: 13px; color: var(--muted); margin-right: 2px; }
.cap b { color: var(--ink); }
.slide { display: flex; flex-direction: column; gap: 2px; flex: 1 1 150px; min-width: 130px; }
.slide input { width: 100%; accent-color: var(--teal); }
#shootBtn { padding: 10px 26px; font-size: 16px; }

#more { margin-top: 14px; }
details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
summary { cursor: pointer; font-weight: 600; }
details ul { margin: 8px 0 4px; padding-left: 20px; }
details li { margin: 4px 0; }

@media (max-width: 520px) {
  #app { padding: 8px 8px 24px; }
  h1 { font-size: 20px; }
  button { padding: 7px 9px; font-size: 14px; }
  .chip { width: 17px; height: 17px; line-height: 15px; font-size: 9px; }
  .chip i { min-width: 10px; height: 10px; line-height: 10px; }
  .side { padding: 5px 7px; }
}
