/* ==========================================================================
   Pirate Cove — game shell styles
   Scoped with .pco-* so the shared site stylesheet can't leak in and we
   can't leak out. Mobile-first, single file, no image assets — every
   symbol is emoji/CSS.
   ========================================================================== */

:root {
  /* Deep navy and teal sea, gold accents. */
  --pco-bg-0:        #05131f;
  --pco-bg-1:         #0a2438;
  --pco-bg-2:        #0f3348;
  --pco-teal:        #2bd3c4;
  --pco-teal-soft:   #8ff0e6;
  --pco-navy:        #1b4d73;
  --pco-mint:        #4ce0b3;
  --pco-gold:        #f2b93b;
  --pco-gold-soft:   #ffdd8a;
  --pco-red:         #ff5d6c;
  --pco-ink:         #f2f8fb;
  --pco-ink-dim:     #a9c4d3;
  --pco-panel:       rgba(6, 20, 32, 0.92);
  --pco-panel-line:  rgba(242, 185, 59, 0.22);
  --pco-chip:        rgba(3, 12, 20, 0.6);
  --pco-cell:        rgba(255, 255, 255, 0.06);
  --pco-radius:      16px;
  --pco-font:        'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --pco-safe-t:      env(safe-area-inset-top, 0px);
  --pco-safe-b:      env(safe-area-inset-bottom, 0px);
  --pco-safe-l:      env(safe-area-inset-left, 0px);
  --pco-safe-r:      env(safe-area-inset-right, 0px);
}

html, body.pco-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--pco-bg-0);
  color: var(--pco-ink);
  font-family: var(--pco-font);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* --------------------------------------------------------------------------
   Shared site header — visible on the menu/help, hidden during play.
   -------------------------------------------------------------------------- */
.pco-site-header {
  position: relative;
  z-index: 40;
  font-size: 13px;
}
.pco-site-header header {
  padding: 10px calc(16px + var(--pco-safe-r)) 10px calc(16px + var(--pco-safe-l));
  padding-top: calc(10px + var(--pco-safe-t));
  background: rgba(5, 16, 26, .78);
  border-bottom: 1px solid var(--pco-panel-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.pco-site-header a { color: var(--pco-ink-dim); text-decoration: none; padding: 5px 9px; border-radius: 8px; }
.pco-site-header a:hover { color: var(--pco-ink); background: rgba(255,255,255,.07); }
.pco-site-header a.active { color: var(--pco-gold); background: rgba(242,185,59,.14); }

body:has(.pco-root.is-playing) .pco-site-header,
body:has(.pco-root.is-playing) #footer { display: none; }

.pco-root {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(60vw 60vw at 15% -10%, rgba(43, 211, 196, .16), transparent 60%),
    radial-gradient(70vw 70vw at 110% 10%, rgba(242, 185, 59, .12), transparent 60%),
    linear-gradient(180deg, var(--pco-bg-1), var(--pco-bg-0) 60%);
}
.pco-root.is-playing { height: 100vh; overflow: hidden; }

/* --------------------------------------------------------------------------
   Generic dialog-style screens (loading / menu / help / bonus / jackpot)
   -------------------------------------------------------------------------- */
.pco-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--pco-safe-t)) calc(16px + var(--pco-safe-r)) calc(20px + var(--pco-safe-b)) calc(16px + var(--pco-safe-l));
  opacity: 0;
  transform: scale(.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 20;
  overflow-y: auto;
}
.pco-screen.is-open { opacity: 1; transform: none; pointer-events: auto; z-index: 30; }

.pco-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--pco-panel);
  border: 1px solid var(--pco-panel-line);
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.02) inset;
}
.pco-panel-narrow { max-width: 340px; }
.pco-panel-wide { max-width: 720px; text-align: left; }

