/* Crabbing in Maryland - simple, punchy arcade style */
:root{
  --bg:#06121e;
  --panel:rgba(8,22,36,.78);
  --panel2:rgba(10,26,44,.88);
  --text:#eaf5ff;
  --muted:#a7c0d6;
  --accent:#43d7ff;
  --accent2:#ffb54a; /* old bay-ish */
  --danger:#ff4f5e;
  --good:#39d98a;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --shadow2: 0 10px 25px rgba(0,0,0,.35);
  --radius: 16px;
  --radius2: 22px;
  --border: 1px solid rgba(255,255,255,.12);
  --border2: 1px solid rgba(255,255,255,.18);
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box;}
html,body{height:100%; margin:0; background: radial-gradient(900px 500px at 20% 0%, #0d2c49 0%, var(--bg) 60%); color:var(--text); font-family:var(--font);}
#app{position:relative; height:100%; width:100%; overflow:hidden;}
canvas#game{position:absolute; inset:0; width:100%; height:100%; display:block; pointer-events:auto;}

.hud{
  position:absolute; left:12px; right:12px; top:12px;
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; pointer-events:none;
}
.hud-left,.hud-right{display:flex; gap:10px; flex-wrap:wrap; align-items:center;}
.pill{
  pointer-events:none;
  display:flex; gap:10px; align-items:baseline;
  padding:10px 12px;
  background:linear-gradient(180deg,var(--panel2),var(--panel));
  border:var(--border);
  border-radius:999px;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(8px);
}
.pill .label{font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted);}
.pill .value{font-size:18px; font-weight:800; color:var(--text);}

.btn{
  pointer-events:auto;
  display:inline-flex; align-items:center; gap:10px;
  border-radius:999px;
  padding:10px 14px;
  border:var(--border2);
  background:rgba(255,255,255,.08);
  color:var(--text);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(8px);
  cursor:pointer;
  font-weight:800;
  letter-spacing:.01em;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
  user-select:none;
}
.btn:hover{background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.24);}
.btn:active{transform: translateY(1px) scale(.99);}
.btn.ghost{background:rgba(255,255,255,.06);}
.btn.danger{background:rgba(255,79,94,.14); border-color:rgba(255,79,94,.35);}
.btn.danger:hover{background:rgba(255,79,94,.2);}
.btn .badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 26px; height: 22px;
  padding:0 8px;
  border-radius: 999px;
  background: rgba(255,181,74,.16);
  border: 1px solid rgba(255,181,74,.35);
  color: #ffe7c2;
  font-weight:900;
  font-size: 12px;
}
.btn.on{
  background: rgba(255,181,74,.18);
  border-color: rgba(255,181,74,.5);
  box-shadow: 0 0 0 6px rgba(255,181,74,.08), var(--shadow2);
}
.spark{color: #ffd38b; text-shadow: 0 0 12px rgba(255,181,74,.25);}

#toasts{
  position:absolute; left:12px; bottom:12px;
  display:flex; flex-direction:column; gap:8px;
  max-width: min(420px, calc(100% - 24px));
  pointer-events:none;
}
.toast{
  background: linear-gradient(180deg, rgba(16,38,62,.88), rgba(9,23,39,.82));
  border: var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
  font-weight: 700;
  color: var(--text);
  display:flex; gap:10px; align-items:flex-start;
  animation: pop .18s ease;
}
.toast .dot{
  width:10px; height:10px; border-radius:999px;
  margin-top:4px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(67,215,255,.12);
}
.toast.good .dot{background: var(--good); box-shadow: 0 0 0 6px rgba(57,217,138,.12);}
.toast.bad .dot{background: var(--danger); box-shadow: 0 0 0 6px rgba(255,79,94,.12);}
@keyframes pop{from{transform:translateY(6px); opacity:0} to{transform:translateY(0); opacity:1}}

.panel{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: min(720px, calc(100% - 24px));
  background: linear-gradient(180deg, rgba(14,34,56,.92), rgba(8,18,30,.86));
  border: var(--border2);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow:hidden;
  pointer-events:auto;
}
.hidden{display:none !important;}
.panel-header{
  display:flex; justify-content:space-between; align-items:flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.panel-title{font-size:18px; font-weight:900;}
.panel-subtitle{font-size:13px; color:var(--muted); margin-top:2px;}
.icon-btn{
  border:0; background:rgba(255,255,255,.08); color:var(--text);
  width:36px; height:36px; border-radius: 12px;
  cursor:pointer; font-size:18px; font-weight:900;
  box-shadow: var(--shadow2);
}
.icon-btn:hover{background:rgba(255,255,255,.12);}
.tray-list{padding: 14px 18px; display:grid; gap:10px;}
.tray-row{
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  padding: 12px 12px;
  background: rgba(255,255,255,.06);
  border: var(--border);
  border-radius: 14px;
}
.tray-left{display:flex; gap:12px; align-items:center;}
.crab-chip{
  width:44px; height:34px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  position:relative;
  overflow:hidden;
}
.crab-chip .mini{
  font-size:18px; line-height:1;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.35));
}
.tray-meta .name{font-weight:900;}
.tray-meta .desc{font-size:12px; color:var(--muted); margin-top:2px;}
.tray-actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end;}
.small-btn{
  border-radius: 999px;
  padding: 8px 10px;
  border: var(--border2);
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor:pointer;
  font-weight:900;
}
.small-btn:hover{background: rgba(255,255,255,.12);}
.small-btn.keep{background: rgba(57,217,138,.14); border-color: rgba(57,217,138,.35);}
.small-btn.keep:hover{background: rgba(57,217,138,.2);}
.small-btn.release{background: rgba(255,255,255,.06);}
.small-btn.oldbay{background: rgba(255,181,74,.16); border-color: rgba(255,181,74,.4);}
.small-btn.oldbay:hover{background: rgba(255,181,74,.22);}
.small-btn:disabled{opacity:.45; cursor:not-allowed;}

