/* ═══════════════════════════════════════════════════════════
   Bearsconian — standalone styles
   Merged from lukesconian/style.css + bearsconian/style.css
   with portfolio-specific bits removed.
   ═══════════════════════════════════════════════════════════ */

/* --- Base (from lukesconian/style.css) -------------------- */
:root {
  color-scheme: dark;
  --bearsconian-vh: 100vh;
}

* {
  box-sizing: border-box;
}

/* Respect hidden attributes for modal/panels. */
[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "VT323", monospace;
  letter-spacing: 0.3px;
  background: #000 !important;
  color: #e8ecf8;
}

/* Force pixel font across all Bearsconian UI chrome. */
body,
body *:not(canvas) {
  font-family: "VT323", monospace !important;
}

button,
input,
.leaderboard-panel,
.game-overlay-panel,
.name-entry-card {
  font-family: "VT323", monospace;
}

/* --- Game shell ------------------------------------------- */
.game-shell {
  padding: 0;
  width: 100vw;
  height: var(--bearsconian-vh);
  min-height: var(--bearsconian-vh);
  background: #000 !important;
}

.game-frame {
  position: relative;
  border: none;
  border-radius: 0;
  padding: 0;
  width: 100vw;
  height: var(--bearsconian-vh);
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000 !important;
}

#game {
  display: block;
  width: min(100vw, calc(var(--bearsconian-vh) * 1.3));
  height: min(var(--bearsconian-vh), calc(100vw / 1.3));
  max-width: 100vw;
  max-height: var(--bearsconian-vh);
  border: none;
  border-radius: 0;
  background: #000 !important;
}

/* Keep aspect ratio in Fullscreen API mode. */
.game-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  border: none;
  padding: 0;
  background: #04060d;
}

.game-frame:fullscreen #game {
  width: min(100vw, calc(var(--bearsconian-vh) * 1.3));
  height: min(var(--bearsconian-vh), calc(100vw / 1.3));
  max-width: 100vw;
  max-height: var(--bearsconian-vh);
}

/* Desktop browser-window fill mode (not OS fullscreen). */
@media (min-width: 900px) {
  body.window-fill .game-shell {
    padding: 0;
    min-height: 100vh;
  }

  body.window-fill .game-header,
  body.window-fill .controls,
  body.window-fill .touch-controls {
    display: none;
  }

  body.window-fill .game-frame {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    min-height: 0;
    border: none;
    border-radius: 0;
    padding: 0;
    z-index: 2000;
  }

  body.window-fill #game {
    width: min(100vw, calc(100vh * 1.3));
    height: min(100vh, calc(100vw / 1.3));
    max-width: none;
    border-radius: 0;
  }

  body.window-fill .fullscreen-btn {
    right: 1rem;
    bottom: 1rem;
  }

  body.window-fill .leaderboard-panel {
    right: 1rem;
    top: 1rem;
  }

  body.window-fill .game-overlay-panel {
    left: 1rem;
    top: 1rem;
  }
}

/* --- Overlay panels --------------------------------------- */
.game-overlay-panel {
  position: absolute;
  left: 0.9rem;
  top: 0.9rem;
  max-width: 340px;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(7, 10, 18, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 4;
}

.game-overlay-panel h2 {
  margin: 0 0 0.35rem;
}

.game-overlay-panel p {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: #cad2ea;
}

.game-overlay-panel.is-game-over {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* --- Menu / buttons --------------------------------------- */
.menu-actions {
  display: flex;
  gap: 0.5rem;
}

.menu-actions button,
.name-entry-actions button,
.touch-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(17, 24, 38, 0.9);
  color: #f2f5ff;
  font-weight: 700;
  cursor: pointer;
  padding: 0.52rem 0.75rem;
}

.menu-actions button:hover,
.name-entry-actions button:hover,
.touch-btn:hover {
  border-color: #ff9a42;
  background: rgba(199, 91, 18, 0.28);
}

/* --- Leaderboard ------------------------------------------ */
.leaderboard-panel {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 230px;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: rgba(5, 8, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  z-index: 7;
}

.leaderboard-panel h3 {
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  color: #ffd3a8;
}

.leaderboard-panel ol {
  margin: 0;
  padding: 0 0 0 1.1rem;
  max-height: 190px;
  overflow: auto;
  font-size: 0.78rem;
}

.leaderboard-panel li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.18rem;
  color: #dde4f6;
}

/* --- Title screen ----------------------------------------- */
.title-screen {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
}

.title-splash-media {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.title-splash-image,
.title-splash-video {
  width: 100%;
  height: 100%;
  max-height: none;
  image-rendering: auto;
  object-fit: cover;
  display: block;
}

.title-splash-video {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.title-screen.is-video-ready .title-splash-video {
  opacity: 1;
}

/* --- Post-game scores ------------------------------------- */
.postgame-scores-screen {
  position: absolute;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.84);
  padding: 1rem;
}

.postgame-scores-card {
  width: min(92vw, 520px);
  max-height: 84vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  background: rgba(7, 10, 18, 0.92);
  padding: 1rem 1.1rem;
  text-align: center;
}

.postgame-scores-card h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  letter-spacing: 1.5px;
  color: #ffb266;
}

.postgame-scores-card ol {
  margin: 0 auto 0.9rem;
  padding: 0 0 0 1.3rem;
  width: min(92%, 360px);
  text-align: left;
}

.postgame-scores-card li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  color: #f2f5ff;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  margin-bottom: 0.16rem;
}