.pco-logo {
  margin: 6px 0 4px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(135deg, var(--pco-teal), var(--pco-gold) 55%, var(--pco-mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pco-menu-glyphs { font-size: 26px; letter-spacing: 4px; margin-bottom: 4px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.pco-tagline { color: var(--pco-ink-dim); margin: 0 0 4px; font-size: 14px; }
.pco-tagline-sub { margin: 0 0 20px; font-size: 12px; opacity: .85; }
.pco-muted { color: var(--pco-ink-dim); }

.pco-progress { width: 100%; height: 8px; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 18px; }
.pco-progress-bar { height: 100%; width: 40%; background: linear-gradient(90deg, var(--pco-teal), var(--pco-gold)); border-radius: 8px; animation: pco-load 1.1s ease-in-out infinite; }
@keyframes pco-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.pco-actions { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
.pco-actions-secondary { margin-top: 4px; }
.pco-btn {
  appearance: none; border: none; cursor: pointer;
  padding: 14px 20px; border-radius: 14px; font-size: 16px; font-weight: 700;
  font-family: inherit; color: var(--pco-ink);
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.pco-btn:active { transform: scale(.97); }
.pco-btn-primary { background: linear-gradient(135deg, var(--pco-teal), #1fae9f); box-shadow: 0 10px 24px rgba(43,211,196,.3); color: #04211d; }
.pco-btn-primary:hover { filter: brightness(1.08); }
.pco-btn-cash { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: var(--pco-ink-dim); }
.pco-btn-cash.is-disabled, .pco-btn-cash:disabled { opacity: .55; cursor: not-allowed; }
.pco-btn-ghost { background: rgba(255,255,255,.05); border: 1px solid var(--pco-panel-line); color: var(--pco-ink); }
.pco-btn-ghost:hover { background: rgba(255,255,255,.09); }

.pco-jackpot-teaser {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 14px 0 6px; padding: 10px 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(242,185,59,.14), rgba(43,211,196,.1));
  border: 1px solid rgba(242,185,59,.3);
}
.pco-jackpot-teaser-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--pco-gold-soft); }
.pco-jackpot-teaser-value { font-size: 22px; font-weight: 800; color: var(--pco-gold); font-variant-numeric: tabular-nums; }
.pco-jackpot-teaser-unit { font-size: 12px; color: var(--pco-ink-dim); }

.pco-fineprint { margin-top: 14px; font-size: 11px; color: var(--pco-ink-dim); opacity: .8; line-height: 1.5; }
.pco-version::before { content: 'v' attr(data-v); }

.pco-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--pco-panel-line); background: rgba(255,255,255,.06);
  color: var(--pco-ink); font-size: 20px; line-height: 1; cursor: pointer;
}

.pco-h2 { margin: 0 0 14px; font-size: 22px; font-weight: 800; color: var(--pco-ink); }
.pco-h3 { margin: 18px 0 8px; font-size: 15px; color: var(--pco-gold-soft); text-transform: uppercase; letter-spacing: .06em; }
.pco-h3:first-child { margin-top: 0; }
.pco-body { font-size: 14px; line-height: 1.6; color: var(--pco-ink-dim); margin: 0 0 10px; }
.pco-list { margin: 0; padding-left: 18px; color: var(--pco-ink-dim); font-size: 14px; line-height: 1.7; }
.pco-list b { color: var(--pco-ink); }

.pco-help-cols { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 720px) {
  .pco-help-cols { grid-template-columns: 1.1fr 1fr; }
}

.pco-paytable { display: flex; flex-direction: column; gap: 8px; }
.pco-pay-row {
  display: grid; grid-template-columns: 44px 1fr repeat(3, 56px);
  align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 10px; background: var(--pco-cell);
  font-size: 13px;
}
.pco-pay-glyph { font-size: 24px; text-align: center; }
.pco-pay-name { color: var(--pco-ink); font-weight: 600; }
.pco-pay-name small { display: block; color: var(--pco-ink-dim); font-weight: 400; font-size: 11px; }
.pco-pay-mult { text-align: right; font-variant-numeric: tabular-nums; color: var(--pco-gold-soft); }
.pco-pay-head { color: var(--pco-ink-dim); font-size: 11px; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   Play screen
   -------------------------------------------------------------------------- */
#screen-play.pco-screen {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  display: none;
  background: transparent;
}
#screen-play.pco-screen.is-open { display: flex; opacity: 1; transform: none; }

.pco-play {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(10px + var(--pco-safe-t)) calc(12px + var(--pco-safe-r)) calc(14px + var(--pco-safe-b)) calc(12px + var(--pco-safe-l));
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.pco-topbar { display: flex; align-items: center; gap: 8px; }
.pco-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 12px;
  border-radius: 12px; background: var(--pco-chip); border: 1px solid var(--pco-panel-line);
}
.pco-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--pco-ink-dim); }
.pco-chip-value { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pco-chip-unit { font-size: 11px; color: var(--pco-mint); }
.pco-flash-error { animation: pco-flash-error .5s ease; }
@keyframes pco-flash-error {
  0%, 100% { color: var(--pco-ink); transform: none; }
  30% { color: var(--pco-red); transform: scale(1.12); }
}

.pco-jackpot-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(242,185,59,.16), rgba(43,211,196,.08));
  border: 1px solid rgba(242,185,59,.35); flex: 1; justify-content: center; overflow: hidden;
}
.pco-jackpot-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--pco-gold-soft); }
.pco-jackpot-chip-value { font-size: 16px; font-weight: 800; color: var(--pco-gold); font-variant-numeric: tabular-nums; white-space: nowrap; }

