/* =========================
   Global box-sizing (FIX overflow)
   ========================= */
*,
*::before,
*::after{
  box-sizing: border-box;
}

/* =========================
   Base
   ========================= */
:root { --tap: 44px; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 16px;
  overflow-x: hidden;
}
h1 { margin: 0; }
h3 { margin: 0 0 10px; }

.brand { font-size: 20px; }
.muted { color: #666; font-size: 12px; }

#appRoot[data-hidden="1"] { display: none; }
.hidden { display: none !important; }

/* =========================
   Layout helpers
   ========================= */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 360px; min-width: 320px; }

.rowInline { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.card {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.tableWrap { overflow:auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid #eee; vertical-align: top; }
th { text-align: left; font-weight: 600; }

/* =========================
   Buttons (red unified style)
   ========================= */
.btn,
.btnLink{
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,0,64,0.40);
  background: linear-gradient(90deg, #b40016, #e10024);
  color: #fff !important;
  font-weight: 600;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btnDanger { border-color: rgba(208,0,47,0.45); }

/* hover: серый фон + чёрный текст */
.btn:hover,
.btnLink:hover{
  background: #e6e6e6 !important;
  color: #000 !important;
  border-color: #ccc !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn:active,
.btnLink:active{
  background: #d9d9d9 !important;
  color: #000 !important;
}

/* =========================
   Header (FINAL): centered group (logo + buttons)
   ========================= */
.yvHeader{
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 14px;
  padding: 0 16px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding-top: max(8px, env(safe-area-inset-top));
}

.brandLogoLink{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brandLogo{
  height: 44px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  display: block;
  filter:
    drop-shadow(0 0 10px rgba(255,0,64,0.18))
    drop-shadow(0 10px 18px rgba(0,0,0,0.18));
}

.topActions{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* =========================
   Upload panel (input top, buttons below centered)
   ========================= */
.uploadPanel{
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 12px;

  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 20px 28px;
  background: #fff;
}

.uploadGrid{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.uploadInput{
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 16px;
  box-sizing: border-box;
}

.uploadFileInput{
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ✅ фикс layout кнопок:
   1 строка: Выбрать файл(ы) | Снять видео
   2 строка: Загрузить */
.uploadButtonsRow{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.uploadBtnPick,
#cameraRecordBtn,
.uploadBtnMain{
  width: 100%;
  min-width: 0;
  height: 44px;
  border-radius: 10px;
  white-space: nowrap;
}

.uploadBtnMain{
  grid-column: 1 / -1;
  margin-top: 0;
}

.uploadStatus{
  min-height: 16px;
}

/* =========================
   Video player / modal
   ========================= */
.playerWrap { margin-top: 10px; }
video { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; }
.playerVideo { max-height: 78vh; }

.modal.hidden { display: none; }
.modal{
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 9999;
}
.modalCard{
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 14px;
}
.formRow { display: grid; gap: 6px; margin-top: 10px; }
.formRow label { font-size: 12px; color: #666; }
.formRow input{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #ccc;
}

.modalHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modalTitle{
  font-weight: 600;
  word-break: break-all;
}

@media (max-width: 820px){
  #playerModal.modal{ align-items: flex-start; padding-top: 10px; }
  #playerModal .modalCard{ height: auto; max-height: none; overflow: visible; }
  #playerModal .playerVideo{ max-height: 58vh; }
}

/* =========================
   Settings pages
   ========================= */
.pageTitle { font-size: 18px; margin: 8px 0 12px; }
.pageNav { display:flex; gap:10px; flex-wrap:wrap; margin-bottom: 12px; }

.listItem{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px;
  border:1px solid #eee;
  border-radius: 10px;
}
.listStack { display:flex; flex-direction:column; gap:10px; }

.switchRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px;
  border:1px solid #eee;
  border-radius:10px;
}
.switch{
  width: 46px; height: 28px;
  border-radius: 999px;
  background:#ddd;
  position: relative;
  cursor:pointer;
  border:1px solid #ccc;
}
.switch[data-on="1"]{ background:#bfe6bf; border-color:#9ad39a; }
.switchKnob{
  width: 22px; height: 22px;
  background:#fff;
  border-radius: 999px;
  position:absolute;
  top:2px; left:2px;
  transition: left .12s ease;
  border:1px solid #ccc;
}
.switch[data-on="1"] .switchKnob{ left: 22px; }

/* =========================
   Gallery grid
   ========================= */
.gallery{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.cardItem{
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  position: relative;
}
.thumb{
  width: 100%;
  height: 140px;
  border-radius: 10px;
  background: #000;
  object-fit: cover;
  cursor: pointer;
}
.itemTitle{
  margin-top: 8px;
  font-weight: 600;
  word-break: break-all;
}
.itemMeta{ margin-top: 4px; }

.itemActions{
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.iconBtn{
  height: 40px;
  border-radius: 12px;
  border: 1px solid #d0d0d0;
  background: #fff;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;

  color: #111;
  -webkit-tap-highlight-color: transparent;

  transition: transform .06s ease, background .12s ease, border-color .12s ease, color .12s ease;
}
.iconBtn svg{
  width: 20px; height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}
.iconBtn:active{ transform: scale(0.97); background: #f5f5f5; }
.iconBtnDanger{ border-color: #f0c7c7; color: #d0002f; }
.iconBtnGreen{ background: #e9f8ea; border-color: #9ad39a; color: #1b7f2a; }

/* =========================
   Toast bottom + progress line
   ========================= */
.yvHidden{ display:none !important; }

.yvToast{
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10050;
  width: min(520px, calc(100vw - 24px));
}
.yvToastBody{
  background: rgba(20,20,20,0.95);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.yvToastText{
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
}
.yvToastBar{
  margin-top: 10px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.2);
  overflow: hidden;
}
.yvToastBarFill{
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: rgba(255,255,255,0.9);
}
@keyframes yvToastBar{
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* =========================
   Auth / Login screen
   ========================= */
.loginScreen.hidden { display: none !important; }

.loginScreen{
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  background: #06060a;
  box-sizing: border-box;
}
.loginBg{
  position: absolute;
  inset: 0;
  background-image: url("/assets/img/auth.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(130%) contrast(115%);
  transform: scale(1.02);
}
.loginBg::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(60% 40% at 70% 50%, rgba(255,0,64,0.28), rgba(0,0,0,0) 60%),
    radial-gradient(45% 35% at 25% 55%, rgba(255,0,64,0.20), rgba(0,0,0,0) 62%),
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.55) 100%);
}
.loginCard{
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 22px 18px;
  border-radius: 18px;

  background: rgba(25, 18, 22, 0.75);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow:
    0 18px 60px rgba(0,0,0,0.60),
    inset 0 1px 0 rgba(255,255,255,0.08);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-sizing: border-box;
}
.loginLogoRow{
  display:flex;
  justify-content:center;
  margin-bottom: 10px;
  padding: 10px 10px 8px;
  border-radius: 14px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.loginLogo{
  width: min(460px, 92%);
  height: auto;
  display:block;
  filter:
    drop-shadow(0 0 22px rgba(255, 0, 64, 0.45))
    drop-shadow(0 0 4px rgba(255, 255, 255, 0.18));
}
.loginTitle{
  margin: 4px 0 14px;
  text-align:center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.92);
  text-transform: uppercase;
}
.loginFields{ display:grid; gap: 12px; }
.loginInput{
  width: 100%;
  height: 54px;
  border-radius: 12px;
  padding: 0 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.92);
  outline: none;
  font-size: 16px;
  box-sizing: border-box;
}
.loginInput::placeholder{ color: rgba(255,255,255,0.40); }
.loginInput:focus{
  border-color: rgba(255, 0, 64, 0.60);
  box-shadow: 0 0 0 4px rgba(255,0,64,0.14);
}
.loginBtn{
  width: 100%;
  height: 54px;
  border-radius: 12px;
  margin-top: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(90deg, #b40016, #e10024);
  color: #fff;
  font-weight: 800;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(225,0,36,0.26);
}
.loginBtn:active{ transform: scale(0.99); }
.loginErr{
  margin-top: 12px;
  min-height: 18px;
  text-align: center;
  color: rgba(255, 160, 160, 0.95);
  font-size: 13px;
}

/* =========================
   Mobile adaptations
   ========================= */
.btn, .btnLink, input, select, textarea {
  min-height: var(--tap);
  font-size: 16px;
}

@media (max-width: 820px){
  body { margin: 12px; }

  body{
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }

  .row{ flex-direction: column; gap: 12px; }
  .col{ min-width: 0; flex: 1 1 auto; }

  .card{ padding: 10px; border-radius: 12px; }

  table{ min-width: 640px; }
  .tableWrap{ overflow-x:auto; -webkit-overflow-scrolling: touch; }

  .gallery{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .thumb{ height: 150px; }

  .modal{
    padding: 10px;
    align-items: stretch;
    justify-content: center;
  }
  .modalCard{
    width: 100%;
    max-width: none;
    border-radius: 14px;
    padding: 12px;
    max-height: 92vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .playerVideo{ max-height: 70vh; }

  .yvHeader{
    flex-direction: column;
    gap: 12px;
  }
  .brandLogo{
    height: 56px;
    max-width: 85vw;
  }
  .topActions{
    justify-content: center;
  }

  .uploadPanel{ padding: 16px; }
}

@media (max-width: 640px) {
  .uploadButtonsRow{
    max-width: 100%;
    gap: 8px;
  }

  .uploadBtnPick,
  #cameraRecordBtn,
  .uploadBtnMain{
    font-size: 14px;
    padding: 0 10px;
  }
}

@media (max-width: 420px) {
  .uploadButtonsRow{
    gap: 6px;
  }

  .uploadBtnPick,
  #cameraRecordBtn,
  .uploadBtnMain{
    font-size: 13px;
    padding: 0 8px;
    letter-spacing: 0;
  }
}

@media (max-width: 360px){
  .thumb{ height: 120px; }
  .iconBtn svg{ width: 18px; height: 18px; }
  .loginCard{ padding: 18px 14px 14px; border-radius: 16px; }
  .loginInput, .loginBtn{ height: 50px; }
  .loginBtn{ height: 50px; }

  .uploadBtnPick,
  #cameraRecordBtn,
  .uploadBtnMain{
    font-size: 12px;
    padding: 0 6px;
  }
}

/* ✅ Ландшафт на телефонах — делаем интерфейс устойчивее */
@media (max-width: 932px) and (orientation: landscape) {
  body {
    margin: 8px;
  }

  .yvHeader {
    gap: 10px;
  }

  .brandLogo {
    height: 42px;
    max-width: 180px;
  }

  .uploadPanel {
    padding: 12px 14px;
  }

  .uploadGrid {
    gap: 10px;
  }

  .uploadButtonsRow {
    max-width: 520px;
  }

  .modalCard {
    max-height: 84vh;
  }

  .playerVideo {
    max-height: 56vh;
  }
}

/* ===== Upload progress (round spinner) ===== */

.yvUploadList{
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.yvUploadRow{
  display: grid;
  grid-template-columns: 22px 1fr 52px 88px;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #eee;
}

.yvUploadGear{
  width: 18px;
  height: 18px;
  border-radius: 50%;

  border: 2px solid rgba(0,0,0,0.15);
  border-top: 2px solid #b40016;

  animation: yvSpin 0.8s linear infinite;
}

@keyframes yvSpin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

.yvUploadSize,
.yvUploadPct,
.yvUploadSpeed{
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #111;
}

.yvUploadPct{
  text-align: right;
  color: #444;
}

.yvUploadSpeed{
  text-align: right;
  color: #666;
}

.yvUploadDone .yvUploadGear{
  animation: none;
  border-top-color: #1b7f2a;
  border-color: rgba(27,127,42,0.35);
}

.yvUploadDone .yvUploadSpeed{
  color: #111;
}

.yvUploadError{
  border-color: rgba(255, 80, 80, 0.35);
}

@media (max-width: 520px){
  .yvUploadRow{
    grid-template-columns: 20px 1fr 50px 80px;
    gap: 8px;
    padding: 10px;
  }
  .yvUploadSize,
  .yvUploadPct,
  .yvUploadSpeed{
    font-size: 12px;
  }
}

.yvUploadRow{
  display: grid;
  grid-template-columns: 26px 1fr 52px 88px;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #eee;
}

.yvUploadGear{
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  opacity: .95;
}

.yvUploadGear svg{
  width: 20px;
  height: 20px;
  color: #b40016;
}

.yvSpin{
  animation: yvSpin 0.9s linear infinite;
}

@keyframes yvSpin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

.yvUploadSize,
.yvUploadPct,
.yvUploadSpeed{
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #111;
}

.yvUploadPct{
  text-align: right;
  color: #444;
}

.yvUploadSpeed{
  text-align: right;
  color: #666;
}

.yvUploadDone .yvUploadSpeed{ color: #111; }
.yvUploadError{ border-color: rgba(255, 80, 80, 0.35); }

@media (max-width: 520px){
  .yvUploadRow{
    grid-template-columns: 24px 1fr 50px 80px;
    gap: 8px;
    padding: 10px;
  }
  .yvUploadSize, .yvUploadPct, .yvUploadSpeed{ font-size: 12px; }
}

/* ===== Cabinet layout ===== */

.cabinetHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cabinetTitle {
  margin: 0;
}

.cabinetSettingsBtn {
  margin-left: auto;
}

.cabinetContent {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cabinetLogin {
  font-size: 16px;
  font-weight: 500;
}

.cabinetPasswordBlock h3 {
  margin-bottom: 10px;
}

.inputFull {
  width: 100%;
  margin-bottom: 8px;
}

.cabinetLogoutWrap {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.btnDanger {
  background: #c0392b;
  border: none;
  color: #fff;
}

/* ===== Admin Settings Layout ===== */

.settingsTitleCenter{
  text-align: center;
  font-weight: 800;
  color: #b40016;
  margin: 8px 0 18px;
}

.settingsButtonsCenter{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.settingsBackRight{
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.settingsBackRight + .card .rowInline{
  margin-top: 14px !important;
}

.rowInline.settingsRowMarginTop{
  margin-top: 14px !important;
}

/* ===== Fix: modals on mobile should be centered ===== */
@media (max-width: 820px){
  .modal{
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
  }

  .modalCard{
    width: min(560px, calc(100vw - 24px)) !important;
    max-width: 560px !important;
    max-height: 88vh !important;
    overflow: auto !important;
    border-radius: 14px !important;
  }

  #playerModal.modal{
    align-items: flex-start !important;
    padding-top: 10px !important;
  }
  #playerModal .modalCard{
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* ===== Public Share Title ===== */
.shareTitleCentered{
  font-weight: 800;
  color: #b40016;
  text-align: center;
  font-size: 20px;
  margin: 8px 0 18px;
}

/* ===== AUTH BACKGROUND ===== */

#loginModal.modal{
  position: fixed;
  inset: 0;
  z-index: 20000;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;

  overflow: hidden;

  background:
    radial-gradient(circle at 30% 30%, rgba(255,0,64,0.15), transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(255,0,64,0.12), transparent 45%),
    linear-gradient(180deg, #0f0f14 0%, #1a0f14 100%);
}

#loginModal.modal::before,
#loginModal.modal::after{
  content:"";
  position:absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,0,64,0.25), transparent 60%);
  filter: blur(80px);
  animation: floatBlob 18s ease-in-out infinite alternate;
}

#loginModal.modal::before{
  top: -150px;
  left: -150px;
}

#loginModal.modal::after{
  bottom: -200px;
  right: -150px;
  animation-duration: 22s;
}

@keyframes floatBlob{
  0%{
    transform: translateY(0px) translateX(0px) scale(1);
  }
  50%{
    transform: translateY(40px) translateX(30px) scale(1.1);
  }
  100%{
    transform: translateY(-20px) translateX(-20px) scale(0.95);
  }
}

@media (max-width: 768px){
  #loginModal.modal::before,
  #loginModal.modal::after{
    width: 350px;
    height: 350px;
    filter: blur(60px);
    animation-duration: 26s;
  }
}

#loginModal .modalCard{
  background: rgba(25, 18, 22, 0.78) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  border-radius: 18px !important;
  box-shadow:
    0 18px 60px rgba(0,0,0,0.60),
    inset 0 1px 0 rgba(255,255,255,0.08) !important;

  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

#loginModal #loginTitle{
  color: rgba(255,255,255,0.92) !important;
  font-weight: 900 !important;
  letter-spacing: 1.4px !important;
  text-transform: uppercase !important;
  text-align: center !important;
  margin: 0 0 14px !important;
}

#loginModal .formRow label{
  color: rgba(255,255,255,0.55) !important;
}

#loginModal input[type="text"],
#loginModal input[type="password"]{
  background: rgba(0,0,0,0.25) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  color: rgba(255,255,255,0.92) !important;
  border-radius: 12px !important;
  height: 54px !important;
}

#loginModal input::placeholder{
  color: rgba(255,255,255,0.40) !important;
}

#loginModal input:focus{
  border-color: rgba(255, 0, 64, 0.60) !important;
  box-shadow: 0 0 0 4px rgba(255,0,64,0.14) !important;
}

#loginModal #loginBtn{
  width: 100% !important;
  height: 54px !important;
  border-radius: 12px !important;
  margin-top: 14px !important;

  border: 1px solid rgba(255,255,255,0.12) !important;
  background: linear-gradient(90deg, #b40016, #e10024) !important;
  color: #fff !important;

  font-weight: 900 !important;
  letter-spacing: 2px !important;
  text-transform: uppercase !important;

  box-shadow: 0 18px 34px rgba(225,0,36,0.26) !important;
}

#loginModal #loginErr{
  color: rgba(255, 160, 160, 0.95) !important;
  text-align: center !important;
  margin-top: 10px !important;
  min-height: 18px !important;
}

@media (max-width: 520px){
  #loginModal .modalCard{
    padding: 18px 14px 14px !important;
    border-radius: 16px !important;
  }
  #loginModal input[type="text"],
  #loginModal input[type="password"],
  #loginModal #loginBtn{
    height: 50px !important;
  }
}

#loginModal .authLogo{
  height: 110px;
  margin-bottom: 14px;
  border-radius: 14px;

  background-image: url("/assets/img/yaponecMain.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  filter:
    drop-shadow(0 0 25px rgba(255, 0, 64, 0.45))
    drop-shadow(0 0 8px rgba(255, 0, 64, 0.25));

  transition: transform .3s ease;
}

@media (hover:hover){
  #loginModal .authLogo:hover{
    transform: scale(1.03);
  }
}

@media (max-width: 520px){
  #loginModal .authLogo{
    height: 90px;
    margin-bottom: 10px;
  }
}

.thumbFallback{
  background: linear-gradient(135deg, rgba(255,0,64,0.10), rgba(0,0,0,0.22));
}

.cardDownloadBtn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  backdrop-filter: blur(4px);
  transition: all .2s ease;
}

.cardDownloadBtn:hover {
  background: rgba(0,0,0,0.85);
  transform: scale(1.05);
}

.yvSelectedFiles {
  margin-top: 8px;
}

.yvSelectedFileRow {
  font-size: 14px;
  padding: 4px 0;
  color: #555;
}
/* =========================
   Camera recorder overlay
   ========================= */

.yvCameraOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #ffffff;
  display: none;
  overflow: hidden;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.yvCameraOverlay.isOpen {
  display: block;
}

.yvCameraStage {
  width: 100%;
  height: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.yvCameraTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

.yvCameraInfo {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yvCameraMain {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.yvCameraSurface {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}

.yvCameraPreview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
  border-radius: 18px;
}

.yvCameraSide {
  display: grid;
  gap: 12px;
  align-content: center;
  justify-items: center;
  min-width: 0;
  width: 100%;
}

.yvCameraControls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.yvCameraIconBtn {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: #e50022;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(229, 0, 34, 0.22);
  -webkit-tap-highlight-color: transparent;
}

.yvCameraIconBtn[disabled] {
  opacity: .45;
  cursor: default;
  box-shadow: none;
}

.yvCameraIconBtn svg {
  width: 28px;
  height: 28px;
  display: block;
}

.yvCameraActionBlock {
  display: none;
  gap: 12px;
  align-content: start;
  justify-items: center;
  width: 100%;
}

.yvCameraActionBlock.isVisible {
  display: grid;
}

.yvCameraUseRow,
.yvCameraCloseRow {
  display: flex;
  justify-content: center;
  width: 100%;
}

.yvCameraMovedTitleWrap {
  width: 100%;
  max-width: 720px;
  display: grid;
  gap: 10px;
}

.yvCameraMovedTitleWrap input {
  width: 100%;
  box-sizing: border-box;
}

.yvCameraUseRow .btn,
.yvCameraCloseRow .btn {
  width: 100%;
  max-width: 720px;
}

body.yvCameraMode {
  overflow: hidden;
  touch-action: none;
}

/* Portrait */
@media (orientation: portrait) {
  .yvCameraStage {
    max-width: 980px;
  }

  .yvCameraMain {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .yvCameraSide {
    justify-items: center;
    align-content: start;
  }

  .yvCameraControls {
    flex-direction: row;
    justify-content: center;
  }

  .yvCameraActionBlock {
    justify-items: center;
    align-content: start;
  }

  .yvCameraMovedTitleWrap,
  .yvCameraUseRow,
  .yvCameraCloseRow {
    max-width: 720px;
  }
}

/* Landscape base */
@media (orientation: landscape) {
  .yvCameraOverlay {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(32px, calc(env(safe-area-inset-left) + 40px));
  }

  .yvCameraStage {
    max-width: none;
    margin: 0;
  }

  /* Во время записи: справа только кнопки, без широкой пустоты */
  .yvCameraOverlay.is-recording-layout .yvCameraMain {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 14px;
  }

  .yvCameraOverlay.is-recording-layout .yvCameraSide {
    width: 88px;
    justify-items: center;
    align-content: center;
  }

  .yvCameraOverlay.is-recording-layout .yvCameraControls {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 88px;
  }

  /* После stop: справа уже широкий action-блок */
  .yvCameraOverlay.is-after-stop-layout .yvCameraMain {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 16px;
  }

  .yvCameraOverlay.is-after-stop-layout .yvCameraSide {
    width: 100%;
    justify-items: stretch;
    align-content: center;
  }

  .yvCameraOverlay.is-after-stop-layout .yvCameraActionBlock {
    justify-items: stretch;
    align-content: center;
  }

  .yvCameraOverlay.is-after-stop-layout .yvCameraUseRow,
  .yvCameraOverlay.is-after-stop-layout .yvCameraCloseRow {
    justify-content: stretch;
  }

  .yvCameraOverlay.is-after-stop-layout .yvCameraUseRow .btn,
  .yvCameraOverlay.is-after-stop-layout .yvCameraCloseRow .btn {
    width: 100%;
    max-width: none;
  }

  .yvCameraOverlay.is-after-stop-layout .yvCameraMovedTitleWrap {
    max-width: none;
  }

  .yvCameraIconBtn {
    width: 64px;
    height: 64px;
    margin: 0 auto;
  }

  .yvCameraIconBtn svg {
    width: 28px;
    height: 28px;
  }
}

/* Маленькие телефоны в landscape */
@media (max-width: 932px) and (orientation: landscape) {
  .yvCameraOverlay {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(42px, calc(env(safe-area-inset-left) + 46px));
  }

  .yvCameraTop {
    min-height: 24px;
  }

  .yvCameraInfo {
    font-size: 13px;
  }

  .yvCameraOverlay.is-recording-layout .yvCameraMain {
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 12px;
  }

  .yvCameraOverlay.is-recording-layout .yvCameraControls {
    width: 82px;
  }

  .yvCameraOverlay.is-after-stop-layout .yvCameraMain {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
    gap: 14px;
  }

  .yvCameraIconBtn {
    width: 60px;
    height: 60px;
  }

  .yvCameraIconBtn svg {
    width: 26px;
    height: 26px;
  }
}
/* =========================================
   Gallery sub-nav: [Корзина] [Доноры] [Видео]
   ========================================= */

.pageNav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  justify-items: center;
  align-items: center;
}

/* Кнопки одинаковые по ширине и не растягиваются */
#navTrash,
#navDonors,
#navVideos {
  width: 100%;
  max-width: 180px;
  min-width: 0;
}

/* Центровка текста */
#navTrash,
#navDonors,
#navVideos {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* Мобильные — чуть компактнее */
@media (max-width: 420px) {
  .pageNav {
    gap: 8px;
  }

  #navTrash,
  #navDonors,
  #navVideos {
    max-width: 140px;
    font-size: 13px;
    padding: 0 8px;
  }
}
/* =========================================
   Main nav mobile layout
   Должно быть:
   [Загрузка] [Галерея] [Кабинет]
   [Корзина]  [Доноры]  [Видео]
   ========================================= */

@media (max-width: 820px) {
  .topActions {
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    justify-items: center;
    align-items: center;
  }

  .topActions > * {
    width: 100%;
    min-width: 0;
    max-width: 180px;
  }

  #navUpload {
    order: 1;
  }

  #navGallery {
    order: 2;
  }

  #navCabinet {
    order: 3;
  }

  #navTrash {
    order: 4;
  }

  #navDonors {
    order: 5;
  }

  #navVideos {
    order: 6;
  }

  #navUpload,
  #navGallery,
  #navCabinet,
  #navTrash,
  #navDonors,
  #navVideos {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
    max-width: 180px;
    box-sizing: border-box;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .topActions {
    gap: 10px;
  }

  .topActions > * {
    max-width: 150px;
  }

  #navUpload,
  #navGallery,
  #navCabinet,
  #navTrash,
  #navDonors,
  #navVideos {
    max-width: 150px;
    font-size: 13px;
    padding-left: 8px;
    padding-right: 8px;
  }
}
/* =========================================
   NAV LAYOUT FIX
   Desktop:
   [Загрузка] [Галерея] [Кабинет] [Корзина] [Доноры] [Видео]

   Mobile:
   [Загрузка] [Галерея] [Кабинет]
   [Корзина]  [Доноры]  [Видео]
   ========================================= */

