/* ===== базовая тема (твой текущий стиль в духе скрина) ===== */
:root{
  --bg0:#060a12;
  --bg1:#0b1220;
  --card:#0a1220;
  --card2:#08111f;
  --text:#e5e7eb;
  --muted:#9aa4b2;

  --green:#22c55e;
  --orange:#f59e0b;
  --red:#ef4444;

  --border: rgba(255,255,255,.08);
}

*{ box-sizing:border-box; }

html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 600px at 20% -10%, rgba(59,130,246,.20), transparent 60%),
    radial-gradient(700px 500px at 80% 0%, rgba(34,197,94,.12), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

.wrap{
  max-width: 980px;
  margin: 28px auto;
  padding: 0 18px 60px;
}

.top h1{
  margin:0 0 8px;
  font-size: 34px;
  letter-spacing: .2px;
}
.sub{
  margin:0 0 18px;
  color:var(--muted);
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-top: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

.row{
  display:flex;
  gap: 12px;
  align-items:center;
}

.input{
  flex:1;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  color: var(--text);
}

.btn{
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(59,130,246,.22), rgba(59,130,246,.12));
  color: var(--text);
  cursor:pointer;
}
.btn:disabled{ opacity:.55; cursor:not-allowed; }

.status{
  margin-top: 10px;
  color: #cbd5e1;
  font-size: 14px;
}

.result{
  display:grid;
  gap: 14px;
  margin-top: 12px;
}

.pred{
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(2,6,23,.55), rgba(2,6,23,.25));
  border: 1px solid rgba(255,255,255,.10);
}

.pred.high{ border-color: rgba(34,197,94,.95); }
.pred.medium{ border-color: rgba(245,158,11,.95); }
.pred.low{ border-color: rgba(239,68,68,.95); }

.pred-row{
  display:flex;
  gap: 14px;
  align-items:center;
}

.thumb{
  width: 92px;
  height: 92px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.thumbs2{
  display:flex;
  gap: 10px;
  align-items:flex-start;
}

.thumbLink{
  display:flex;
  flex-direction:column;
  gap: 6px;
  text-decoration:none;
  cursor: zoom-in;
}

.thumbCap{
  font-size: 12px;
  color: var(--muted);
  text-align:center;
}

/* ===== заголовок карточки ===== */
.title{
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
  display:flex;
  align-items:center;
  gap: 10px;
}

.meta{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #cbd5e1;
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  border: 1px solid rgba(255,255,255,.10);
}
.badge.high{ color: var(--green); background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.35); }
.badge.medium{ color: var(--orange); background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.35); }
.badge.low{ color: var(--red); background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.35); }

.rawbox{
  margin-top: 14px;
}
.out{
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  overflow:auto;
  max-height: 360px;
  font-size: 12px;
}

.history-item{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 13px;
}

/* ===== LIGHTBOX ===== */
.lb{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display:flex;
  align-items:center;
  justify-content:center;
}
.lb.hidden{ display:none; }

.lb-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.82);
}

.lb-body{
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 92vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 12px;
}

.lb-body img{
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 30px 120px rgba(0,0,0,.75);
  background: rgba(255,255,255,.02);
}

/* ===== PLATFORM PNG ICONS (как у camgirlfinder) ===== */
.platLogo{
  width: 20px;
  height: 20px;
  object-fit: contain;
  display:inline-block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}
/* ===== базовая тема ===== */
:root{
  --bg0:#060a12;
  --bg1:#0b1220;
  --text:#e5e7eb;
  --muted:#9aa4b2;
  --border: rgba(255,255,255,.08);

  --green:#22c55e;
  --orange:#f59e0b;
  --red:#ef4444;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 600px at 20% -10%, rgba(59,130,246,.20), transparent 60%),
    radial-gradient(700px 500px at 80% 0%, rgba(34,197,94,.12), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

.wrap{
  max-width: 980px;
  margin: 28px auto;
  padding: 0 18px 60px;
}

.top h1{ margin:0 0 8px; font-size: 34px; }
.sub{ margin:0 0 18px; color:var(--muted); }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-top: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

.row{ display:flex; gap: 12px; align-items:center; }

.input{
  flex:1;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  color: var(--text);
}

.btn{
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(59,130,246,.22), rgba(59,130,246,.12));
  color: var(--text);
  cursor:pointer;
  text-decoration:none;
  display:inline-block;
}
.btn:disabled{ opacity:.55; cursor:not-allowed; }

.status{ margin-top: 10px; color: #cbd5e1; font-size: 14px; }

.result{ display:grid; gap: 14px; margin-top: 12px; }

.pred{
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(2,6,23,.55), rgba(2,6,23,.25));
  border: 1px solid rgba(255,255,255,.10);
}

.pred.high{ border-color: rgba(34,197,94,.95); }
.pred.medium{ border-color: rgba(245,158,11,.95); }
.pred.low{ border-color: rgba(239,68,68,.95); }

.pred-row{
  display:flex;
  gap: 14px;
  align-items:center;
}

.thumbs2{ display:flex; gap: 10px; align-items:flex-start; }
.thumbLink{ display:flex; flex-direction:column; gap: 6px; cursor:zoom-in; }
.thumb{
  width: 92px;
  height: 92px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.thumbCap{ font-size: 12px; color: var(--muted); text-align:center; }

.predMain{ flex: 1; min-width: 260px; }

.title{
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
  display:flex;
  align-items:center;
  gap: 10px;
}

.meta{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #cbd5e1;
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  border: 1px solid rgba(255,255,255,.10);
}
.badge.high{ color: var(--green); background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.35); }
.badge.medium{ color: var(--orange); background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.35); }
.badge.low{ color: var(--red); background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.35); }

