/* ============================================================================
   Gyro Games — Extended Styles
   1) Hazard Patrol: Time-Remap Zoom/Blur/Card + Landscape ergonomics
   2) Night Passage (Dark Sea Night theme)
   3) Damage Control (Engine Room tactical grid)
   4) Stack & Sail (Wave physics container crane)
   5) Knot Rush (Tactile knot tracing + ghost)
   ============================================================================ */

/* ----- Hazard Patrol: Time-Remap Overlay ----- */
.pt-remap-blur {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease-out;
  backdrop-filter: blur(5px) saturate(.82);
  -webkit-backdrop-filter: blur(5px) saturate(.82);
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(23,33,43,0) 64px, rgba(23,33,43,.48) 185px);
  z-index: 6;
}
.pt-remap-blur.on { opacity: 1; }

.pt-remap-card {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translate(-50%, 130%) scale(.92);
  width: min(92%, 420px);
  background: rgba(255,255,255,.97);
  color: var(--ink2);
  border-radius: 20px;
  padding: 12px 16px;
  box-shadow: 0 14px 36px rgba(23,33,43,.34);
  border: 2px solid var(--grn);
  transition: transform .22s cubic-bezier(.22,1.15,.36,1), opacity .2s;
  opacity: 0;
  z-index: 8;
  cursor: pointer;
}
.pt-remap-card.on { transform: translate(-50%, 0) scale(1); opacity: 1; }
.pt-remap-card.warn { border-color: var(--yel); background: #FFFBF0; }
.pt-remap-card.bad { border-color: var(--red); background: #FFF2F2; }
.pt-remap-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pt-remap-head b { font-size: 15px; font-weight: 800; color: var(--ink2); }
.pt-remap-pts { font-family: Unbounded, Manrope, sans-serif; font-size: 14px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #E3F9EE; color: var(--grn-d); white-space: nowrap; }
.pt-remap-card.warn .pt-remap-pts { background: #FFF0C7; color: #9A5B00; }
.pt-remap-card.bad .pt-remap-pts { background: #FDE2E3; color: #C2262B; }
.pt-remap-desc { font-size: 13px; line-height: 18px; color: var(--ink); font-weight: 600; }
.pt-remap-bar { height: 4px; border-radius: 2px; background: rgba(31,60,73,.12); margin-top: 8px; overflow: hidden; }
.pt-remap-bar i { display: block; height: 100%; background: var(--blue); transform-origin: left; }

/* Landscape rotate hint (shown only in narrow portrait on Patrol) */
.pt-rot-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(23,33,43,.86);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0,0,0,.22);
}
.pt-rot-hint.show { display: inline-flex; }
.pt-rot-hint button { color: #9DB5C4; font-weight: 800; padding: 0 2px; }

/* Compact HUD in landscape so the full ship dominates the viewport */
@media (orientation: landscape) and (max-height: 520px) {
  .pt-hud { padding: 4px 12px; }
  .pt-hud .ib { width: 34px; height: 34px; }
  .pt-score b { font-size: 18px; }
  .pt-mini { height: 34px; }
  .pt-view { height: 26px; }
  .pt-remap-card { bottom: 8px; padding: 9px 14px; }
}

/* ----- Shared Mini-Game Dark / Arcade Shell ----- */
.mg {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.mg.light { background: var(--bg); color: var(--ink); }
.mg-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--top)) 12px 8px;
  background: rgba(15, 22, 30, .92);
  color: #fff;
  z-index: 10;
}
.mg-hud .ib { background: rgba(255,255,255,.12); color: #fff; }
.mg-stat { flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.mg-stat b { font-family: Unbounded, Manrope, sans-serif; font-size: 20px; }
.mg-stat span { font-size: 11px; font-weight: 700; color: #9DB5C4; margin-top: 2px; }
.mg-stage { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.mg-bar { height: 5px; background: #263442; }
.mg-bar i { display: block; height: 100%; background: var(--blue); transform-origin: left; transition: transform .1s linear; }
.mg-feedback {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translate(-50%, -140%);
  width: min(92%, 420px);
  background: #fff;
  color: var(--ink2);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
  transition: transform .2s ease-out;
  z-index: 12;
  text-align: center;
}
.mg-feedback.on { transform: translate(-50%, 0); }
.mg-feedback.ok { border-left: 5px solid var(--grn); }
.mg-feedback.bad { border-left: 5px solid var(--red); background: #FFF2F2; color: #9F1D22; }
.mg-feedback.info { border-left: 5px solid var(--blue); }

/* Hero theme variants for lobbies */
.hero-navy { background: linear-gradient(145deg, #101922, #1F3448); }
.hero-org { background: linear-gradient(145deg, #C93D0B, #F76023); }
.hero-yel { background: linear-gradient(145deg, #C78C08, #F0BA26); }
.hero-yel .hero-txt, .hero-yel .hero-txt p { color: #17212B; }
.hero-grn { background: linear-gradient(145deg, #148A4C, #25C26E); }

/* ----- Game 2: Night Passage ----- */
#np-canvas { width: 100%; height: 100%; display: block; background: #0C141D; }
.np-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 12px calc(12px + var(--sab));
  background: #101922;
  border-top: 1px solid #223244;
}
.np-btn {
  min-height: 58px;
  border-radius: 16px;
  background: #1B2B3B;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1.5px solid #2B4259;
  text-transform: uppercase;
}
.np-btn small { font-size: 10px; color: #9DB5C4; text-transform: none; font-weight: 600; }
.np-btn:active, .np-btn.on { background: var(--deep); border-color: var(--blue); transform: translateY(1px); }
.np-btn.port { border-color: rgba(229,72,77,.65); }
.np-btn.stbd { border-color: rgba(37,194,110,.65); }
.np-btn.horn { border-color: rgba(240,186,38,.65); }

/* ----- Game 3: Damage Control ----- */
.dc-wrap { flex: 1; display: flex; flex-direction: column; padding: 10px 12px calc(12px + var(--sab)); gap: 10px; overflow-y: auto; max-width: 560px; width: 100%; margin: 0 auto; }
.dc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; flex: 1; }
.dc-room {
  position: relative;
  border-radius: 18px;
  background: #1B2836;
  border: 2px solid #2C3E50;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
  transition: transform .12s, border-color .2s;
}
.dc-room.sel { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(4,161,241,.25); transform: scale(1.01); }
.dc-room.crit { border-color: var(--red); background: linear-gradient(160deg, #351820, #1B2836); animation: pulse .8s ease-in-out infinite alternate; }
.dc-room.sealed { border-color: #688DA0; opacity: .88; }
.dc-room-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.dc-room-top b { font-size: 13px; color: #fff; }
.dc-tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; background: #26384A; color: #A9C1D1; }
.dc-tag.fire { background: #F76023; color: #fff; }
.dc-tag.elec { background: #F0BA26; color: #17212B; }
.dc-tag.flood { background: #04A1F1; color: #fff; }
.dc-tag.oil { background: #DB34AD; color: #fff; }
.dc-tag.ok { background: #25C26E; color: #17212B; }
.dc-meter { height: 7px; border-radius: 4px; background: #101922; overflow: hidden; }
.dc-meter i { display: block; height: 100%; border-radius: 4px; transition: width .25s; }
.dc-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dc-tool {
  border-radius: 14px;
  background: #1B2B3B;
  border: 1.5px solid #2E455C;
  padding: 9px 4px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
}
.dc-tool small { font-size: 10px; color: #9DB5C4; font-weight: 600; }
.dc-tool.active { background: var(--deep); border-color: var(--blue); }

/* ----- Game 4: Stack & Sail ----- */
#ss-canvas { width: 100%; height: 100%; display: block; }
.ss-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px calc(12px + var(--sab));
  background: #fff;
  border-top: 1px solid var(--line);
}
.ss-queue { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ss-next { display: flex; align-items: center; gap: 8px; background: var(--bg); padding: 6px 10px; border-radius: 12px; font-weight: 800; font-size: 13px; color: var(--ink2); }
.ss-bays { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ss-bay-btn {
  min-height: 48px;
  border-radius: 14px;
  background: var(--deep);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 3px 0 var(--deep2);
}
.ss-bay-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--deep2); }
.ss-bay-btn:disabled { background: var(--s2); color: var(--mut); box-shadow: none; }

/* ----- Game 5: Knot Rush ----- */
#kr-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.kr-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px calc(12px + var(--sab));
  background: #fff;
  border-top: 1px solid var(--line);
}
.kr-name b { display: block; font-size: 15px; color: var(--ink2); }
.kr-name small { display: block; font-size: 12px; color: var(--mut); font-weight: 600; }
