/**
 * Chalk & Settle — Phase 2 shared app shell + scoring primitives
 * Requires cs-design-system.css (tokens). Match approved scoring / History wires.
 */

/* ── App shell with bottom tab bar ─────────────────────────────────────────── */
.cs-app-shell {
  position: relative;
  width: var(--shell-width);
  max-width: 100%;
  margin-inline: auto;
  min-height: var(--shell-height);
  background: var(--cream);
  border: var(--shell-border) solid var(--forest);
  border-radius: var(--shell-radius);
  overflow: hidden;
}

.cs-app-shell--with-tabs {
  padding-bottom: 62px;
}

.cs-app-shell__scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  max-height: calc(var(--shell-height) - 62px);
}

.cs-app-shell__scroll::-webkit-scrollbar {
  display: none;
}

.cs-app-shell--scoring {
  overflow: hidden;
  height: var(--shell-height);
}

.cs-app-shell--scoring .cs-app-shell__body {
  overflow: hidden;
  height: 100%;
}

/* ── Bottom tab bar (History wire) ─────────────────────────────────────────── */
.cs-tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 20;
}

.cs-tab-bar__tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--touch-min);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cs-tab-bar__tab:active {
  opacity: 0.7;
}

.cs-tab-bar__tab.is-active {
  color: var(--forest);
}

.cs-tab-bar__tab.is-active .cs-tab-bar__icon {
  color: var(--forest);
}

.cs-tab-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: inherit;
}

.cs-tab-bar__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Fixed positioning variant (play.html full-width) */
.cs-tab-bar--fixed {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(var(--shell-width), 100%);
  max-width: 430px;
  border-radius: 0;
}

/* ── Hole pip strip ────────────────────────────────────────────────────────── */
.cs-strip-label {
  margin: 0 16px 5px;
  font-family: var(--font-body);
  font-size: var(--type-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--muted);
}

.cs-hole-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 0 16px;
  margin-bottom: 11px;
  -webkit-overflow-scrolling: touch;
}

.cs-hole-bar::-webkit-scrollbar {
  display: none;
}

.cs-pip {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: var(--weight-mono);
  flex-shrink: 0;
  color: var(--muted);
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cs-pip--done {
  background: var(--forest);
  color: var(--cream);
}

.cs-pip--active {
  background: var(--gold);
  color: var(--paper);
}

.cs-pip--upcoming {
  color: var(--line);
}

/* ── Stroke banner ─────────────────────────────────────────────────────────── */
.cs-stroke-banner {
  margin: 0 16px 9px;
  padding: 8px 12px;
  background: var(--bg-inset, #efeae0);
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  color: var(--olive);
  display: flex;
  align-items: center;
  gap: 7px;
}

.cs-stroke-banner__icon {
  display: inline-flex;
  color: var(--gold);
  flex-shrink: 0;
}

.cs-stroke-banner b {
  font-weight: 600;
}

/* ── Score entry row ───────────────────────────────────────────────────────── */
.cs-entries {
  margin: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cs-entry {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px 12px;
}

.cs-entry-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cs-entry-id {
  flex: 1;
  min-width: 0;
}

.cs-entry-name {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--forest);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cs-score-btn {
  width: 40px;
  height: 46px;
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--stone, #d4cec4);
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--forest);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cs-score-btn:active {
  opacity: 0.65;
}

.cs-score-num {
  min-width: 58px;
  height: 46px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cs-score-num .num {
  font-family: var(--font-mono);
  font-size: var(--type-score-lg);
  font-weight: 600;
  color: var(--forest);
  line-height: 1;
}

.cs-score-num__caret {
  display: inline-flex;
  color: var(--muted);
}

/* ── Hole-result slot (preview — always ink) ───────────────────────────────── */
.cs-hole-result {
  margin: 11px 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

.cs-hr-label {
  font-family: var(--font-body);
  font-size: var(--type-label);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.cs-hr-split {
  font-family: var(--font-mono);
  font-size: var(--type-body-sm);
  color: var(--muted);
}

.cs-hr-split b {
  color: var(--olive);
  font-weight: 600;
}

.cs-hr-split .money-pending,
.cs-hr-split .money-decided,
.cs-hr-split .money-loss {
  font-family: var(--font-mono);
}

/* ── Number pad (bottom sheet) ─────────────────────────────────────────────── */
.cs-numpad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 61, 47, 0.35);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion-fast), visibility var(--motion-fast);
}

.cs-numpad-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cs-numpad-sheet {
  width: min(var(--shell-width), 100%);
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px 24px;
  transform: translateY(100%);
  transition: transform var(--motion-base);
}

.cs-numpad-overlay.is-open .cs-numpad-sheet {
  transform: translateY(0);
}

.cs-numpad-title {
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  color: var(--muted);
  text-align: center;
  margin-bottom: 12px;
}

.cs-numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cs-numpad-key {
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--cream);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: var(--weight-mono);
  color: var(--forest);
  cursor: pointer;
}

.cs-numpad-key--action {
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  font-weight: 600;
}

.cs-numpad-key:active {
  background: var(--bg-inset, #efeae0);
}
