/* tinyfriends.css
   Extracted from index.html. Keep this file next to index.html and tinyfriends.js.
*/

/* =========================================================
   TINY FRIENDS
   ========================================================= */
#tinyFriendLayer {
  position: absolute;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
}

.tiny-friend {
  position: absolute;
  width: 20px;
  height: 20px;
  padding: 12px;                 /* invisible grab/touch area around the tiny 20px friend */
  box-sizing: content-box;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: auto;
  cursor: grab;
  transform-origin: center center;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  filter: drop-shadow(0 0 3px rgba(255,255,255,0.18));
}

.tiny-friend:active { cursor: grabbing; }

.tiny-friend-scan-box {
  position: absolute;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  filter: none;
}

.tiny-friend-scan-box.show {
  opacity: 1;
}

.tiny-friend-scan-box svg {
  width: 44px;
  height: 44px;
  display: block;
  overflow: visible;
}

.tiny-friend-scan-box .scan-frame {
  fill: none;
  stroke: rgba(255,255,255,0.92);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  animation: tinyFriendScanDash 0.42s linear infinite;
  vector-effect: non-scaling-stroke;
}

.tiny-friend-scan-box .scan-frame-ghost {
  display: none;
}

@keyframes tinyFriendScanDash {
  to { stroke-dashoffset: -36; }
}

@keyframes tinyFriendScanDashGhost {
  to { stroke-dashoffset: 42; }
}

.tiny-friend.passport-subject {
  cursor: default;
  filter: drop-shadow(0 0 9px rgba(255,255,255,0.85));
}

.tiny-friend-scan-menu,
.tiny-prison-context-menu {
  position: fixed;
  z-index: 10020;
  display: none;
  background: rgba(0,0,0,0.94);
  border: 1.5px dashed rgba(255,255,255,0.92);
  border-radius: 9px;
  padding: 8px 10px 7px;
  box-shadow: 0 0 12px rgba(255,255,255,0.25);
  font-family: "VT323", monospace;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.tiny-friend-scan-menu.show,
.tiny-prison-context-menu.show {
  display: block;
}

.tiny-friend-scan-menu:hover,
.tiny-prison-context-menu:hover {
  transform: translateY(-1px);
}

.tiny-prison-context-menu.is-empty {
  opacity: 1;
  filter: none;
}

/* SCAN and RELEASE ALL are action menu words, so keep them bright white.
   Only the main prison RELEASE button uses gray/white enabled states. */
.tiny-friend-scan-menu .tiny-gif-char,
.tiny-friend-scan-menu .tiny-gif-fallback-char,
.tiny-prison-context-menu .tiny-gif-char,
.tiny-prison-context-menu .tiny-gif-fallback-char {
  opacity: 1 !important;
  filter: none !important;
}

@media (hover: none) {
  .tiny-friend-scan-menu:hover,
  .tiny-prison-context-menu:hover {
    transform: none;
  }
}

body.map-mode #tinyFriendLayer,
body.secret-active #tinyFriendLayer {
  pointer-events: none !important;
}

body.secret-active #tinyFriendLayer {
  display: none !important;
}

#tinyFriendPassportBackdrop {
  position: fixed;
  inset: 0;
  z-index: 9005;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
}

#tinyFriendPassportBackdrop.show { display: flex; pointer-events: auto; }

#tinyFriendPassportBackdrop.prison-passport {
  z-index: 9025;
}

.tiny-passport-window {
  width: min(500px, calc(100vw - 28px));
  min-height: 320px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #000;
  border: 1.5px dashed #fff;
  border-radius: 14px;
  padding: 12px 14px 18px;
  box-shadow: 0 0 18px rgba(255,255,255,0.35);
  font-family: "VT323", monospace;
  color: #fff;
  scrollbar-width: none;
}

.tiny-passport-window::-webkit-scrollbar { width: 0; height: 0; }

.tiny-passport-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tiny-passport-title { flex: 1; min-width: 0; }

.tiny-passport-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  flex: 0 0 auto;
}

.tiny-passport-close img {
  width: 18px;
  height: auto;
  display: block;
  opacity: 0.85;
  image-rendering: pixelated;
}

.tiny-passport-close:hover img { opacity: 1; }

.tiny-passport-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.tiny-passport-photo-box {
  width: 105px;
  height: 135px;
  border: 1.5px dashed #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  flex: 0 0 auto;
  overflow: hidden;
}

.tiny-passport-photo-box img {
  width: 105px;
  height: 135px;
  object-fit: cover;
  display: block;
}

.tiny-passport-name-area {
  flex: 1;
  padding-top: 2px;
  min-width: 0;
}

.tiny-passport-label { margin-bottom: 7px; }

.tiny-passport-section {
  border-top: 1px dashed rgba(255,255,255,0.45);
  padding-top: 12px;
}

.tiny-passport-description {
  margin-top: 8px;
  max-width: 100%;
}

.tiny-gif-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  line-height: 1;
  max-width: 100%;
}

.tiny-gif-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-height: 1em;
  margin-bottom: 6px;
  max-width: 100%;
}