.panel-footer{
  display:flex; justify-content:space-between; gap:12px; align-items:center;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.hint{font-size:12px; color:var(--muted); max-width: 60ch;}
.tiny{font-size:12px; color:var(--muted); margin: 14px 0 0 0;}
.overlay{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(900px 700px at 30% 20%, rgba(67,215,255,.12), rgba(0,0,0,.70) 55%, rgba(0,0,0,.82) 100%);
  pointer-events:auto;
}
.overlay-card{
  width: min(720px, calc(100% - 24px));
  padding: 18px 18px 16px 18px;
  border-radius: var(--radius2);
  border: var(--border2);
  background: linear-gradient(180deg, rgba(14,34,56,.92), rgba(8,18,30,.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.overlay-card h1{margin:0 0 8px 0; font-size: 26px; letter-spacing:-.02em;}
.overlay-card p{margin:0; color: var(--muted); font-weight: 650; line-height:1.4;}
.overlay-actions{display:flex; gap:10px; flex-wrap:wrap; margin-top: 14px;}


/* Keyboard selection highlight */
.tray-row.selected{
  outline: 2px solid rgba(67,215,255,.55);
  box-shadow: 0 0 0 6px rgba(67,215,255,.10), var(--shadow2);
}

.overlay.hidden{display:none !important;}

.tray.hidden{display:none !important;}


/* Primary action buttons */
.btn.primary{
  background: linear-gradient(180deg, rgba(67,215,255,.22), rgba(67,215,255,.12));
  border-color: rgba(67,215,255,.40);
}
.btn.primary:hover{background: linear-gradient(180deg, rgba(67,215,255,.28), rgba(67,215,255,.16));}

/* Error overlay (in-page diagnostics) */
.error-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 50;
}
.error-card{
  width:min(900px, 96vw);
  max-height: 86vh;
  overflow:auto;
  background: linear-gradient(180deg, rgba(12,34,56,.96), rgba(6,18,30,.96));
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0,0,0,.55);
  padding: 16px 16px 14px;
}
.error-title{
  font-weight: 900;
  letter-spacing:.2px;
  font-size: 18px;
  color: rgba(255,255,255,.92);
}
.error-sub{ margin-top: 4px; color: rgba(255,255,255,.75); font-size: 13px;}
.error-text{
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.38);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}
.error-actions{display:flex; gap:10px; justify-content:flex-end;}

/* v30 watermark */
#versionWatermark{position:fixed;right:10px;bottom:10px;z-index:9999;padding:6px 10px;border-radius:999px;background:rgba(0,0,0,.55);backdrop-filter:blur(6px);color:#cfe9ff;font:12px/1.1 ui-monospace,Consolas,monospace;}


/* v18: compact HUD to keep the boat and crew visible */
.hud{
  align-items:flex-start;
  gap:8px;
  z-index:30;
}
.hud-left{
  max-width:360px;
  justify-content:flex-start;
}
.hud-right{
  max-width:430px;
  justify-content:flex-end;
}
.pill{
  padding:8px 10px;
  gap:8px;
}
.pill .label{font-size:11px;}
.pill .value{font-size:16px;}
.btn{
  padding:8px 12px;
  gap:8px;
}
.btn .badge{
  min-width:22px;
  height:20px;
  padding:0 6px;
}
#toasts{
  bottom:86px;
}
@media (max-width: 900px){
  .hud{
    left:8px;
    right:8px;
    top:8px;
  }
  .hud-left,.hud-right{
    max-width:100%;
  }
  .pill .value{font-size:14px;}
  .btn{padding:7px 10px;}
}

/* v18: soften HUD panels so they don't visually block the boat */
.pill,.btn{
  background-color:rgba(8,22,36,.62);
}


/* v19: slightly smaller watermark */
#versionWatermark{
  opacity:.85;
}


/* v21: mobile/tablet unsupported message */
.unsupported-device{
  position:fixed;
  inset:0;
  z-index:10000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:22px;
  background:
    radial-gradient(900px 700px at 30% 20%, rgba(67,215,255,.16), rgba(0,0,0,.76) 55%, rgba(0,0,0,.92) 100%),
    #06121e;
  color:var(--text);
}
.unsupported-card{
  width:min(720px, 94vw);
  border-radius:24px;
  border:1px solid rgba(255,255,255,.18);
  background:linear-gradient(180deg, rgba(14,34,56,.94), rgba(8,18,30,.92));
  box-shadow:0 28px 90px rgba(0,0,0,.55);
  padding:24px;
}
.unsupported-card h1{
  margin:0 0 12px 0;
  font-size:28px;
  letter-spacing:-.03em;
}
.unsupported-card p{
  margin:12px 0;
  color:rgba(234,245,255,.9);
  line-height:1.45;
  font-weight:650;
}
.unsupported-card a{
  color:#8ee8ff;
  font-weight:900;
}
.unsupported-signoff{
  margin-top:18px !important;
  color:#ffe7c2 !important;
}
body.unsupported-mode{
  overflow:hidden;
}
body.unsupported-mode #game,
body.unsupported-mode .hud,
body.unsupported-mode #toasts,
body.unsupported-mode #tray,
body.unsupported-mode #overlay,
body.unsupported-mode #errorOverlay,
body.unsupported-mode #versionWatermark{
  display:none !important;
}


/* v22: Old Bay button now contains both key and remaining charges */
#oldBayBtn #oldBayCharges{
  background: rgba(57,217,138,.16);
  border-color: rgba(57,217,138,.35);
  color:#d9ffe9;
}