.pco-topbar-right { display: flex; gap: 6px; }
.pco-icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--pco-panel-line);
  background: var(--pco-chip); color: var(--pco-ink); font-size: 16px; cursor: pointer;
}

.pco-freespin-banner {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-radius: 12px; font-size: 13px; font-weight: 700;
  background: linear-gradient(90deg, rgba(76,224,179,.2), rgba(27,77,115,.35));
  border: 1px solid rgba(76,224,179,.4); color: var(--pco-mint); letter-spacing: .04em;
  animation: pco-pulse-glow 1.6s ease-in-out infinite;
}
.pco-freespin-banner[hidden] { display: none; }
.pco-freespin-banner strong { font-size: 17px; color: var(--pco-ink); }
@keyframes pco-pulse-glow { 0%, 100% { box-shadow: 0 0 0 rgba(76,224,179,0); } 50% { box-shadow: 0 0 16px rgba(76,224,179,.45); } }

.pco-reel-frame {
  position: relative;
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(180deg, var(--pco-bg-2), var(--pco-bg-1));
  border: 1px solid var(--pco-panel-line);
  box-shadow: inset 0 0 30px rgba(0,0,0,.4);
}

.pco-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.pco-reel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--pco-cell);
  aspect-ratio: 1 / 3;
}
.pco-reel-strip {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.pco-cell-sym {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(26px, 8vw, 40px);
  line-height: 1;
  position: relative;
}
.pco-cell-sym.is-win {
  animation: pco-cell-pop 1s ease-in-out infinite;
}
.pco-cell-sym.is-win::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 8px;
  border: 2px solid var(--pco-gold);
  box-shadow: 0 0 14px rgba(242,185,59,.7), inset 0 0 10px rgba(242,185,59,.35);
  pointer-events: none;
}
@keyframes pco-cell-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.pco-win-overlay {
  position: absolute; inset: 10px;
  pointer-events: none;
}
.pco-win-line {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px currentColor);
  opacity: .85;
}

.pco-spin-flash {
  position: absolute; inset: 0; border-radius: 18px;
  background: radial-gradient(circle, rgba(255,255,255,.35), transparent 60%);
  opacity: 0; pointer-events: none;
}
.pco-spin-flash.is-flashing { animation: pco-flash .5s ease-out; }
@keyframes pco-flash { 0% { opacity: .9; } 100% { opacity: 0; } }