.rawbox{ margin-top: 14px; }
.out{
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  overflow:auto;
  max-height: 360px;
  font-size: 12px;
}

.history-item{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 13px;
}

/* ===== LIGHTBOX ===== */
.lb{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display:flex;
  align-items:center;
  justify-content:center;
}
.lb.hidden{ display:none; }

.lb-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.82);
}

.lb-body{
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 92vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 12px;
}

.lb-body img{
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 30px 120px rgba(0,0,0,.75);
  background: rgba(255,255,255,.02);
}

/* ===== PLATFORM PNG ICONS ===== */
.platLogo{
  width: 20px;
  height: 20px;
  object-fit: contain;
  display:inline-block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}

/* ===== EXTRA PHOTOS (3 справа) ===== */
.extras{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:flex-end;
  min-width: 210px;
}

.extrasHint{
  font-size: 12px;
  color: var(--muted);
  opacity: .8;
}

.extraThumb{
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  cursor: zoom-in;
  background: rgba(255,255,255,.04);
}
.extraThumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}

/* =========================================================
   Overrides (v2) — non-destructive: keeps original CSS intact
   Changes requested:
   1) Hide Raw JSON blocks (rawbox/out)
   3) Style file input via hidden native input + styled label
   4) Make background fixed/continuous (no "chunks")
   5) Provide helpers to hide job/status blocks if needed
   ========================================================= */

/* 4) Fixed continuous background */
body{
  /* let the fixed layer below paint the background */
  background: transparent !important;
}
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 900px at 20% -10%, rgba(59,130,246,.22), transparent 60%),
    radial-gradient(900px 650px at 85% 10%, rgba(34,197,94,.14), transparent 60%),
    radial-gradient(900px 650px at 50% 110%, rgba(245,158,11,.10), transparent 65%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
  transform: translateZ(0);
}

/* 1) Hide raw JSON UI (in case it still exists in HTML) */
.rawbox,
.out,
#rawbox,
#raw,
#rawJson,
#raw-json{
  display:none !important;
}

/* 3) Styled file input */
.fileNative{
  position:absolute !important;
  left:-9999px !important;
  width:1px !important;
  height:1px !important;
  opacity:0 !important;
}
.fileName{
  color:#cbd5e1;
  font-size:14px;
  opacity:.9;
  padding:6px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  flex:1;
  min-width:220px;
}
.btn-ghost{
  background: rgba(0,0,0,.22);
}

/* 5) Optional: allow JS to fully hide status line */
.statusHidden{
  display:none !important;
}

/* Nice little improvements for layout when row wraps */
.row{
  flex-wrap: wrap;
}

/* =========================================================
   Mobile fix (v3)
   Goal: on mobile show ONLY face+full, prevent overflow
   ========================================================= */
