/* Shared chrome for every game in the catalogue.
   Copied once per generated site to assets/game.css.
   Everything is driven by the CSS custom properties the layout sets on :root,
   so a single stylesheet works under all design presets. */

.to-p-wrap {
  --to-gap: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--to-gap);
  align-items: center;
  width: 100%;
  color: var(--to-text);
  font-family: inherit;
}

/* --- HUD: score / status row above the board --- */
.to-p-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.to-p-stat {
  background: var(--to-surface);
  border: 1px solid var(--to-border);
  border-radius: var(--to-radius);
  padding: 8px 14px;
  min-width: 78px;
  text-align: center;
  line-height: 1.25;
}

.to-p-stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .65;
}

.to-p-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* --- Controls row --- */
.to-p-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.to-p-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--to-primary);
  background: var(--to-primary);
  color: #fff;
  border-radius: var(--to-radius);
  padding: 9px 18px;
  transition: opacity .15s ease, background-color .15s ease;
}

.to-p-btn:hover { opacity: .88; }
.to-p-btn:focus-visible { outline: 3px solid var(--to-accent); outline-offset: 2px; }

.to-p-btn-ghost {
  background: transparent;
  color: var(--to-primary);
}

.to-p-btn-ghost:hover { background: var(--to-surface); opacity: 1; }

.to-p-btn[aria-pressed="true"] {
  background: var(--to-accent);
  border-color: var(--to-accent);
  color: #fff;
}

.to-p-seg {
  display: inline-flex;
  border: 1px solid var(--to-border);
  border-radius: var(--to-radius);
  overflow: hidden;
}

.to-p-seg .to-p-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--to-text);
  padding: 8px 14px;
}

.to-p-seg .to-p-btn[aria-pressed="true"] {
  background: var(--to-primary);
  color: #fff;
}

.to-p-label {
  font-size: 13px;
  font-weight: 600;
  opacity: .75;
}

/* --- Status line --- */
.to-p-status {
  min-height: 24px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.to-p-status[data-tone="win"]  { color: var(--to-primary); }
.to-p-status[data-tone="lose"] { color: #b4232a; }

/* --- Boards --- */
.to-p-board {
  display: grid;
  gap: 6px;
  background: var(--to-surface);
  border: 1px solid var(--to-border);
  border-radius: var(--to-radius);
  padding: 10px;
  max-width: 100%;
  touch-action: manipulation;
}

.to-p-cell {
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-width: 0;
  background: var(--to-bg);
  border: 1px solid var(--to-border);
  border-radius: calc(var(--to-radius) * .6);
  color: var(--to-text);
  font-weight: 700;
  line-height: 1;
  transition: background-color .12s ease, transform .12s ease;
}

.to-p-cell:hover:not([disabled]) { background: var(--to-surface); }
.to-p-cell:focus-visible { outline: 3px solid var(--to-accent); outline-offset: 1px; }
.to-p-cell[disabled] { cursor: default; }
.to-p-cell[data-hit="1"] { background: var(--to-accent); color: #fff; }
.to-p-cell[data-win="1"] { background: var(--to-primary); color: #fff; }

/* --- Canvas games --- */
.to-p-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: var(--to-bg);
  border: 1px solid var(--to-border);
  border-radius: var(--to-radius);
  touch-action: none;
}

/* --- Misc --- */
.to-p-hint {
  font-size: 13px;
  opacity: .7;
  text-align: center;
  max-width: 46ch;
}

.to-p-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }

.to-p-input {
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  width: 130px;
  padding: 9px 10px;
  border: 1px solid var(--to-border);
  border-radius: var(--to-radius);
  background: var(--to-bg);
  color: var(--to-text);
}

.to-p-input:focus-visible { outline: 3px solid var(--to-accent); outline-offset: 1px; }

.to-p-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