.pco-win-banner {
  text-align: center; font-size: 20px; font-weight: 800; padding: 8px;
  border-radius: 12px; color: var(--pco-bg-0);
  background: linear-gradient(90deg, var(--pco-gold), var(--pco-gold-soft));
  box-shadow: 0 6px 18px rgba(242,185,59,.4);
  animation: pco-banner-in .35s ease;
}
.pco-win-banner[hidden] { display: none; }
@keyframes pco-banner-in { from { transform: translateY(-8px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.pco-win-list { display: flex; flex-direction: column; gap: 4px; max-height: 96px; overflow-y: auto; font-size: 12px; }
.pco-win-list:empty { display: none; }
.pco-win-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 8px; background: var(--pco-cell); color: var(--pco-ink-dim);
}
.pco-win-row b { color: var(--pco-gold-soft); }

.pco-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pco-control-group {
  background: var(--pco-chip); border: 1px solid var(--pco-panel-line); border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pco-control-total { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; padding: 10px 14px; }
.pco-control-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--pco-ink-dim); }
.pco-total-value { font-size: 18px; font-weight: 800; color: var(--pco-mint); font-variant-numeric: tabular-nums; }

.pco-stepper { display: flex; align-items: center; gap: 10px; }
.pco-stepper-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: var(--pco-ink); font-size: 18px; line-height: 1;
}
.pco-stepper-btn:active { transform: scale(.92); }
.pco-stepper-btn:disabled { opacity: .35; cursor: not-allowed; }
.pco-stepper-value { min-width: 44px; text-align: center; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pco-presets { display: flex; gap: 4px; }
.pco-preset-btn {
  border: 1px solid var(--pco-panel-line); background: transparent; color: var(--pco-ink-dim);
  border-radius: 8px; padding: 3px 9px; font-size: 11px; cursor: pointer;
}
.pco-preset-btn.is-active { background: rgba(242,185,59,.18); border-color: var(--pco-gold); color: var(--pco-gold-soft); }

.pco-spin-btn {
  appearance: none; border: none; cursor: pointer;
  padding: 16px; border-radius: 16px; font-size: 20px; font-weight: 900; letter-spacing: .08em;
  color: var(--pco-bg-0);
  background: linear-gradient(135deg, var(--pco-gold), var(--pco-teal));
  box-shadow: 0 12px 26px rgba(43,211,196,.3);
  transition: transform .1s ease, filter .1s ease, opacity .15s ease;
}
.pco-spin-btn:active { transform: scale(.97); }
.pco-spin-btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.3); }

.pco-stats-strip {
  display: flex; justify-content: center; gap: 18px; font-size: 12px; color: var(--pco-ink-dim); padding-bottom: 4px;
}
.pco-stats-strip b { color: var(--pco-ink); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Bonus pick round
   -------------------------------------------------------------------------- */
.pco-bonus-stats { display: flex; justify-content: center; gap: 24px; margin: 14px 0; }
.pco-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pco-stat-label { font-size: 11px; color: var(--pco-ink-dim); text-transform: uppercase; letter-spacing: .05em; }
.pco-stat-value { font-size: 20px; font-weight: 800; color: var(--pco-gold-soft); font-variant-numeric: tabular-nums; }

.pco-bonus-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 6px 0 18px;
}
.pco-bonus-tile {
  aspect-ratio: 1; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--pco-navy), #123a56);
  color: var(--pco-ink); font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease, background .25s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
}
.pco-bonus-tile:not(:disabled):hover { transform: translateY(-2px); }
.pco-bonus-tile:disabled { cursor: default; }
.pco-bonus-tile.is-revealed {
  background: linear-gradient(145deg, var(--pco-gold), var(--pco-gold-soft));
  color: var(--pco-bg-0);
  animation: pco-tile-reveal .4s ease;
}
@keyframes pco-tile-reveal { 0% { transform: scale(.7) rotateY(90deg); } 100% { transform: none; } }

/* --------------------------------------------------------------------------
   Jackpot celebration
   -------------------------------------------------------------------------- */
#screen-jackpot.pco-screen {
  background: radial-gradient(circle at 50% 40%, rgba(242,185,59,.25), rgba(5,19,31,.96) 65%);
}
.pco-jackpot-celebrate { text-align: center; }
.pco-jackpot-gems { font-size: 40px; letter-spacing: 8px; margin-bottom: 6px; animation: pco-gem-bounce 1s ease-in-out infinite; }
@keyframes pco-gem-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.pco-jackpot-title {
  font-size: clamp(40px, 12vw, 72px); font-weight: 900; margin: 0;
  background: linear-gradient(135deg, var(--pco-gold), #fff 50%, var(--pco-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pco-shimmer 1.4s linear infinite;
  background-size: 200% auto;
}
@keyframes pco-shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.pco-jackpot-amount { font-size: clamp(22px, 6vw, 32px); font-weight: 800; color: var(--pco-ink); margin: 10px 0 26px; font-variant-numeric: tabular-nums; }

@media (min-width: 480px) {
  .pco-controls { grid-template-columns: 1fr 1fr; }
}


/* Shown while the reels turn waiting on the server's outcome (SMO mode only). Softened so
   the swap between symbols reads as motion rather than a flicker. */
.pco-cell--blur, .pco-cell--blur .pco-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .pco-cell--blur, .pco-cell--blur .pco-glyph { filter: none; opacity: 0.8; }
}