/* ---------- Desktop / tablet ---------- */
@media (min-width: 821px) {
  .topActions {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: auto;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .topActions > * {
    width: auto;
    max-width: none;
    min-width: 0;
    flex: 0 0 auto;
  }

  #navUpload,
  #navGallery,
  #navCabinet,
  #navTrash,
  #navDonors,
  #navVideos {
    display: inline-flex;
    width: auto;
    max-width: none;
    min-width: 140px;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    box-sizing: border-box;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .topActions {
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    justify-items: center;
    align-items: center;
  }

  .topActions > * {
    width: 100%;
    min-width: 0;
    max-width: 180px;
  }

  #navUpload { order: 1; }
  #navGallery { order: 2; }
  #navCabinet { order: 3; }
  #navTrash { order: 4; }
  #navDonors { order: 5; }
  #navVideos { order: 6; }

  #navUpload,
  #navGallery,
  #navCabinet,
  #navTrash,
  #navDonors,
  #navVideos {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
    max-width: 180px;
    white-space: nowrap;
    box-sizing: border-box;
  }
}

/* ---------- Small mobile ---------- */
@media (max-width: 420px) {
  .topActions {
    gap: 10px;
  }

  .topActions > * {
    max-width: 150px;
  }

  #navUpload,
  #navGallery,
  #navCabinet,
  #navTrash,
  #navDonors,
  #navVideos {
    max-width: 150px;
    min-width: 0;
    font-size: 13px;
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* =========================================
   FINAL CAMERA BUTTON STATE FIX
   Добавлено в конец файла, чтобы перекрыть старые стили
   ========================================= */

/* Базово все круглые кнопки камеры — нейтральные, не красные */
.yvCameraIconBtn {
  background: #d8d8d8;
  color: #555;
  box-shadow: none;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Кнопка режима: выключена — серая, включена — красная */
.yvCameraModeBtn {
  background: #d8d8d8;
  color: #6b6b6b;
  box-shadow: none;
  border: 1px solid rgba(0,0,0,0.08);
}

.yvCameraModeBtn.isActive {
  background: #e50022;
  color: #fff;
  box-shadow: 0 8px 24px rgba(229, 0, 34, 0.22);
  border-color: transparent;
}

/* Старт — зелёный */
.yvCameraIconBtn.isStart {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.25);
  border-color: transparent;
}

/* Стоп — красный */
.yvCameraIconBtn.isStop {
  background: #e50022;
  color: #fff;
  box-shadow: 0 8px 24px rgba(229, 0, 34, 0.25);
  border-color: transparent;
}

/* Disabled оставляем приглушёнными */
.yvCameraIconBtn[disabled],
.yvCameraModeBtn[disabled] {
  opacity: .45;
  cursor: default;
  box-shadow: none;
}

/* В landscape кнопку режима скрываем, как и было задумано */
@media (orientation: landscape) {
  .yvCameraModeBtn {
    display: none !important;
  }
}
/* =========================================
   Camera controls order (portrait only)
   Порядок:
   1. Режим
   2. Пауза
   3. Старт / Стоп
   ========================================= */

@media (orientation: portrait) {
  #cameraControlsRow {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* 1 — режим */
  #cameraRotateBtn {
    order: 1;
  }

  /* 2 — пауза */
  #cameraPauseBtn {
    order: 2;
  }

  /* 3 — старт/стоп */
  #cameraPrimaryBtn {
    order: 3;
  }
}

