/* aquarium.css — self-contained styling for the Florbis overlay.
 *
 * Neutral/dark on purpose: the site's design tokens get matched in a later
 * phase. Everything is scoped under .florbis-* so it won't bleed into the page.
 */

/* Full-screen overlay above everything. */
.florbis-overlay {
  position: fixed;
  inset: 0;
  height: 100vh;   /* fallback */
  height: 100dvh;  /* fill the DYNAMIC viewport on mobile (under the toolbars) */
  z-index: 2147483000; /* very high; sits above site chrome */
  background: #0b0d14;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #e8ecf4;
  /* critical for Pointer-Events pan/pinch: stop the browser eating gestures */
  touch-action: none;
  user-select: none;
}

/* The Pixi canvas fills the overlay. */
.florbis-overlay .florbis-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Close "×" button (top-right). */
.florbis-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 24, 34, 0.72);
  color: #e8ecf4;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.florbis-close:hover {
  background: rgba(40, 46, 60, 0.9);
  transform: scale(1.06);
}
.florbis-close:active { transform: scale(0.96); }

/* Fullscreen "⛶" toggle (sits just left of the × close button). */
.florbis-fullscreen {
  position: absolute;
  top: 14px;
  right: 68px; /* 16 (close right) + 44 (close width) + 8 (gap) */
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 24, 34, 0.72);
  color: #e8ecf4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.florbis-fullscreen:hover {
  background: rgba(40, 46, 60, 0.9);
  transform: scale(1.06);
}
.florbis-fullscreen:active { transform: scale(0.96); }

/* Era HUD badge (top-left). Subtle, transparent, non-interactive. */
.florbis-hud {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 9;
  max-width: calc(100vw - 140px);
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(16, 20, 30, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8ecf4;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(4px);
  pointer-events: none; /* never intercept pan/click on the scene */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Loading spinner (shown until the engine canvas is up). */
.florbis-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border: 5px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ffe08a;
  border-radius: 50%;
  animation: florbis-spin 0.9s linear infinite;
  z-index: 5;
}
@keyframes florbis-spin { to { transform: rotate(360deg); } }

/* Info card (inspect) — bottom-left panel. */
.florbis-card {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  min-width: 220px;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(16, 20, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
}
.florbis-card-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffe08a;
  margin-bottom: 4px;
}
.florbis-card-meta { font-size: 14px; color: #cdd5e4; }
.florbis-card-type {
  margin-top: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b97ad;
}

/* Bubble layer container (absolute children positioned per-frame). */
.florbis-bubbles {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none; /* never block pan/click on the canvas */
}

/* Individual speech/thought bubbles. left/top set in JS = critter head;
 * translate puts the tail tip at that point and floats the body above. */
.florbis-bubble {
  position: absolute;
  transform: translate(-50%, calc(-100% - 12px));
  max-width: 180px;
  padding: 8px 11px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.25;
  color: #14181f;
  background: #f3f5fa;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  white-space: normal;
  text-align: center;
}

/* Speech tail: a little triangle pointing down at the critter. */
.florbis-bubble.is-speech::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 9px solid #f3f5fa;
}

/* Thought bubble: softer color + a couple of "puff" dots for the tail. */
.florbis-bubble.is-thought {
  background: #e6e1f5;
  font-style: italic;
  border-radius: 18px;
}
.florbis-bubble.is-thought::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e6e1f5;
  transform: translateX(-50%);
  box-shadow: -7px 8px 0 -2px #e6e1f5, 5px 6px 0 -3px #e6e1f5;
}

/* ==========================================================================
 * GATE — New / Resume entry form (gate.js). Centered card over the overlay.
 * ======================================================================== */
.florbis-gate {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 26px 26px 24px;
  border-radius: 16px;
  background: rgba(16, 20, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}
.florbis-gate-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #ffe08a;
  margin-bottom: 4px;
}
.florbis-gate-subtitle {
  font-size: 14px;
  line-height: 1.4;
  color: #aab3c5;
  margin-bottom: 18px;
}

/* Tabs. */
.florbis-gate-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.28);
}
.florbis-gate-tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #aab3c5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.florbis-gate-tab:hover { color: #e8ecf4; }
.florbis-gate-tab.is-active {
  background: rgba(255, 224, 138, 0.16);
  color: #ffe08a;
}
.florbis-gate-tab:disabled { cursor: default; opacity: 0.6; }

