/* Transfer — PC ↔ phone photo portal */
.tf-shell {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  color: #e6ebe8;
}

.tf-top h2 {
  margin: 0 0 0.3rem;
  font-size: 1.3rem;
  color: #a8e0ff;
}

.tf-hint {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(180, 210, 230, 0.9);
  max-width: 46rem;
}

.tf-portal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(100, 170, 220, 0.35);
  background: rgba(12, 22, 32, 0.92);
}

.tf-portal-qr {
  width: 9rem;
  height: 9rem;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.tf-portal-meta {
  flex: 1 1 14rem;
  min-width: 0;
}

.tf-portal-meta h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: #b8e8ff;
}

.tf-portal-url {
  display: block;
  word-break: break-all;
  font-size: 0.82rem;
  color: #9dffc8;
  margin: 0.25rem 0 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(100, 180, 140, 0.3);
}

.tf-portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.tf-shell button {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(100, 160, 200, 0.45);
  background: rgba(20, 36, 48, 0.95);
  color: #e0f0f8;
  cursor: pointer;
}

.tf-shell button.accent {
  background: linear-gradient(180deg, #2a5a7a, #1a3848);
  border-color: rgba(120, 190, 230, 0.55);
  font-weight: 700;
}

.tf-shell button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tf-muted {
  font-size: 0.74rem;
  color: rgba(160, 190, 210, 0.78);
  line-height: 1.35;
  margin: 0.25rem 0 0;
}

.tf-status {
  font-size: 0.8rem;
  min-height: 1.2em;
  color: #9ec8f0;
  margin: 0 0 0.75rem;
}

.tf-status.ok {
  color: #7dffb3;
}

.tf-status.err {
  color: #ffb0a8;
}

.tf-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 820px) {
  .tf-cols {
    grid-template-columns: 1fr;
  }
}

.tf-card {
  border-radius: 12px;
  border: 1px solid rgba(100, 160, 200, 0.3);
  background: rgba(10, 18, 26, 0.92);
  padding: 0.75rem 0.85rem 0.9rem;
  min-height: 12rem;
}

.tf-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: #b0e0ff;
}

.tf-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0 0.55rem;
}

.tf-file-input {
  display: none;
}

.tf-url-input {
  flex: 1;
  min-width: 8rem;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(100, 160, 200, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: #e8f4ff;
}

.tf-drop {
  border: 1.5px dashed rgba(120, 180, 220, 0.4);
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
  color: rgba(180, 210, 230, 0.75);
  font-size: 0.8rem;
  margin-bottom: 0.55rem;
  transition: border-color 0.15s, background 0.15s;
}

.tf-drop.drag {
  border-color: rgba(140, 220, 255, 0.8);
  background: rgba(40, 80, 110, 0.25);
}

.tf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.45rem;
  max-height: 22rem;
  overflow: auto;
}

.tf-item {
  position: relative;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  aspect-ratio: 1;
}

.tf-item img,
.tf-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111;
}

.tf-item-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.tf-item-bar a,
.tf-item-bar button {
  flex: 1;
  font-size: 0.65rem !important;
  padding: 0.2rem 0.15rem !important;
  text-align: center;
  text-decoration: none;
  color: #e8f4ff;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(30, 50, 70, 0.9);
  cursor: pointer;
}

.tf-item-name {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 0.58rem;
  padding: 0.2rem 0.25rem;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(220, 230, 240, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-empty {
  font-size: 0.78rem;
  color: rgba(160, 190, 210, 0.7);
  padding: 0.5rem 0.15rem;
}

.tf-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.tf-subtab {
  font: inherit;
  font-size: 0.82rem !important;
  padding: 0.4rem 0.75rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(100, 160, 200, 0.4) !important;
  background: rgba(0, 0, 0, 0.3) !important;
  color: #d0e8f8 !important;
}

.tf-subtab.active {
  background: linear-gradient(180deg, #2a5a7a, #1a3848) !important;
  border-color: rgba(140, 210, 240, 0.6) !important;
  font-weight: 700 !important;
}

.tf-coll-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.tf-coll {
  font: inherit;
  font-size: 0.75rem !important;
  padding: 0.3rem 0.55rem !important;
  border-radius: 6px !important;
  border: 1px solid rgba(100, 160, 200, 0.35) !important;
  background: rgba(0, 0, 0, 0.28) !important;
  color: #c8e4f4 !important;
}

.tf-coll.active {
  border-color: rgba(140, 220, 255, 0.7) !important;
  background: rgba(40, 80, 110, 0.45) !important;
  font-weight: 700 !important;
}

.tf-select-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
}

.tf-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.45rem;
}

.tf-load-more {
  display: block;
  width: 100%;
  margin: 0.65rem 0 0.25rem;
  font: inherit;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(100, 180, 140, 0.4);
  background: rgba(16, 28, 22, 0.9);
  color: #d8f0e0;
  cursor: pointer;
}

.tf-vid-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.4rem;
  color: #b8f0c8;
  background: rgba(0, 20, 12, 0.55);
}