.postgame-scores-screen .continue-prompt {
  margin-top: 0.4rem;
}

/* --- Continue prompt -------------------------------------- */
.continue-prompt {
  margin: 0;
  color: #f8fbff;
  font-size: clamp(1.4rem, 2.8vw, 2.4rem);
  letter-spacing: 1.2px;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.24);
}

.continue-prompt.is-armed {
  animation: continuePromptPulse 1s ease-in-out infinite;
}

.title-screen .continue-prompt {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  z-index: 2;
  white-space: nowrap;
}

@keyframes continuePromptPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.36; }
}

/* --- Quick actions (mute / fullscreen) -------------------- */
.quick-actions {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 0.55rem;
  z-index: 2600;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #eaf1ff;
  font-size: 1.18rem;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(16, 22, 40, 0.65);
  opacity: 0.88;
}

.quick-actions .fullscreen-btn,
.quick-actions .mute-btn {
  position: static;
  right: auto;
  bottom: auto;
  margin: 0;
}

.icon-btn.is-on {
  color: #ffcf75;
  opacity: 1;
}

.icon-btn:active {
  transform: scale(0.95);
}

/* --- Name entry modal ------------------------------------- */
.name-entry-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  z-index: 3000;
}

.name-entry-card {
  width: min(94vw, 360px);
  background: #0c1220;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 1rem;
}

.name-entry-card h3 {
  margin: 0 0 0.45rem;
}

.name-entry-card p {
  margin: 0 0 0.55rem;
  color: #d0d7ec;
}

.name-entry-card label {
  font-size: 0.82rem;
  color: #b4bfdc;
}

#initials-input {
  width: 100%;
  margin-top: 0.35rem;
  margin-bottom: 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  padding: 0.62rem 0.7rem;
  font-size: 1rem;
  text-transform: uppercase;
}

.name-entry-actions {
  display: flex;
  gap: 0.55rem;
}

/* --- Install help modal ----------------------------------- */
.install-help-card {
  text-align: left;
}

.install-help-card h3 {
  margin-top: 0;
}

/* --- Touch controls --------------------------------------- */
.touch-controls {
  position: fixed;
  left: 50%;
  bottom: 0.7rem;
  transform: translateX(-50%);
  z-index: 2500;
  margin-top: 0;
  background: #000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.analog-pad {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  position: relative;
  touch-action: none;
}

.analog-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(31, 40, 63, 0.9), rgba(8, 12, 20, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.analog-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin-left: -26px;
  margin-top: -26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
  transition: transform 0.06s ease-out;
}

.touch-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.touch-btn {
  min-width: 120px;
}

/* --- Responsive ------------------------------------------- */
@media (min-width: 900px) {
  .touch-controls {
    display: none;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .game-shell {
    display: block;
    height: var(--bearsconian-vh);
    padding-bottom: 0;
  }

  .game-frame {
    align-items: center;
    justify-content: center;
    height: var(--bearsconian-vh);
  }

  #game {
    width: min(100vw, calc(var(--bearsconian-vh) * 1.3));
    height: min(var(--bearsconian-vh), calc(100vw / 1.3));
    margin-top: 0;
  }

  .touch-controls {
    width: 100vw;
    left: 50%;
    bottom: max(6px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    justify-content: center;
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    pointer-events: none;
  }

  .analog-pad {
    width: 124px;
    height: 124px;
    position: fixed;
    left: 12vw;
    top: 74vh;
    opacity: 0.34;
    transition: opacity 90ms ease, filter 90ms ease;
    filter: saturate(0.92);
  }

  .analog-pad.is-floating-active {
    opacity: 1;
    filter: saturate(1.08);
  }

  .analog-knob {
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
  }

  .touch-actions {
    pointer-events: auto;
  }

  .game-overlay-panel {
    max-width: min(300px, 82vw);
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .game-shell {
    height: var(--bearsconian-vh);
    padding-bottom: max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom)));
  }

  .game-frame {
    align-items: flex-start;
    justify-content: center;
  }

  #game {
    height: calc(var(--bearsconian-vh) - 230px);
    width: calc((var(--bearsconian-vh) - 230px) * 1.3);
    max-width: none;
    max-height: none;
  }

  .title-screen .continue-prompt {
    bottom: max(72px, calc(var(--bearsconian-vh) * 0.1));
    font-size: clamp(1.25rem, 6vw, 1.8rem);
  }

  .touch-controls {
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom)));
    bottom: 0;
    padding: 0 max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .quick-actions {
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .analog-pad {
    width: min(52vw, calc(max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom))) - 8px));
    height: min(52vw, calc(max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom))) - 8px));
    position: static;
    left: auto;
    top: auto;
    bottom: auto;
    transform: translateY(-12px);
    opacity: 1;
    filter: none;
  }

  .analog-knob {
    width: calc(min(52vw, calc(max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom))) - 8px)) * 0.42);
    height: calc(min(52vw, calc(max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom))) - 8px)) * 0.42);
    margin-left: calc(min(52vw, calc(max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom))) - 8px)) * -0.21);
    margin-top: calc(min(52vw, calc(max(calc(var(--bearsconian-vh) * 0.25), calc(var(--bearsconian-vh) * 0.24 + env(safe-area-inset-bottom))) - 8px)) * -0.21);
  }

  .touch-actions {
    display: none;
  }
}