.tiny-gif-word {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.tiny-gif-char {
  display: inline-block;
  width: auto;
  height: 18px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  flex: 0 0 auto;
}

.tiny-gif-char.title { height: 13px; }
.tiny-gif-char.label { height: 14px; opacity: 0.68; }
.tiny-gif-char.name { height: 26px; }
.tiny-gif-char.description { height: 15px; }

.tiny-gif-space {
  display: inline-block;
  width: 10px;
  height: 1px;
  flex: 0 0 auto;
}

.tiny-gif-space.title { width: 7px; }
.tiny-gif-space.name { width: 12px; }
.tiny-gif-space.description { width: 8px; }

.tiny-gif-fallback-char {
  font-family: "VT323", monospace;
  color: white;
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  height: 18px;
  flex: 0 0 auto;
}

.tiny-gif-fallback-char.title { font-size: 13px; height: 13px; }
.tiny-gif-fallback-char.name { font-size: 26px; height: 26px; }
.tiny-gif-fallback-char.label { font-size: 14px; height: 14px; opacity: 0.68; }
.tiny-gif-fallback-char.description { font-size: 15px; height: 15px; }

@media (max-width: 768px) {
  .tiny-passport-window {
    width: min(370px, calc(100vw - 24px));
    min-height: 300px;
  }

  .tiny-passport-photo-box { width: 91px; height: 117px; }
  .tiny-passport-photo-box img { width: 91px; height: 117px; }

  .tiny-gif-char.title { height: 11px; }
  .tiny-gif-char.name { height: 22px; }
  .tiny-gif-char.description { height: 13px; }
  .tiny-gif-char.label { height: 12px; }

  .tiny-gif-space.title { width: 6px; }
  .tiny-gif-space.name { width: 10px; }
  .tiny-gif-space.description { width: 7px; }

  .tiny-gif-fallback-char.title { font-size: 11px; height: 11px; }
  .tiny-gif-fallback-char.description { font-size: 13px; height: 13px; }
}


/* =========================================================
   TINY FRIENDS PRISON APP + WINDOW
   ========================================================= */
.tiny-prison-app .app {
  min-height: 96px;
}

.tiny-prison-icon {
  position: relative;
  width: 50px;
  height: 50px;
  margin: 7px auto 0;
  border: 1.5px solid rgba(255,255,255,0.95);
  background: transparent;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.tiny-prison-icon::before,
.tiny-prison-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
}

.tiny-prison-icon::before {
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent 8px,
    rgba(255,255,255,0.52) 9px,
    rgba(255,255,255,0.52) 10px
  );
}

.tiny-prison-icon::after {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 8px,
    rgba(255,255,255,0.34) 9px,
    rgba(255,255,255,0.34) 10px
  );
}

.tiny-prison-icon-friends {
  position: absolute;
  inset: 2px;
  z-index: 2;
}

.tiny-prison-app .tiny-prison-icon .tiny-prison-icon-friends img {
  position: absolute;
  width: 12px !important;
  height: 12px !important;
  max-width: none;
  max-height: none;
  display: block;
  margin: 0;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: none;
  transition: none;
  transform: none;
}

#tinyFriendPrisonBackdrop {
  position: fixed;
  inset: 0;
  z-index: 9015;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
}

#tinyFriendPrisonBackdrop.show { display: flex; pointer-events: auto; }

.tiny-prison-window {
  width: min(610px, calc(100vw - 28px));
  background: #000;
  border: 1.5px dashed #fff;
  border-radius: 14px;
  padding: 12px 14px 16px;
  box-shadow: 0 0 18px rgba(255,255,255,0.35);
  font-family: "VT323", monospace;
  color: #fff;
}

.tiny-prison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tiny-prison-title { flex: 1; min-width: 0; }

.tiny-prison-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  flex: 0 0 auto;
}

.tiny-prison-close img {
  width: 18px;
  height: auto;
  display: block;
  opacity: 0.85;
  image-rendering: pixelated;
}

.tiny-prison-close:hover img { opacity: 1; }

.tiny-prison-box {
  position: relative;
  height: min(390px, calc(100vh - 210px));
  min-height: 280px;
  overflow: hidden;
  border: 1.5px dashed rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.025);
  touch-action: none;
}

.tiny-prison-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  justify-content: center;
  opacity: 0.55;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 24px);
}

.tiny-prison-friend {
  position: absolute;
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  filter: none;
}

.tiny-prison-friend:active { cursor: grabbing; }

.tiny-prison-friend.is-selected,
.tiny-prison-friend.is-angry {
  filter: none;
}

.tiny-prison-selection-box {
  position: absolute;
  display: none;
  border: 1.5px dashed rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.08);
  pointer-events: none;
  z-index: 40;
}

.tiny-prison-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.tiny-prison-action {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px dashed rgba(255,255,255,0.75);
  background: #000;
  color: #fff;
  padding: 7px 12px 6px;
  cursor: default;
  opacity: 0.38;
  filter: grayscale(1) brightness(0.62);
  font-family: "VT323", monospace;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 1px;
  transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
  touch-action: manipulation;
}

.tiny-prison-action.can-scan,
.tiny-prison-action.can-release {
  cursor: pointer;
  opacity: 1;
  filter: none;
  border-color: rgba(255,255,255,0.96);
}

.tiny-prison-action.can-scan:hover,
.tiny-prison-action.can-release:hover {
  transform: translateY(-1px);
}

.tiny-prison-action .tiny-gif-line {
  margin-bottom: 0;
}

.tiny-prison-action.can-scan .tiny-gif-char,
.tiny-prison-action.can-scan .tiny-gif-fallback-char,
.tiny-prison-action.can-release .tiny-gif-char,
.tiny-prison-action.can-release .tiny-gif-fallback-char {
  opacity: 1 !important;
  filter: none !important;
}

.tiny-prison-action-text {
  display: inline-block;
  color: #fff;
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .tiny-prison-window {
    width: min(380px, calc(100vw - 24px));
    padding: 12px 12px 14px;
  }

  .tiny-prison-box {
    height: min(370px, calc(100vh - 200px));
    min-height: 260px;
  }

  .tiny-prison-friend {
    width: 34px;
    height: 34px;
  }

  .tiny-prison-actions {
    justify-content: center;
  }
}

/* Tiny Friends settings toggle */
body.tiny-friends-off #tinyFriendLayer {
  display: none !important;
  pointer-events: none !important;
}