.tf-gitem {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.tf-gitem.static {
  cursor: default;
}

.tf-gitem.selected {
  border-color: #6dffb0;
  box-shadow: 0 0 0 2px rgba(100, 255, 180, 0.35);
}

.tf-gitem img,
.tf-gitem video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tf-gcheck {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #7dffb3;
  font-size: 0.75rem;
  line-height: 1.2rem;
  text-align: center;
}

.tf-gitem.selected .tf-gcheck {
  background: rgba(40, 120, 80, 0.9);
}

.tf-gtitle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 0.62rem;
  padding: 0.25rem 0.3rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: #e8f4ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-open {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #cfe8ff;
  text-decoration: none;
}

/* Mobile-first polish when phone opens Transfer */
body.tf-tab-active .site-header .stats {
  display: none;
}

.tf-upload-status {
  min-height: 1.2em;
  font-size: 0.82rem;
  color: #9ec8f0;
  margin: 0.35rem 0 0.55rem;
}

.tf-upload-status.error {
  color: #ffb0a8;
}

.tf-upload-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(100, 160, 200, 0.15);
}

#tf-upload-grid.tf-gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#tf-upload-grid .tf-gitem {
  width: 100%;
  max-width: 12rem;
  aspect-ratio: 1;
}

.tf-abdg {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  z-index: 1;
  font-size: 0.58rem;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #cfe8ff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tf-abdg.analyzing {
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.45);
}

.tf-abdg.ready {
  color: #7dffb3;
  border: 1px solid rgba(100, 255, 180, 0.4);
}

.tf-abdg.failed {
  color: #ffb0a8;
  border: 1px solid rgba(255, 140, 120, 0.4);
}

.tf-analysis-meta {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(200, 220, 235, 0.92);
  max-width: 40rem;
}

.tf-adesc {
  margin: 0 0 0.3rem;
  color: #d8eaf8;
}

.tf-aprompt {
  margin: 0;
  color: rgba(180, 220, 200, 0.95);
  font-size: 0.74rem;
}

.tf-aprompt strong {
  color: #9dffc8;
  font-weight: 600;
}

.tf-amix {
  margin: 0;
  font-size: 0.74rem;
  color: #9ec8f0;
}

.tf-amix a {
  color: #7dffb3;
}

/* On phone / already on LAN: shrink QR, prioritize gallery */
.tf-portal.tf-portal-compact {
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.55rem;
}

.tf-portal.tf-portal-compact .tf-portal-qr {
  width: 4.5rem;
  height: 4.5rem;
}

.tf-portal.tf-portal-compact .tf-portal-meta h3 {
  font-size: 0.82rem;
}

.tf-pane[data-tf-pane="browse"] {
  min-height: 12rem;
}

.tf-select-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.35rem 0;
  background: rgba(8, 14, 20, 0.92);
  backdrop-filter: blur(6px);
}

@media (max-width: 720px) {
  .tf-portal-qr {
    display: none !important;
  }
  .tf-gitem {
    content-visibility: auto;
    contain-intrinsic-size: 5.2rem 5.2rem;
  }
}

@media (max-width: 640px) {
  .tf-portal {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .tf-portal-actions {
    justify-content: center;
  }
  .tf-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr));
  }
  .tf-hint {
    font-size: 0.8rem;
  }
  .tf-shell {
    padding: 0.5rem 0.65rem 1.5rem;
  }
}
