: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: linear-gradient(180deg, #fff 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: #f6f8fc;
}
.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;
}
.canvas-shell {
  position: relative;
  width: min(100%, 900px);
  margin: 0 auto;
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 380;
  border: 3px solid #111;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  touch-action: none;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.72);
}
.overlay.hidden { display: none; }
.title-img {
  width: min(80%, 358px);
  height: auto;
  filter: drop-shadow(0 5px 10px rgba(0,0,0,.28));
}
.start-controls {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  background: rgba(255,255,255,.94);
  border: 1px solid #b8c7d8;
  border-radius: 999px;
  padding: 10px 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;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  align-items: center;
  margin-top: 12px;
}
.hint {
  color: #34445c;
  background: rgba(255,255,255,.92);
  border: 1px solid #c8d6e7;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .92rem;
}
.ship-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 0;
}
.ship-tray button.selected {
  outline: 3px solid #f3d447;
  background: linear-gradient(#fff8ce, #e7edf5);
}
.ship-tray button.placed {
  opacity: .55;
}
.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; }
  .controls button, .ship-tray button { min-height: 42px; }
  .hint { width: 100%; text-align: center; border-radius: 14px; }
  .start-controls { width: min(94%, 460px); border-radius: 14px; bottom: 12%; }
  .instructions { padding: 14px; }
}


/* v4 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;
  }
}


/* v5 mobile landscape board growth */
@media (max-width: 1000px) and (orientation: landscape) {
  .layout {
    width: min(100% - 8px, 1100px);
    margin: 6px auto 18px;
    gap: 8px;
  }

  .game-card {
    padding: 6px;
  }

  .status-row {
    margin-bottom: 6px;
  }

  .canvas-shell {
    width: min(100%, 1040px);
  }

  .controls {
    margin-top: 8px;
    gap: 6px;
  }

  .ship-tray {
    margin-top: 8px;
    gap: 6px;
  }

  .instructions {
    display: none;
  }
}
