/* Ocean UI asset theme — Octozone
   Paths are relative to the HTML document root. */

:root {
  --ui-deep: #071124;
  --ui-deep-2: #0a1a33;
  --ui-cyan: #4ad7ff;
  --ui-cyan-soft: #7ee7ff;
  --ui-purple: #9b59b6;
  --ui-purple-deep: #6f4bd8;
  --ui-gold: #ffd24a;
  --ui-danger: #e74c3c;
  --ui-text: #ffffff;
  --ui-muted: rgba(255, 255, 255, 0.72);
  --ui-radius: 16px;
  --ui-radius-btn: 12px;
  --ui-panel-bg: url("panel-glass.svg");
  --ui-overlay: url("overlay-wash.svg");
  --ui-btn-primary: url("btn-primary.svg");
  --ui-btn-secondary: url("btn-secondary.svg");
  --ui-btn-play: url("btn-play.svg");
  --ui-btn-danger: url("btn-danger.svg");
  --ui-chip: url("chip-pill.svg");
  --ui-score-pill: url("hud-score-pill.svg");
  --ui-toggle-on: url("toggle-on.svg");
  --ui-toggle-off: url("toggle-off.svg");
  --ui-font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

/* ----- Icon helpers ----- */
.ui-icon {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  flex: none;
  align-self: center;
  pointer-events: none;
}
.ui-icon.lg { width: 1.55em; height: 1.55em; }
.ui-icon.xl { width: 2em; height: 2em; }
.ui-icon.sm { width: 0.95em; height: 0.95em; }

.ui-icon-settings { background-image: url("icon-settings.svg"); }
.ui-icon-play { background-image: url("icon-play.svg"); }
.ui-icon-sound-on { background-image: url("icon-sound-on.svg"); }
.ui-icon-sound-off { background-image: url("icon-sound-off.svg"); }
.ui-icon-mode-click { background-image: url("icon-mode-click.svg"); }
.ui-icon-mode-joystick { background-image: url("icon-mode-joystick.svg"); }
.ui-icon-mode-float { background-image: url("icon-mode-float.svg"); }
.ui-icon-back { background-image: url("icon-back.svg"); }
.ui-icon-rooms { background-image: url("icon-rooms.svg"); }
.ui-icon-howto { background-image: url("icon-howto.svg"); }
.ui-icon-leave { background-image: url("icon-leave.svg"); }
.ui-icon-refresh { background-image: url("icon-refresh.svg"); }
.ui-icon-close { background-image: url("icon-close.svg"); }
.ui-icon-reach { background-image: url("icon-reach.svg"); }
.ui-icon-create { background-image: url("icon-create.svg"); }
.ui-icon-replay { background-image: url("icon-replay.svg"); }

.ui-btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
}

/* ----- Translucent menu panels ----- */
.panel,
#settingsScreen,
#howToPlayScreen {
  background-color: rgba(7, 17, 36, 0.78) !important;
  background-image: var(--ui-panel-bg) !important;
  background-size: 100% 100% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 1px solid rgba(120, 180, 255, 0.22) !important;
  border-radius: var(--ui-radius) !important;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Keep in-game HUD panels clear of heavy chrome */
#leaderPanel.panel,
#minimapWrap.panel,
#roomChip.panel,
#trackChip.panel {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
#leaderPanel.panel,
#minimapWrap.panel,
#trackChip.panel {
  overflow: visible !important;
}

#ui .joy-action,
#joystickHud .joy-action {
  background-image: none !important;
  overflow: visible;
}

#startScreen.panel::before,
#gameOver.panel::before,
#roomBrowser.panel::before,
#leaveConfirm.panel::before,
#settingsScreen::before,
#howToPlayScreen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    url("frame-corner.svg") left 8px top 8px / 22px 22px no-repeat,
    url("frame-corner.svg") right 8px top 8px / 22px 22px no-repeat;
  opacity: 0.55;
}
#startScreen.panel > *,
#gameOver.panel > *,
#roomBrowser.panel > *,
#leaveConfirm.panel > *,
#settingsScreen > *,
#howToPlayScreen > * {
  position: relative;
  z-index: 1;
}

