/* ═══════════════════════════════════════════════
   CatPatch — Game Styles
   ═══════════════════════════════════════════════ */

.game { max-width: 600px; }
.game-hdr { padding: 0 0 10px; }

/* menu screen */
.cp-menu-art { display: flex; gap: 6px; }
.cp-menu-art svg { width: 54px; height: 54px; }
.cp-menu-art svg:nth-child(2) { transform: translateY(-6px); }
.diff-btn small { display: block; font-size: 10px; font-weight: 500; letter-spacing: 1px; color: var(--text-dim); margin-top: 3px; }
.diff-btn--daily small { color: rgba(255,255,255,.7); }

/* status chips */
.cp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-white); border: 1.5px solid var(--border); border-radius: var(--radius-pill);
  padding: 4px 12px 4px 6px; min-height: 36px;
  font-size: 17px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums;
}
.cp-chip b { color: #2E9E73; font-weight: 700; }
.cp-count-icon svg { width: 26px; height: 26px; display: block; }
.cp-time { padding: 4px 14px; font-size: 15px; font-weight: 600; color: var(--text-mid); }
.cp-status { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0 0 10px; }
.cp-fish { gap: 3px; padding: 4px 10px; }
.cp-fish svg { width: 28px; height: 19px; transition: transform .4s, opacity .4s, filter .4s; }
.cp-fish svg.lost { opacity: .28; filter: grayscale(1); transform: rotate(180deg) scale(.85); }

.cp-rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; padding: 0 0 12px; list-style: none; }
.cp-rules li {
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px; color: var(--text-mid);
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 10px;
}

/* board: patches drawn as merged shapes, separated by navy lines */
.cp-board-wrap { display: flex; justify-content: center; width: 100%; }
.cp-board {
  --g: 3px;
  position: relative;
  width: min(100%, max(260px, calc(100vh - 360px)));
  max-width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--navy);
  border-radius: var(--radius-md);
  padding: var(--g);
  display: grid;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  box-shadow: 0 10px 28px -12px rgba(45,50,112,.45);
  outline: none;
}
.cp-board:focus-visible { box-shadow: 0 0 0 3px var(--sky), 0 10px 28px -12px rgba(45,50,112,.45); }
.cp-cell { position: relative; cursor: pointer; }
.cp-tile { position: absolute; background: var(--c); transition: filter .15s; }
@media (hover: hover) { .cp-cell:hover .cp-tile { filter: brightness(1.05); } }
.cp-cell.cp-cursor .cp-tile { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--navy) !important; }
.cp-cell > div:last-child { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cp-mark svg { width: 46%; height: 46%; }
.cp-mark path { stroke: var(--navy); stroke-opacity: .62; }
.cp-cell.cp-wrong .cp-mark path { stroke: #E0505C; stroke-opacity: .9; }
.cp-dot::after { content: ""; width: 18%; height: 18%; border-radius: 50%; background: var(--navy); opacity: .3; }
.cp-cat svg { width: 86%; height: 86%; filter: drop-shadow(0 1px 1px rgba(35,38,79,.35)); }
.cp-cat.pop svg { animation: cpPop .38s cubic-bezier(.3,1.6,.5,1); }
.cp-cat.bad svg { animation: cpShake .5s; }
.cp-cat.hop svg { animation: cpHop .55s ease-out var(--delay, 0ms) both; }
.cp-cat.hinted svg { animation: cpGlow 1.2s ease-out; }
.cp-cell.cp-flash .cp-tile { animation: cpFlash .6s; }
@keyframes cpPop { from { transform: scale(.2); } to { transform: scale(1); } }
@keyframes cpShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-18%); } 40% { transform: translateX(16%); } 60% { transform: translateX(-10%); } 80% { transform: translateX(6%); } }
@keyframes cpFlash { 0%,100% { filter: none; } 30% { filter: brightness(1.25) saturate(1.6); } }
@keyframes cpHop { 0% { transform: translateY(0); } 35% { transform: translateY(-34%) rotate(-6deg); } 70% { transform: translateY(0) rotate(3deg); } 100% { transform: none; } }
@keyframes cpGlow { 0% { transform: scale(.2); } 50% { transform: scale(1.15); filter: drop-shadow(0 0 6px #fff); } 100% { transform: scale(1); } }

/* tools */
.cp-tools { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; width: 100%; padding: 14px 0 0; }
.cp-seg { display: flex; background: var(--bg-white); border: 1.5px solid var(--border); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.cp-seg button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: var(--radius-pill);
  padding: 6px 14px; min-height: 38px; font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-mid); cursor: pointer;
}
.cp-seg button svg { width: 24px; height: 24px; display: block; }
.cp-seg button[aria-pressed="true"] { background: var(--teal); color: var(--white); }
.cp-seg button[aria-pressed="true"] .cp-mk path { stroke: var(--white); }
.cp-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px;
  border: 1.5px solid var(--border); background: var(--bg-white); border-radius: var(--radius-pill);
  font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: 1.5px; color: var(--navy); cursor: pointer;
}
.cp-tool svg { width: 18px; height: 18px; }
.cp-tool:disabled { opacity: .4; cursor: default; }
.cp-seg button:focus-visible, .cp-tool:focus-visible, .cp-switch input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }

.cp-switch { display: inline-flex; align-items: center; gap: 8px; padding: 12px 0 0; font-size: 13px; font-weight: 500; color: var(--text-mid); cursor: pointer; }
.cp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cp-switch span { position: relative; flex: none; width: 36px; height: 22px; border-radius: var(--radius-pill); background: #CFCDDA; transition: background .2s; }
.cp-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.cp-switch input:checked + span { background: var(--teal); }
.cp-switch input:checked + span::after { transform: translateX(14px); }

/* result cards */
.cp-card { max-width: 380px; width: 100%; }
.cp-win-art { background: var(--bg-subtle); border-color: var(--teal); }
.cp-win-art svg { width: 52px; height: 52px; }
.cp-lose-art { background: var(--bg-subtle); border-color: var(--purple-soft); }
.cp-lose-art svg { width: 52px; height: 52px; }
.cp-win-sub { font-size: 14px; color: var(--text-mid); margin: 6px 0 16px; line-height: 1.5; }
.cp-win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.cp-win-stats div { background: var(--bg-subtle); border-radius: var(--radius-md); padding: 8px 4px; }
.cp-win-stats b { display: block; font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.cp-win-stats span { font-size: 9.5px; font-weight: 600; letter-spacing: 1.5px; color: var(--text-dim); }
.cp-best { font-size: 12px; font-weight: 600; letter-spacing: .5px; color: var(--text-dim); min-height: 18px; margin-bottom: 12px; }
.cp-best.cp-best--new { color: #2E9E73; }

.cp-toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 110;
  max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: var(--radius-pill);
  background: var(--navy); color: var(--white); font-size: 13px; font-weight: 500; text-align: center;
  box-shadow: 0 8px 24px -8px rgba(35,38,79,.6); pointer-events: none;
  animation: cpToastIn .2s ease;
}
@keyframes cpToastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 420px) {
  .game { padding: 14px 12px 0; }
  .cp-seg button { padding: 6px 11px; }
  .cp-tool { padding: 6px 12px; }
  .cp-rules li { font-size: 9.5px; letter-spacing: 1px; padding: 4px 8px; }
}
@media (max-width: 420px) {
  .cp-tool { padding: 6px 13px; }
  .cp-tool .cp-lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-cat svg, .cp-tile, .cp-fish svg, .cp-toast { animation: none !important; transition: none !important; }
}