/* =========================================
   Personal theme
   ========================================= */
:root{
  --yv-bg-rgb: 255,255,255;
  --yv-card-rgb: 255,255,255;
  --yv-btn-rgb: 225,0,36;
  --yv-btn-border-rgb: 180,0,22;
  --yv-text-rgb: 17,17,17;
  --yv-muted-rgb: 102,102,102;
  --yv-btn-text-rgb: 255,255,255;
  --yv-btn-hover-text-rgb: 255,255,255;
}

body{
  background: rgb(var(--yv-bg-rgb));
  color: rgb(var(--yv-text-rgb));
}

.card,
.uploadPanel,
.modalCard,
.listItem,
.switchRow,
.yvUploadRow{
  background: rgb(var(--yv-card-rgb));
  color: rgb(var(--yv-text-rgb));
}

.uploadInput,
.formRow input,
.formRow select,
.formRow textarea,
#gallerySearch{
  background: rgba(var(--yv-card-rgb), 0.96);
  color: rgb(var(--yv-text-rgb));
  border-color: rgba(var(--yv-text-rgb), 0.16);
}

.formRow label,
.muted,
.itemMeta,
.yvUploadPct,
.yvUploadSpeed,
.yvUploadSize{
  color: rgba(var(--yv-muted-rgb), 0.78) !important;
}

