:root {
  --blue: #336699;
  --blue2: #aac2da;
  --ink: #172235;
  --page: #eef4fb;
  --card: #fff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.9), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--page) 100%);
}
.site-header {
  background: var(--blue);
  color: #fff;
  border-bottom: 4px solid var(--blue2);
}
.brand {
  width: min(1000px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  background: #fff;
  color: var(--blue);
  border: 3px solid var(--blue2);
  border-radius: 10px;
  font-weight: 800;
  padding: 8px 10px;
}
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); }
.site-header p { margin: 2px 0 0; color: #e9f2fb; }
.layout {
  width: min(1000px, calc(100% - 24px));
  margin: 18px auto 36px;
  display: grid;
  gap: 18px;
}
.game-card, .instructions {
  background: #fff;
  border: 2px solid #c8d6e7;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(30,55,90,.12);
}
.game-card {
  padding: 14px;
  background-image: url("memory_graphics/ripple.gif");
}
.status-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.status {
  flex: 1;
  min-height: 34px;
  border: 1px solid #b8c7d8;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  padding: 8px 14px;
  text-align: center;
  font-weight: 700;
}
.score-pill {
  min-width: 110px;
  text-align: center;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}
.chooser {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px 12px;
  margin: 0 auto 12px;
  padding: 10px;
  background: rgba(255,255,255,.88);
  border: 1px solid #c8d6e7;
  border-radius: 14px;
  font-weight: 700;
}
.chooser label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.chooser label:has(input:checked) {
  border-color: #91a8c2;
  background: #edf4fc;
}
.chooser img {
  width: 28px;
  height: 32px;
  object-fit: contain;
  background: #000;
  padding: 2px;
}
.canvas-shell {
  position: relative;
  width: min(100%, 720px);
  margin: 0 auto;
}
canvas {
  display: block;
  width: min(100%, 720px);
  height: auto;
  margin: 0 auto;
  aspect-ratio: 400 / 325;
  border: 3px solid #111;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  touch-action: none;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  align-items: center;
  margin-top: 12px;
}
button {
  font: inherit;
  cursor: pointer;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid #91a8c2;
  padding: 6px 10px;
  background: linear-gradient(#fff, #e6edf5);
  font-weight: 800;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
.primary {
  color: #fff;
  background: linear-gradient(#477bb2, #285887);
  border-color: #1d456d;
}
.hint {
  color: #34445c;
  background: rgba(255,255,255,.92);
  border: 1px solid #c8d6e7;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .92rem;
}
.instructions {
  padding: 18px 22px;
  line-height: 1.5;
}
.instructions h2 { margin-top: 0; color: #244d76; }
@media (max-width: 720px) {
  .layout, .brand { width: min(100% - 12px, 1000px); }
  .game-card { padding: 8px; }
  .status-row { gap: 8px; align-items: stretch; }
  .status { font-size: .86rem; padding: 7px 10px; }
  .score-pill { min-width: 82px; padding: 7px 8px; }
  .chooser { font-size: .9rem; gap: 6px; }
  .chooser img { width: 22px; height: 25px; }
  button { min-height: 42px; }
  .hint { width: 100%; text-align: center; border-radius: 14px; }
  .instructions { padding: 14px; }
}


/* v2 JGames standardization */
body{
  position:relative;
}
.jgames-home-badge{
  position:fixed;
  top:12px;
  right:12px;
  z-index:10000;
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:#fff;
  border:1px solid rgba(11,46,131,.18);
  box-shadow:0 8px 22px rgba(11,46,131,.18);
  transition:transform .12s ease, box-shadow .12s ease;
}
.jgames-home-badge img{
  width:32px;
  height:32px;
  display:block;
}
.jgames-home-badge:hover{
  transform:translateY(-1px);
  box-shadow:0 12px 28px rgba(11,46,131,.22);
}
.brand{
  padding-right:60px;
}
.logo{
  min-width:96px;
  min-height:96px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
}
.logo img{
  display:block;
  max-width:72px;
  max-height:72px;
  width:auto;
  height:auto;
}
.footer{
  width:min(1000px, calc(100% - 24px));
  margin:0 auto 36px;
  padding:18px 18px 24px;
  background:rgba(255,255,255,.96);
  border:2px solid #c8d6e7;
  border-radius:14px;
  box-shadow:0 12px 30px rgba(30,55,90,.12);
  text-align:center;
  font:14px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
}
.footer nav{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:8px 14px;
  margin-bottom:12px;
  font-weight:700;
}
.footer a{
  color:#0B2E83;
  text-decoration:none;
}
.footer a:hover{
  color:#D80D16;
  text-decoration:underline;
}
.footer p{
  margin:6px 0 0;
  color:#34445c;
}
.instructions p{
  margin-bottom:.95rem;
}
@media(max-width:720px){
  .jgames-home-badge{
    width:40px;
    height:40px;
    border-radius:13px;
  }
  .jgames-home-badge img{
    width:29px;
    height:29px;
  }
  .brand{
    padding-right:52px;
  }
  .logo{
    min-width:72px;
    min-height:72px;
    padding:8px;
  }
  .logo img{
    max-width:54px;
    max-height:54px;
  }
  .footer{
    width:min(100% - 12px, 1000px);
    padding:14px 12px 18px;
    margin-bottom:24px;
  }
}