#settingsOverlay,
#howToPlayOverlay {
  background-color: rgba(0, 8, 20, 0.5) !important;
  background-image: var(--ui-overlay) !important;
  background-size: cover !important;
  background-position: center !important;
}

/* ----- Brand / titles ----- */
#startScreen h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--ui-font);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 14px rgba(74, 215, 255, 0.25);
}
#startScreen h1::before {
  content: "";
  width: clamp(52px, 14vw, 72px);
  height: clamp(52px, 14vw, 72px);
  background: url("brand-mark.svg") center / contain no-repeat;
  filter: drop-shadow(0 4px 12px rgba(155, 89, 182, 0.45));
}
#startScreen input[type="text"],
#startScreen .btn-col button {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
}
#startScreen .btn-col button {
  padding: 11px 20px !important;
}

#gameOver h2,
#roomBrowser h2,
#settingsScreen h2,
#howToPlayScreen h2 {
  font-family: var(--ui-font);
  font-weight: 800;
  letter-spacing: 0.03em;
}

/* ----- Buttons ----- */
#ui button,
#settingsScreen button,
#howToPlayScreen button {
  appearance: none;
  border: 0;
  border-radius: var(--ui-radius-btn);
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--ui-font);
  cursor: pointer;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  line-height: 1.2;
  background-color: transparent;
  background-image: var(--ui-btn-primary);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-origin: border-box;
  background-clip: border-box;
  box-shadow: 0 4px 14px rgba(111, 75, 216, 0.35);
  transition: filter 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
#ui button:hover,
#settingsScreen button:hover,
#howToPlayScreen button:hover {
  filter: brightness(1.1);
}
#ui button:active,
#settingsScreen button:active,
#howToPlayScreen button:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.96);
}
#ui button.secondary,
#settingsScreen button.secondary,
#howToPlayScreen button.secondary {
  background-image: var(--ui-btn-secondary);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(154, 223, 255, 0.28);
}
#ui button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

#playNowBtn,
#respawnBtn {
  background-image: var(--ui-btn-play) !important;
  background-size: 100% 100% !important;
  background-origin: border-box !important;
  background-clip: border-box !important;
  box-shadow: 0 4px 16px rgba(74, 215, 255, 0.32) !important;
  color: #042030 !important;
  font-size: clamp(15px, 3.6vw, 17px);
  padding: 12px 22px !important;
  letter-spacing: 0.02em;
}

#gameOver .btn-row,
#leaveConfirm .btn-row {
  display: flex;
  gap: 10px;
  justify-content: stretch;
  align-items: stretch;
  width: 100%;
}
#gameOver .btn-row #respawnBtn,
#gameOver .btn-row #goLeaveBtn,
#leaveConfirm .btn-row button {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  padding: 11px 8px !important;
  white-space: nowrap;
  font-size: 14px;
}
#gameOver .btn-row .ui-icon,
#leaveConfirm .btn-row .ui-icon {
  width: 1em;
  height: 1em;
}

.settings-leave-btn,
#leaveConfirmBtn {
  background-image: var(--ui-btn-danger) !important;
  box-shadow: 0 4px 14px rgba(231, 76, 60, 0.35) !important;
  border: none !important;
}

/* Mode cards keep selectable chrome */
.mode-card {
  background-image: none !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
  box-shadow: none !important;
  border: 2px solid rgba(255, 255, 255, 0.12) !important;
}
.mode-card.selected {
  border-color: rgba(155, 89, 182, 0.95) !important;
  background-color: rgba(155, 89, 182, 0.2) !important;
}
#modeCardJoy.selected {
  border-color: rgba(74, 215, 255, 0.95) !important;
  background-color: rgba(74, 215, 255, 0.16) !important;
}
#modeCardFree.selected {
  border-color: rgba(126, 217, 87, 0.95) !important;
  background-color: rgba(126, 217, 87, 0.16) !important;
}
.mode-card .mode-icon.ui-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
}

.settings-action-btn {
  background-image: var(--ui-btn-secondary) !important;
  background-size: 100% 100% !important;
  box-shadow: none !important;
  border: 0 !important;
}