/* Form fields. */
.florbis-gate-form { display: flex; flex-direction: column; gap: 14px; }
.florbis-gate-field { display: flex; flex-direction: column; gap: 6px; }
.florbis-gate-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8b97ad;
}
.florbis-gate-input {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 10, 16, 0.7);
  color: #e8ecf4;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.florbis-gate-input::placeholder { color: #5d6678; }
.florbis-gate-input:focus {
  border-color: #ffe08a;
  box-shadow: 0 0 0 3px rgba(255, 224, 138, 0.18);
}
.florbis-gate-input:disabled { opacity: 0.6; }

/* Speed selector — stacked option buttons. */
.florbis-gate-speed-opts { display: flex; flex-direction: column; gap: 8px; }
.florbis-gate-speed-opt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-align: left;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 16, 0.5);
  color: #cdd5e4;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.florbis-gate-speed-opt:hover { border-color: rgba(255, 224, 138, 0.45); }
.florbis-gate-speed-opt.is-active {
  border-color: #ffe08a;
  background: rgba(255, 224, 138, 0.12);
  color: #ffe08a;
}
.florbis-gate-speed-opt:disabled { cursor: default; opacity: 0.6; }
.florbis-gate-speed-main { font-weight: 600; }
.florbis-gate-speed-note { font-size: 12px; color: #8b97ad; }

/* Inline error text (hidden until populated). */
.florbis-gate-error {
  display: none;
  font-size: 13.5px;
  line-height: 1.35;
  color: #ff9a8b;
  background: rgba(255, 90, 70, 0.10);
  border: 1px solid rgba(255, 90, 70, 0.35);
  border-radius: 8px;
  padding: 9px 11px;
}
.florbis-gate-error.is-shown { display: block; }

/* Submit button. */
.florbis-gate-submit {
  margin-top: 4px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: #ffe08a;
  color: #1a1d26;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.florbis-gate-submit:hover { background: #ffd470; }
.florbis-gate-submit:active { transform: scale(0.985); }
.florbis-gate-submit:disabled { cursor: default; opacity: 0.7; }

/* Busy state: dim the whole card a touch while a request is in flight. */
.florbis-gate.is-busy { opacity: 0.92; }

/* ==========================================================================
 * "WHILE YOU WERE AWAY" panel (whileAway.js).
 * ======================================================================== */
.florbis-whileaway {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px 26px;
  border-radius: 16px;
  background: rgba(16, 20, 30, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}
.florbis-whileaway-header {
  font-size: 22px;
  font-weight: 800;
  color: #ffe08a;
  margin-bottom: 2px;
}
.florbis-whileaway-sub {
  font-size: 13px;
  color: #8b97ad;
  margin-bottom: 14px;
}
.florbis-whileaway-summary {
  font-size: 15px;
  line-height: 1.45;
  color: #e8ecf4;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(255, 224, 138, 0.10);
  border: 1px solid rgba(255, 224, 138, 0.22);
  margin-bottom: 14px;
}
.florbis-whileaway-log {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-height: 40vh;
  overflow-y: auto;
}
.florbis-whileaway-line {
  font-size: 14px;
  line-height: 1.4;
  color: #cdd5e4;
  padding: 6px 0 6px 16px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.florbis-whileaway-line::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #ffe08a;
}
.florbis-whileaway-empty {
  font-size: 14px;
  color: #8b97ad;
  font-style: italic;
  margin-bottom: 16px;
}
.florbis-whileaway-dismiss {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: #ffe08a;
  color: #1a1d26;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.florbis-whileaway-dismiss:hover { background: #ffd470; }
.florbis-whileaway-dismiss:active { transform: scale(0.985); }

/* Mobile tweaks. */
@media (max-width: 767px) {
  .florbis-card { left: 10px; right: 10px; bottom: 10px; max-width: none; }
  .florbis-hud { font-size: 12.5px; padding: 6px 11px; max-width: calc(100vw - 130px); }
  .florbis-bubble { max-width: 140px; font-size: 12px; }
  .florbis-gate { padding: 22px 18px; }
  .florbis-gate-title { font-size: 26px; }
  .florbis-whileaway { padding: 20px 18px; }
}
