/* ============================================================
   MONX HUNT — Styles
   Appended to styles.css (or import separately)
   ============================================================ */

/* ── Animations ───────────────────────────────────────────── */
@keyframes huntShake {
  0%,100%{transform:translateX(0)} 15%{transform:translateX(-8px)}
  30%{transform:translateX(8px)} 45%{transform:translateX(-6px)}
  60%{transform:translateX(6px)} 75%{transform:translateX(-3px)}
  90%{transform:translateX(3px)}
}
@keyframes huntFlashRed {
  0%,100%{border-color:#2a2a2a} 50%{border-color:#e74c3c}
}
@keyframes huntFlashBlue {
  0%,100%{border-color:#2a2a2a} 50%{border-color:#3CA3E2}
}
@keyframes huntSeqFlash {
  0%,100%{background:#1a1a1a} 50%{background:#3a1a1a}
}
@keyframes huntFadeIn {
  from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)}
}

.shake          { animation: huntShake 0.4s ease; }
.flash-red      { animation: huntFlashRed 0.4s ease; }
.flash-blue     { animation: huntFlashBlue 0.4s ease; }
.seq-flash      { animation: huntSeqFlash 0.4s ease 3; }
.hunt-lb-row    { animation: huntFadeIn 0.3s ease; }

/* ── Root ─────────────────────────────────────────────────── */
.hunt-root {
  background: #0d0d0d;
  color: #fff;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */
.hunt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #2a2a2a;
  background: #111;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}
.hunt-header-left { display: flex; align-items: center; gap: 16px; }
.hunt-header-right { display: flex; gap: 8px; }
.hunt-logo  { font-size: 18px; font-weight: bold; letter-spacing: 2px; color: #fff; }
.hunt-title { font-size: 13px; color: #aaa; letter-spacing: 1px; }
.hunt-hdr-btn {
  background: none;
  border: 1px solid #2a2a2a;
  color: #aaa;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  min-height: 44px; min-width: 44px;
}
.hunt-hdr-btn:hover { border-color: #444; color: #fff; }

/* ── Main layout ──────────────────────────────────────────── */
.hunt-main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
@media (max-width: 767px) {
  .hunt-main-layout { flex-direction: column; }
}

/* ── Image pane ───────────────────────────────────────────── */
.hunt-img-pane {
  flex: 0 0 60%;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
  min-height: 0; /* allow shrinking */
}
@media (max-width: 767px) {
  .hunt-img-pane { flex: none; height: calc(50vw + 36px); min-height: 200px; }
}

.hunt-img-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #000;
  min-height: 0; /* yield space to zoom bar below */
}

.hunt-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform-origin: center center;
  will-change: transform;
}

/* ── Zoom bar ─────────────────────────────────────────────── */
.hunt-zoom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #111;
  border-top: 1px solid #2a2a2a;
  flex-shrink: 0;
}
.hunt-zoom-bar-hidden { /* always show on all devices now */ }
.hunt-zoom-label-text { font-size: 10px; color: #555; letter-spacing: 1px; white-space: nowrap; }
.hunt-zoom-slider     { flex: 1; accent-color: #3CA3E2; cursor: pointer; height: 4px; }
.hunt-zoom-val        { font-size: 10px; color: #555; width: 32px; text-align: right; }
.hunt-zoom-reset {
  background: none;
  border: 1px solid #2a2a2a;
  color: #555;
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
}

/* ── Side pane ────────────────────────────────────────────── */
.hunt-side-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid #2a2a2a;
}
@media (max-width: 767px) {
  .hunt-side-pane { border-left: none; border-top: 1px solid #2a2a2a; }
}

/* ── Shared section helpers ───────────────────────────────── */
.hunt-section   { margin-bottom: 16px; }
.hunt-label     { font-size: 11px; color: #555; letter-spacing: 2px; margin-bottom: 8px; text-transform: uppercase; }
.hunt-hint      { font-size: 10px; color: #555; margin-top: 4px; }
.hunt-tip       { font-size: 10px; color: #555; margin-top: 8px; font-style: italic; line-height: 1.6; }
.hunt-msg       { font-size: 12px; margin-top: 6px; min-height: 18px; transition: color 0.2s; color: #aaa; }
.hunt-counter   { font-size: 12px; color: #555; margin-top: 8px; }

/* ── Handle ───────────────────────────────────────────────── */
.hunt-handle-row    { display: flex; gap: 8px; margin-bottom: 8px; }
.hunt-handle-input  {
  flex: 1; background: #1a1a1a; border: 1px solid #2a2a2a;
  color: #fff; padding: 8px 10px; font-size: 14px;
  font-family: 'Courier New', monospace; outline: none; min-height: 40px;
}
.hunt-save-btn {
  background: none; border: 1px solid #3CA3E2; color: #3CA3E2;
  padding: 8px 12px; cursor: pointer; font-size: 12px;
  font-family: 'Courier New', monospace; min-height: 40px;
}
.hunt-save-btn:disabled { opacity: 0.6; cursor: default; }
.hunt-saved-note { font-size: 11px; color: #2ecc71; }

/* ── Stats bar ────────────────────────────────────────────── */
.hunt-stats-bar { display: flex; gap: 10px; }
.hunt-stats-row { display: flex; gap: 16px; margin-bottom: 20px; }
.hunt-stat-box  { flex: 1; background: #1a1a1a; border: 1px solid #2a2a2a; padding: 8px 4px; text-align: center; }
.hunt-stat-val  { font-size: 18px; }
.hunt-stat-lbl  { font-size: 9px; color: #555; letter-spacing: 1px; }

/* ── Word bank & pills ────────────────────────────────────── */
.hunt-word-bank { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; }
.hunt-pill {
  padding: 5px 10px; font-size: 12px; letter-spacing: 1px;
  border: 1px solid; cursor: pointer; min-height: 32px;
  display: flex; align-items: center;
  font-family: 'Courier New', monospace;
}
.hunt-pill-found    { background: #1a3a2a; color: #2ecc71; border-color: #2ecc71; }
.hunt-pill-selected { background: #1a2a3a; color: #3CA3E2; border-color: #3CA3E2; }
.hunt-pill-unsel    { background: #1a1a1a; color: #fff; border: 1px solid #3CA3E2; cursor: pointer; }

/* ── Input / GO ───────────────────────────────────────────── */
.hunt-input-row { display: flex; gap: 8px; }
.hunt-input {
  flex: 1; background: #1a1a1a; border: 1px solid #2a2a2a;
  color: #fff; padding: 10px 12px; font-size: 16px;
  font-family: 'Courier New', monospace; outline: none; min-height: 44px;
}
.hunt-go-btn {
  background: #3CA3E2; color: #fff; border: none;
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  font-family: 'Courier New', monospace; min-height: 44px; min-width: 44px;
}
.hunt-go-btn:disabled { opacity: 0.5; cursor: wait; }

/* ── Unlock button ────────────────────────────────────────── */
.hunt-unlock-btn {
  background: #1a1a1a; color: #555; border: 1px solid #2a2a2a;
  padding: 14px; font-size: 13px; font-family: 'Courier New', monospace;
  cursor: not-allowed; width: 100%; letter-spacing: 2px; min-height: 44px; margin-top: 8px;
}
.hunt-unlock-btn-active {
  background: #3CA3E2; color: #fff; border-color: #3CA3E2; cursor: pointer;
}
.hunt-unlock-btn:disabled { pointer-events: none; }

/* ── Order view ───────────────────────────────────────────── */
.hunt-order-wrap { padding: 16px; gap: 16px; }
.hunt-order-title { font-size: 13px; color: #aaa; letter-spacing: 1px; }

.hunt-slots {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.hunt-slot {
  background: #1a1a1a; border: 1px dashed #2a2a2a; color: #555;
  padding: 8px 4px; font-size: 11px; font-family: 'Courier New', monospace;
  text-align: center; min-height: 44px; display: flex; align-items: center;
  justify-content: center; letter-spacing: 1px; cursor: default; word-break: break-all;
}
.hunt-slot-filled {
  background: #1a2a3a; border: 1px solid #3CA3E2; color: #3CA3E2; cursor: pointer;
}

.hunt-submit-btn {
  background: #1a1a1a; color: #555; border: 1px solid #2a2a2a;
  padding: 14px; font-size: 13px; font-family: 'Courier New', monospace;
  cursor: not-allowed; flex: 1; letter-spacing: 2px; min-height: 44px;
}
.hunt-submit-btn-active { background: #3CA3E2; color: #fff; border-color: #3CA3E2; cursor: pointer; }
.hunt-submit-btn:disabled { pointer-events: none; }

.hunt-clear-btn {
  background: none; color: #aaa; border: 1px solid #2a2a2a;
  padding: 14px 20px; font-size: 13px; font-family: 'Courier New', monospace;
  cursor: pointer; min-height: 44px;
}
.hunt-back-btn {
  background: none; color: #555; border: 1px solid #2a2a2a;
  padding: 14px; font-size: 11px; font-family: 'Courier New', monospace;
  cursor: pointer; width: 100%; min-height: 44px;
}

/* ── Success overlay ──────────────────────────────────────── */
.hunt-success-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.97);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 20px; z-index: 100; padding: 32px; overflow-y: auto;
}
.hunt-success-check { font-size: 64px; color: #2ecc71; }
.hunt-success-title { font-size: 22px; letter-spacing: 4px; }
.hunt-success-sub   { font-size: 14px; color: #aaa; text-align: center; line-height: 1.8; }
.hunt-tweet-gate    { width: 100%; max-width: 360px; text-align: center; }
.hunt-tweet-label   { font-size: 12px; color: #555; margin-bottom: 12px; letter-spacing: 1px; }
.hunt-tweet-btn     {
  background: #000; color: #fff; border: 1px solid #333;
  padding: 14px; font-size: 13px; font-family: 'Courier New', monospace;
  cursor: pointer; width: 100%; letter-spacing: 2px; min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.hunt-tweet-hint { font-size: 11px; color: #555; margin-top: 8px; }
.hunt-skip-btn {
  background: none; border: none; color: #555; font-size: 11px;
  font-family: 'Courier New', monospace; cursor: pointer; margin-top: 4px; padding: 4px;
}
.hunt-copy-btn {
  background: #2ecc71; color: #000; border: none;
  padding: 14px 32px; font-size: 14px; font-family: 'Courier New', monospace;
  cursor: pointer; letter-spacing: 2px; min-height: 44px;
}

/* ── Modal ────────────────────────────────────────────────── */
.hunt-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.hunt-modal-box {
  background: #1a1a1a; border: 1px solid #2a2a2a; padding: 28px;
  max-width: 420px; width: 100%; max-height: 80vh; overflow-y: auto;
}
.hunt-modal-title { font-size: 14px; letter-spacing: 3px; margin-bottom: 20px; }
.hunt-modal-steps div {
  font-size: 13px; color: #aaa; line-height: 1.9; margin-bottom: 6px;
}
.hunt-modal-tip { font-size: 12px; color: #555; font-style: italic; }
.hunt-gotit-btn {
  background: #3CA3E2; color: #fff; border: none;
  padding: 12px 24px; font-size: 13px; font-family: 'Courier New', monospace;
  cursor: pointer; margin-top: 20px; width: 100%; min-height: 44px;
}

/* ── Leaderboard ──────────────────────────────────────────── */
.hunt-lb-title   { font-size: 13px; letter-spacing: 3px; margin-bottom: 16px; color: #fff; }
.hunt-lb-loading { font-size: 12px; color: #555; }
.hunt-lb-table   { width: 100%; border-collapse: collapse; font-size: 11px; font-family: 'Courier New', monospace; }
.hunt-lb-table th {
  color: #555; padding: 4px 6px; text-align: left;
  border-bottom: 1px solid #2a2a2a; letter-spacing: 1px;
}
.hunt-lb-table td { color: #aaa; padding: 6px 6px; border-bottom: 1px solid #2a2a2a; font-size: 11px; }
.hunt-lb-handle  { color: #3CA3E2; }

/* ── Protocols tab: make the hunt section fill height ─────── */
#protocols .section-content,
#protocols {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Hunt hint popup (in-game score milestone) ────────────── */
@keyframes huntHintFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

/* ============================================================
   MONX HUNT — Light mode overrides
   ============================================================ */

[data-theme="light"] .hunt-root {
  background: #f5f5f5;
  color: #000;
}
[data-theme="light"] .hunt-header {
  background: #fff;
  border-bottom-color: #ddd;
}
[data-theme="light"] .hunt-logo  { color: #000; }
[data-theme="light"] .hunt-title { color: #555; }
[data-theme="light"] .hunt-hdr-btn {
  border-color: #ddd;
  color: #555;
}
[data-theme="light"] .hunt-hdr-btn:hover { border-color: #999; color: #000; }

/* Image pane */
[data-theme="light"] .hunt-img-pane    { background: #e8e8e8; }
[data-theme="light"] .hunt-zoom-bar    { background: #fff; border-top-color: #ddd; }
[data-theme="light"] .hunt-zoom-label-text { color: #999; }
[data-theme="light"] .hunt-zoom-val    { color: #999; }
[data-theme="light"] .hunt-zoom-reset  { border-color: #ddd; color: #999; }

/* Side pane */
[data-theme="light"] .hunt-side-pane   { border-left-color: #ddd; }
[data-theme="light"] .hunt-section     { border-bottom-color: #ddd !important; }
[data-theme="light"] .hunt-label       { color: #999; }
[data-theme="light"] .hunt-hint        { color: #999; }
[data-theme="light"] .hunt-tip         { color: #999; }
[data-theme="light"] .hunt-counter     { color: #999; }
[data-theme="light"] .hunt-msg         { color: #555; }

/* Handle input */
[data-theme="light"] .hunt-handle-input {
  background: #f0f0f0;
  border-color: #ddd;
  color: #000;
}
[data-theme="light"] .hunt-save-btn { border-color: #3CA3E2; color: #3CA3E2; }

/* Stats */
[data-theme="light"] .hunt-stat-box { background: #f0f0f0; border-color: #ddd; }
[data-theme="light"] .hunt-stat-lbl { color: #999; }

/* Word bank pills */
[data-theme="light"] .hunt-pill-found  { background: #e6f9ef; color: #1a8a4a; border-color: #1a8a4a; }
[data-theme="light"] .hunt-pill-unsel  { background: #f0f0f0; color: #000; border-color: #3CA3E2; }
[data-theme="light"] .hunt-pill-selected { background: #e6f2fb; color: #1a6fab; border-color: #1a6fab; }

/* Word input */
[data-theme="light"] .hunt-input {
  background: #f0f0f0;
  border-color: #ddd;
  color: #000;
}
[data-theme="light"] .hunt-go-btn { background: #3CA3E2; color: #fff; }

/* Unlock button */
[data-theme="light"] .hunt-unlock-btn {
  background: #f0f0f0;
  color: #bbb;
  border-color: #ddd;
}
[data-theme="light"] .hunt-unlock-btn-active {
  background: #3CA3E2;
  color: #fff;
  border-color: #3CA3E2;
}

/* Order view */
[data-theme="light"] .hunt-order-title { color: #555; }
[data-theme="light"] .hunt-slot {
  background: #f0f0f0;
  border-color: #ddd;
  color: #999;
}
[data-theme="light"] .hunt-slot-filled {
  background: #e6f2fb;
  border-color: #3CA3E2;
  color: #1a6fab;
}
[data-theme="light"] .hunt-submit-btn {
  background: #f0f0f0;
  color: #bbb;
  border-color: #ddd;
}
[data-theme="light"] .hunt-submit-btn-active {
  background: #3CA3E2;
  color: #fff;
  border-color: #3CA3E2;
}
[data-theme="light"] .hunt-clear-btn { color: #555; border-color: #ddd; }
[data-theme="light"] .hunt-back-btn  { color: #999; border-color: #ddd; }

/* Modal */
[data-theme="light"] .hunt-modal-overlay { background: rgba(255,255,255,0.92); }
[data-theme="light"] .hunt-modal-box {
  background: #fff;
  border-color: #ddd;
}
[data-theme="light"] .hunt-modal-title { color: #000; }
[data-theme="light"] .hunt-modal-steps div { color: #555; }
[data-theme="light"] .hunt-modal-tip { color: #999; }
[data-theme="light"] .hunt-gotit-btn { background: #3CA3E2; color: #fff; }

/* Success overlay */
[data-theme="light"] .hunt-success-overlay { background: rgba(255,255,255,0.98); }
[data-theme="light"] .hunt-success-check { color: #1a8a4a; }
[data-theme="light"] .hunt-success-title { color: #000; }
[data-theme="light"] .hunt-success-sub   { color: #555; }
[data-theme="light"] .hunt-tweet-label   { color: #999; }
[data-theme="light"] .hunt-tweet-btn     { background: #000; color: #fff; border-color: #000; }
[data-theme="light"] .hunt-tweet-hint    { color: #999; }
[data-theme="light"] .hunt-skip-btn      { color: #999; }
[data-theme="light"] .hunt-copy-btn      { background: #1a8a4a; color: #fff; }

/* ── Ensure hunt fills its game-view container fully ─────── */
#gameViewHunt,
#huntMountPoint {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* ── Mobile Lightbox ──────────────────────────────────────── */
.hunt-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.hunt-lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.hunt-lb-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

.hunt-lb-img {
  /* size and position set entirely by JS — no CSS constraints */
  position: absolute;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: left, top, width, height;
  /* crisp rendering at high zoom */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Hint to swipe down — small pill at bottom */
.hunt-lightbox::after {
  content: 'swipe down to close';
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  pointer-events: none;
}

/* Only show tap-to-open hint on mobile */
@media (max-width: 767px) {
  .hunt-img-container::after {
    content: 'tap to open fullscreen';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    pointer-events: none;
    white-space: nowrap;
  }
}