@media (max-width: 700px){
  /* hide right-side extra images on mobile */
  .extras{ display:none !important; }

  /* allow row to wrap and fit screen */
  .pred-row{
    flex-wrap: wrap !important;
    align-items: flex-start !important;
  }

  /* keep thumbs and main content within card */
  .pred{
    overflow: hidden !important;
  }

  .thumbs2{
    flex: 0 0 auto;
    gap: 10px;
  }

  /* slightly smaller thumbs on mobile */
  .thumb{
    width: 84px !important;
    height: 84px !important;
  }

  .predMain{
    flex: 1 1 220px !important;
    min-width: 0 !important;
  }

  /* wrap long names instead of pushing layout */
  .title{
    flex-wrap: wrap !important;
  }
  .title span{
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* buttons fit */
  .btn{
    max-width: 100%;
  }
}

/* =========================================================
   Mobile UI tweaks (v4)
   - remove "face/full" captions
   - align distance centered with badge
   - show model_images on right again, compact (up to 4)
   ========================================================= */

/* remove captions under thumbnails (everywhere) */
.thumbCap{ display:none !important; }

/* meta row: badge + distance aligned nicely */
.meta{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap: wrap;
}
.meta .badge{
  display:inline-flex;
  align-items:center;
}
.meta .dist,
.meta .distance{
  display:inline-flex;
  align-items:center;
}
/* if distance is a plain span without class, try to catch it */
.meta span:nth-child(2){
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

/* Mobile layout: keep extras, but compact and non-overflow */
@media (max-width: 700px){
  .pred-row{
    display:grid !important;
    grid-template-columns: auto 1fr;
    grid-auto-rows: auto;
    column-gap: 12px;
    row-gap: 10px;
    align-items:start !important;
  }

  .thumbs2{ grid-column: 1 / 2; grid-row: 1 / 3; }
  .predMain{ grid-column: 2 / 3; grid-row: 1 / 2; min-width:0 !important; }

  /* extras sit under main content, but still to the right side of thumbs */
  .extras{
    display:grid !important;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-content:start;
    justify-items: stretch;
  }

  .extraThumb{
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow:hidden;
  }
  .extraThumb img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
  }

  /* thumbs slightly smaller to free space */
  .thumb{
    width: 78px !important;
    height: 78px !important;
  }

  /* ensure nothing spills outside card */
  .pred{ overflow:hidden !important; }
  .predMain .title span{ overflow-wrap:anywhere; word-break: break-word; }
}

/* =========================================================
   Mobile layout (v5)
   Request: on mobile, extras on top (right), and ALL text + button
   move under the face+full thumbnails (below).
   ========================================================= */
@media (max-width: 700px){
  .pred-row{
    display:grid !important;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 12px;
    align-items:start !important;
  }

  /* left: face+full thumbs on top-left */
  .thumbs2{
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    align-self:start;
  }

  /* top-right: extra images (up to 4) */
  .extras{
    display:grid !important;
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    grid-template-columns: repeat(2, 1fr); /* 2x2 = up to 4 */
    gap: 8px;
    align-content:start;
    justify-items: stretch;
  }

  /* bottom: all labels + badge + distance + button go under thumbs */
  .predMain{
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    min-width: 0 !important;
  }

  /* make main content compact */
  .predMain .title{
    margin-top: 2px;
  }
  .predMain .meta{
    margin-top: 8px;
  }
  .predMain .btn{
    width: 100%;
    text-align:center;
    justify-content:center;
  }

  /* thumbs slightly smaller to free space */
  .thumb{ width: 78px !important; height: 78px !important; }

  /* ensure card never overflows */
  .pred{ overflow:hidden !important; }
}

/* =========================================================
   Mobile layout (v6) — keep everything INSIDE .pred, and
   show: face + full + 3 model_images in ONE ROW.
   Text + badge + distance + button go UNDER that row.
   ========================================================= */
@media (max-width: 700px){
  /* hard guard: nothing can spill outside the card */
  .pred{ overflow:hidden !important; }

  /* layout: two rows -> (images row) then (text/button row) */
  .pred-row{
    display:flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items:flex-start !important;
  }

  /* row 1: images */
  .thumbs2{
    order: 1;
    display:flex !important;
    gap: 8px !important;
    align-items:flex-start !important;
    flex: 0 0 auto !important;
  }

  /* face/full size (a bit smaller to fit with 3 extras) */
  .thumb{
    width: 72px !important;
    height: 72px !important;
    border-radius: 14px !important;
  }

  /* extras sit on the SAME row as thumbs2 */
  .extras{
    order: 2;
    display:flex !important;
    gap: 8px !important;
    align-items:flex-start !important;
    justify-content:flex-start !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important; /* prevent spill */
  }

  /* make model_images narrower so 3 fit */
  .extraThumb{
    width: 54px !important;
    height: 54px !important;
    border-radius: 12px !important;
    flex: 0 0 auto !important;
  }

  /* row 2: main text + button under images, full width */
  .predMain{
    order: 3;
    flex: 1 0 100% !important;
    min-width: 0 !important;
  }

  /* compact spacing */
  .title{ margin-top: 2px !important; }
  .meta{ margin-top: 8px !important; }

  /* button full width on mobile */
  .btn{
    width: 100% !important;
    text-align:center !important;
    justify-content:center !important;
  }

  /* keep long names from pushing width */
  .title span{
    overflow-wrap:anywhere !important;
    word-break: break-word !important;
  }
}

/* =========================================================
   Mobile layout (v7)
   - extras always to the RIGHT of face+full (same row)
   - if 3 extras: shrink to fit; if 1-2 extras: can be up to thumb size
   ========================================================= */
@media (max-width: 700px){
  .pred{ overflow:hidden !important; }

  /* first row is thumbs2 + extras side-by-side */
  .pred-row{
    display:flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items:flex-start !important;
  }

  .thumbs2{
    order: 1;
    display:flex !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
  }

  .thumb{
    width: 72px !important;
    height: 72px !important;
    border-radius: 14px !important;
  }

  /* extras must stay on the same row, never wrap to next line */
  .extras{
    order: 2;
    display:flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    align-items:flex-start !important;
    justify-content:flex-start !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* each extra gets equal share, but can grow up to thumb size */
  .extraThumb{
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: 72px !important;   /* if 1-2 extras, they can be big */
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    border-radius: 12px !important;
    overflow:hidden !important;
  }
  .extraThumb img{
    width:100% !important;
    height:100% !important;
    object-fit:cover !important;
    display:block !important;
  }

  /* main content under images */
  .predMain{
    order: 3;
    flex: 1 0 100% !important;
    min-width: 0 !important;
  }

  .btn{
    width: 100% !important;
    text-align:center !important;
    justify-content:center !important;
  }

  .title span{
    overflow-wrap:anywhere !important;
    word-break: break-word !important;
  }
}