th,
td,
.listItem,
.switchRow,
.itemTitle,
.modalTitle,
.pageTitle,
#page{
  color: rgb(var(--yv-text-rgb));
}

.btn,
.btnLink,
.loginBtn{
  border-color: rgba(var(--yv-btn-border-rgb), 0.40);
  background: rgb(var(--yv-btn-rgb));
  color: rgb(var(--yv-btn-text-rgb)) !important;
}

.btn:hover,
.btnLink:hover,
.loginBtn:hover{
  color: rgb(var(--yv-btn-hover-text-rgb)) !important;
}

.btn:active,
.btnLink:active,
.loginBtn:active{
  color: rgb(var(--yv-btn-hover-text-rgb)) !important;
}

.btnDanger{
  border-color: rgba(var(--yv-btn-rgb), 0.45);
}

.iconBtnGreen{
  background: rgba(var(--yv-btn-rgb), 0.12);
  border-color: rgba(var(--yv-btn-rgb), 0.36);
  color: rgb(var(--yv-btn-rgb));
}

#uiModal .modalCard{
  width: min(760px, 100%);
}

.yvThemeModal{
  display: grid;
  gap: 14px;
}

.yvThemeHint{
  font-size: 13px;
  line-height: 1.45;
  color: rgba(var(--yv-text-rgb), 0.78);
}

.yvThemeGrid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.yvThemeRgbInput{
  width: 100%;
}

.yvThemeColorInput{
  width: 100%;
  height: 44px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(var(--yv-text-rgb), 0.18);
  background: rgba(var(--yv-card-rgb), 0.98);
  cursor: pointer;
}

.yvThemePreview{
  border: 1px solid rgba(var(--yv-text-rgb), 0.14);
  border-radius: 14px;
  padding: 14px;
  min-height: 132px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.yvThemePreviewTitle{
  font-size: 18px;
  font-weight: 700;
}

.yvThemePreviewText{
  line-height: 1.45;
}

.yvThemePreviewBtn{
  width: fit-content;
  min-width: 140px;
}

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

  .yvThemePreviewBtn{
    width: 100%;
  }
}