#roomsRefreshBtn {
  width: 42px;
  min-width: 42px;
  padding: 9px 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ----- Toggles (sound / reach) ----- */
.settings-toggle {
  width: 64px !important;
  min-width: 64px !important;
  height: 32px !important;
  min-height: 32px;
  padding: 0 !important;
  border-radius: 999px !important;
  background-color: transparent !important;
  background-image: var(--ui-toggle-off) !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: none !important;
  box-shadow: none !important;
  overflow: hidden;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.settings-toggle.on {
  background-image: var(--ui-toggle-on) !important;
  color: #042030 !important;
}

.settings-toggle-row .ui-icon {
  width: 22px;
  height: 22px;
  margin-right: 2px;
}

#soundToggleRow .settings-toggle-copy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* ----- HUD chrome ----- */
#scoreBoard {
  display: none;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.38) !important;
  background-image: var(--ui-score-pill) !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  overflow: hidden;
  font-family: var(--ui-font);
}
body.playing #scoreBoard {
  display: flex !important;
}

#roomChip {
  background-image: var(--ui-chip) !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
  background-color: rgba(0, 0, 0, 0.32) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  overflow: hidden;
}

#hudSettingsBtn {
  width: 2.2em !important;
  height: 2.2em !important;
  min-width: 2.2em !important;
  padding: 0 !important;
  border-radius: 999px !important;
  background-color: rgba(8, 18, 36, 0.45) !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
  font-size: clamp(13px, 3vw, 15px) !important;
  color: #fff !important;
}
#hudSettingsBtn .ui-icon {
  display: block;
  width: 1.15em;
  height: 1.15em;
}

#hudSoundBtn {
  box-sizing: border-box;
  width: 2.2em;
  height: 2.2em;
  min-width: 2.2em;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(8, 18, 36, 0.45) !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}
#hudSoundBtn .ui-icon {
  width: 1.15em;
  height: 1.15em;
}

#startScreen button,
#gameOver button,
#leaveConfirm button,
#settingsScreen .settings-back-row button,
#settingsScreen .settings-action-btn,
#settingsScreen .settings-leave-btn,
#howToPlayScreen .howto-back-row button {
  min-height: 44px;
}

/* Inputs */
#ui input[type="text"] {
  font-family: var(--ui-font);
  min-height: 44px;
  line-height: 1.25;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(154, 223, 255, 0.22);
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}
#ui input[type="text"]:focus {
  border-color: rgba(74, 215, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(74, 215, 255, 0.18);
}

/* How-to icons use asset sprites when present */
.howto-icon.swim { background-image: url("icon-mode-float.svg"); background-size: 22px; background-repeat: no-repeat; background-position: center; }
.howto-icon.eat { background-image: url("icon-play.svg"); background-size: 22px; background-repeat: no-repeat; background-position: center; }
.howto-icon.fight { background-image: url("icon-mode-click.svg"); background-size: 22px; background-repeat: no-repeat; background-position: center; }
.howto-icon.safe { background-image: url("icon-leave.svg"); background-size: 20px; background-repeat: no-repeat; background-position: center; }
.howto-icon svg { opacity: 0; }

.settings-action-icon {
  background: transparent !important;
  border: none !important;
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
}
.settings-action-icon.ui-icon {
  display: inline-block;
}

/* Responsive */
@media (max-width: 640px) {
  :root { --ui-radius: 14px; }
  #ui button,
  #settingsScreen button,
  #howToPlayScreen button {
    padding: 11px 16px;
    font-size: 14px;
  }
  #playNowBtn, #respawnBtn { padding: 12px 18px; }
  #startScreen.panel::before { background-size: 22px 22px; }
  #hudSettingsBtn,
  #hudSoundBtn {
    width: 2.35em;
    height: 2.35em;
    min-width: 2.35em;
  }
}
@media (max-width: 400px) {
  #startScreen, #gameOver, #roomBrowser { padding: 18px 14px; }
  .settings-toggle { min-width: 64px !important; }
}
@media (prefers-reduced-motion: reduce) {
  #ui button,
  #settingsScreen button,
  #howToPlayScreen button {
    transition: none;
  }
}
