/* ProZagadka V162 — mobile solver/camera reliability overrides.
   Loaded last on public and account solver screens. */

/* Photo preview remove button: center the X independently of font metrics. */
.photo-preview-item button[data-remove-photo]{
  display:grid!important;
  place-items:center!important;
  box-sizing:border-box!important;
  padding:0!important;
  font-size:0!important;
  line-height:0!important;
  text-align:center!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent!important;
}
.photo-preview-item button[data-remove-photo]::before{
  content:"×"!important;
  display:block!important;
  margin:0!important;
  padding:0!important;
  font:700 20px/1 Arial,Helvetica,sans-serif!important;
  transform:translateY(-1px)!important;
}

/* Camera is fully self-contained here so cabinet and public pages behave identically. */
html.pz-camera-open,
html.pz-camera-open body,
body.pz-camera-open{
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
.pz-camera-layer{
  position:fixed!important;
  inset:0!important;
  z-index:10000!important;
  display:grid!important;
  place-items:center!important;
  box-sizing:border-box!important;
  padding:18px!important;
  background:rgba(12,10,40,.78)!important;
  backdrop-filter:blur(10px)!important;
  touch-action:none!important;
}
.pz-camera-dialog{
  width:min(820px,100%)!important;
  max-height:calc(100vh - 36px)!important;
  max-height:calc(100dvh - 36px)!important;
  overflow:hidden!important;
  border:1px solid #e5dcff!important;
  border-radius:24px!important;
  background:#fff!important;
  box-shadow:0 30px 90px rgba(29,18,79,.38)!important;
  pointer-events:auto!important;
}
.pz-camera-head{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:16px!important;
  padding:15px 18px!important;
  color:#11175a!important;
}
.pz-camera-head b{font-size:17px!important;line-height:1.35!important}
.pz-camera-close[data-camera-close]{
  position:relative!important;
  display:block!important;
  flex:0 0 50px!important;
  width:50px!important;
  height:50px!important;
  min-width:50px!important;
  min-height:50px!important;
  box-sizing:border-box!important;
  padding:0!important;
  border:1px solid #e2d7ff!important;
  border-radius:50%!important;
  background:#f4efff!important;
  color:transparent!important;
  font-size:0!important;
  line-height:0!important;
  cursor:pointer!important;
  box-shadow:0 5px 16px rgba(58,38,130,.10)!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent!important;
}
.pz-camera-close[data-camera-close]::before,
.pz-camera-close[data-camera-close]::after{
  content:""!important;
  position:absolute!important;
  left:50%!important;
  top:50%!important;
  width:24px!important;
  height:3px!important;
  margin:0!important;
  border-radius:99px!important;
  background:#6f49ef!important;
  transform-origin:center!important;
  pointer-events:none!important;
}
.pz-camera-close[data-camera-close]::before{transform:translate(-50%,-50%) rotate(45deg)!important}
.pz-camera-close[data-camera-close]::after{transform:translate(-50%,-50%) rotate(-45deg)!important}
.pz-camera-video-wrap{
  position:relative!important;
  display:grid!important;
  place-items:center!important;
  width:100%!important;
  aspect-ratio:4/3!important;
  background:#090d20!important;
  overflow:hidden!important;
}
.pz-camera-video-wrap video{
  display:block!important;
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
  background:#090d20!important;
}
.pz-camera-hint{
  position:absolute!important;
  left:12px!important;
  right:12px!important;
  bottom:12px!important;
  margin:0!important;
  padding:8px 10px!important;
  border-radius:11px!important;
  background:rgba(17,23,90,.72)!important;
  color:#fff!important;
  font-size:12px!important;
  line-height:1.35!important;
  text-align:center!important;
  backdrop-filter:blur(6px)!important;
  pointer-events:none!important;
}
.pz-camera-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:10px!important;
  padding:14px 18px 18px!important;
}
.pz-camera-actions button{
  min-height:50px!important;
  padding:0 20px!important;
  border-radius:14px!important;
  font-weight:900!important;
  cursor:pointer!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent!important;
}
.pz-camera-cancel{border:1px solid #e1d8f7!important;background:#fff!important;color:#655f7d!important}
.pz-camera-shot{border:0!important;background:linear-gradient(135deg,#8056f4 0%,#5e3be7 100%)!important;color:#fff!important;box-shadow:0 12px 26px rgba(96,60,231,.25)!important}
.pz-camera-shot:disabled{opacity:.55!important;cursor:wait!important}

/* One scroll container: the white solver modal itself. */
.solver-progress-backdrop-v116{
  position:fixed!important;
  inset:0!important;
  z-index:1220!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:100%!important;
  height:100vh!important;
  height:100dvh!important;
  box-sizing:border-box!important;
  padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important;
  overflow:hidden!important;
  touch-action:auto!important;
}
.solver-progress-backdrop-v116[hidden]{display:none!important}
.solver-progress-modal-v116{
  position:relative!important;
  width:min(680px,100%)!important;
  max-width:680px!important;
  height:auto!important;
  max-height:calc(100vh - 16px)!important;
  max-height:calc(100dvh - 16px)!important;
  min-height:0!important;
  box-sizing:border-box!important;
  margin:0!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  -webkit-overflow-scrolling:touch!important;
  overscroll-behavior:contain!important;
  touch-action:pan-y!important;
  scrollbar-gutter:stable!important;
}
.solver-task-selection,
.solver-task-selection-list{
  width:100%!important;
  max-height:none!important;
  min-height:0!important;
  box-sizing:border-box!important;
  overflow:visible!important;
  touch-action:pan-y!important;
}
.solver-task-selection-list{
  display:flex!important;
  flex-direction:column!important;
  gap:8px!important;
}
.solver-task-selection-list>button{
  width:100%!important;
  min-height:52px!important;
  height:auto!important;
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:max-content minmax(0,1fr)!important;
  align-items:start!important;
  gap:10px!important;
  padding:11px 12px!important;
  text-align:left!important;
  white-space:normal!important;
  overflow:visible!important;
}
.solver-task-selection-list>button strong{
  min-width:28px!important;
  width:auto!important;
  white-space:nowrap!important;
  overflow:visible!important;
  font-variant-numeric:tabular-nums!important;
}
.solver-task-selection-list>button span{
  min-width:0!important;
  white-space:normal!important;
  overflow:visible!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
  line-height:1.4!important;
}
.solver-selection-notice{
  margin:8px 0!important;
  padding:9px 11px!important;
  border:1px solid #f0d49b!important;
  border-radius:10px!important;
  background:#fff9ed!important;
  color:#70531b!important;
  font-size:12px!important;
  line-height:1.45!important;
}

/* No automatic caret/keyboard. Editing starts only after an explicit tap handled in JS. */
.solver-confirm-editor-v130 textarea[data-confirm-task][readonly]{
  caret-color:transparent!important;
  -webkit-user-modify:read-only!important;
  cursor:text!important;
  -webkit-user-select:text!important;
  user-select:text!important;
  touch-action:pan-y!important;
}
.solver-confirm-editor-v130 textarea[data-confirm-task]:not([readonly]){
  -webkit-user-modify:read-write!important;
  caret-color:auto!important;
  touch-action:auto!important;
}

/* Main solver close control: intentionally much larger on touch screens. */
.solver-progress-close-v116{
  width:72px!important;
  height:72px!important;
  min-width:72px!important;
  min-height:72px!important;
  right:10px!important;
  top:10px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  overflow:visible!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent!important;
}
.solver-progress-close-v116 img{
  width:68px!important;
  height:68px!important;
  max-width:none!important;
  max-height:none!important;
  object-fit:contain!important;
  display:block!important;
}

@media(max-width:720px){
  .solver-progress-backdrop-v116{
    align-items:center!important;
    padding:max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))!important;
  }
  .solver-progress-modal-v116{
    width:100%!important;
    max-width:none!important;
    max-height:calc(100vh - 12px)!important;
    max-height:calc(100dvh - 12px)!important;
    min-height:0!important;
    border-radius:18px!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    padding-top:max(24px,env(safe-area-inset-top))!important;
    padding-bottom:max(22px,env(safe-area-inset-bottom))!important;
  }
}

@media(max-width:700px){
  .pz-camera-layer{padding:0!important}
  .pz-camera-dialog{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    height:100vh!important;
    height:100dvh!important;
    max-height:none!important;
    border:0!important;
    border-radius:0!important;
  }
  .pz-camera-head{align-items:flex-start!important;padding:12px 14px!important}
  .pz-camera-head b{font-size:15px!important;padding-top:5px!important}
  .pz-camera-close[data-camera-close]{
    flex-basis:52px!important;
    width:52px!important;
    height:52px!important;
    min-width:52px!important;
    min-height:52px!important;
  }
  .pz-camera-video-wrap{flex:1!important;min-height:0!important;aspect-ratio:auto!important}
  .pz-camera-actions{padding:12px 14px calc(12px + env(safe-area-inset-bottom))!important;background:#fff!important}
  .pz-camera-actions button{min-height:54px!important}
  .pz-camera-shot{flex:1!important}
  .pz-camera-cancel{padding-inline:16px!important}
}

@media(max-width:520px){
  .solver-progress-close-v116{
    width:66px!important;
    height:66px!important;
    min-width:66px!important;
    min-height:66px!important;
    right:6px!important;
    top:6px!important;
  }
  .solver-progress-close-v116 img{width:62px!important;height:62px!important}
}


/* V163 — mobile solver header containment.
   The settings control must remain inside both the public form and cabinet modal. */
@media(max-width:700px){
  .solver-v141 .solver-topbar-v141{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 62px!important;
    align-items:start!important;
    gap:10px!important;
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  .solver-v141 .solver-input-tabs{
    min-width:0!important;
    width:auto!important;
    max-width:100%!important;
    overflow-wrap:anywhere!important;
  }
  .solver-v141 .solver-input-tabs b,
  .solver-v141 .solver-input-tabs span{
    max-width:100%!important;
    overflow-wrap:anywhere!important;
  }
  .solver-v141 .solver-settings-toggle-v141{
    position:static!important;
    inset:auto!important;
    transform:none!important;
    justify-self:end!important;
    align-self:start!important;
    flex:0 0 62px!important;
    width:62px!important;
    min-width:62px!important;
    max-width:62px!important;
    height:62px!important;
    min-height:62px!important;
    margin:0!important;
    padding:7px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }
  .solver-v141 .solver-settings-toggle-v141 img{
    display:block!important;
    width:38px!important;
    height:38px!important;
    max-width:38px!important;
    max-height:38px!important;
    margin:auto!important;
    object-fit:contain!important;
  }
  .solver-v141 .solver-settings-toggle-v141 span{display:none!important}
  .mg-cab-solver-v116 .photo-solver,
  .mg-cab-solver-v116 .solver-topbar-v141,
  .mg-cab-solver-v116 .photo-drop,
  .mg-cab-solver-v116 .solver-task-text,
  .mg-cab-solver-v116 .solver-settings-panel-v141{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
}
@media(max-width:420px){
  .solver-v141 .solver-topbar-v141{grid-template-columns:minmax(0,1fr) 56px!important;gap:8px!important}
  .solver-v141 .solver-settings-toggle-v141{
    flex-basis:56px!important;
    width:56px!important;
    min-width:56px!important;
    max-width:56px!important;
    height:56px!important;
    min-height:56px!important;
    padding:6px!important;
  }
  .solver-v141 .solver-settings-toggle-v141 img{width:34px!important;height:34px!important;max-width:34px!important;max-height:34px!important}
}

/* V406: hard-center the settings gear on mobile/cabinet solver.
   Absolute centering prevents flex/grid/intrinsic image metrics from shifting it left. */
@media (max-width:760px){
  .solver-v141 .solver-settings-toggle-v141{
    position:relative!important;
    display:block!important;
    flex:0 0 62px!important;
    width:62px!important;
    min-width:62px!important;
    max-width:62px!important;
    height:62px!important;
    min-height:62px!important;
    padding:0!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  .solver-v141 .solver-settings-toggle-v141 img{
    position:absolute!important;
    left:50%!important;
    top:50%!important;
    display:block!important;
    width:38px!important;
    height:38px!important;
    max-width:38px!important;
    max-height:38px!important;
    margin:0!important;
    padding:0!important;
    object-fit:contain!important;
    transform:translate(-50%,-50%)!important;
    transform-origin:center center!important;
  }
  .solver-v141 .solver-settings-toggle-v141 span{display:none!important}
}
@media (max-width:420px){
  .solver-v141 .solver-settings-toggle-v141{
    flex-basis:56px!important;
    width:56px!important;
    min-width:56px!important;
    max-width:56px!important;
    height:56px!important;
    min-height:56px!important;
  }
  .solver-v141 .solver-settings-toggle-v141 img{
    width:34px!important;
    height:34px!important;
    max-width:34px!important;
    max-height:34px!important;
  }
}


/* V407 — definitive mobile settings-button containment.
   Fixes BOTH public solver and cabinet "Новая задача" modal.
   The button itself is pinned inside the topbar; cache-busted with a new filename. */
@media (max-width:760px){
  .solver-form-wrap,
  .solver-form-wrap .photo-solver.solver-v141,
  .mg-cab-solver-v116,
  .mg-cab-solver-v116 .photo-solver.solver-v141,
  .photo-solver.solver-v141{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141{
    position:relative!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0 66px 0 0!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 .solver-input-tabs{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
    overflow-wrap:anywhere!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141{
    position:absolute!important;
    top:0!important;
    right:0!important;
    bottom:auto!important;
    left:auto!important;
    inset:auto 0 auto auto!important;
    z-index:5!important;
    display:grid!important;
    place-items:center!important;
    width:56px!important;
    min-width:56px!important;
    max-width:56px!important;
    height:56px!important;
    min-height:56px!important;
    max-height:56px!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141 img{
    position:static!important;
    inset:auto!important;
    display:block!important;
    width:34px!important;
    min-width:34px!important;
    max-width:34px!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    object-fit:contain!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141 span{
    display:none!important;
  }
}

@media (max-width:420px){
  .photo-solver.solver-v141 .solver-topbar-v141{
    padding-right:60px!important;
  }
  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141{
    width:52px!important;
    min-width:52px!important;
    max-width:52px!important;
    height:52px!important;
    min-height:52px!important;
    max-height:52px!important;
  }
  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141 img{
    width:32px!important;
    min-width:32px!important;
    max-width:32px!important;
    height:32px!important;
    min-height:32px!important;
    max-height:32px!important;
  }
}

/* V408 — mobile solver topbar: text LEFT, settings button RIGHT.
   No absolute positioning. Mobile only. Also suppress an accidental duplicate
   settings button if one is emitted immediately after the form. */
@media (max-width:760px){
  .photo-solver.solver-v141 .solver-topbar-v141{
    position:relative!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 48px!important;
    align-items:start!important;
    column-gap:10px!important;
    row-gap:0!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-input-tabs{
    grid-column:1!important;
    grid-row:1!important;
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-input-tabs b,
  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-input-tabs span{
    width:auto!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-wrap:break-word!important;
    word-break:normal!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141{
    grid-column:2!important;
    grid-row:1!important;
    position:static!important;
    inset:auto!important;
    top:auto!important;
    right:auto!important;
    bottom:auto!important;
    left:auto!important;
    align-self:start!important;
    justify-self:end!important;
    place-self:start end!important;
    display:grid!important;
    place-items:center!important;
    width:48px!important;
    min-width:48px!important;
    max-width:48px!important;
    height:48px!important;
    min-height:48px!important;
    max-height:48px!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    z-index:2!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141 img{
    position:static!important;
    inset:auto!important;
    display:block!important;
    width:30px!important;
    min-width:30px!important;
    max-width:30px!important;
    height:30px!important;
    min-height:30px!important;
    max-height:30px!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    object-fit:contain!important;
  }

  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141 span{
    display:none!important;
  }

  /* Defensive: an old/duplicate settings control outside the solver form must
     never affect the mobile layout. */
  .photo-solver.solver-v141 + .solver-settings-toggle-v141{
    display:none!important;
  }
}

@media (max-width:400px){
  .photo-solver.solver-v141 .solver-topbar-v141{
    grid-template-columns:minmax(0,1fr) 44px!important;
    column-gap:8px!important;
  }
  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141{
    width:44px!important;
    min-width:44px!important;
    max-width:44px!important;
    height:44px!important;
    min-height:44px!important;
    max-height:44px!important;
  }
  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-settings-toggle-v141 img{
    width:28px!important;
    min-width:28px!important;
    max-width:28px!important;
    height:28px!important;
    min-height:28px!important;
    max-height:28px!important;
  }
}

/* V410 — mobile only. Remove decorative intro stripes; desktop unchanged. */
@media (max-width:760px){
  .photo-solver.solver-v82 .solver-input-tabs::before,
  .photo-solver.solver-v141 .solver-topbar-v141::before,
  .solver-v82 .solver-input-tabs::before,
  .solver-v141 .solver-topbar-v141::before{
    content:none!important;
    display:none!important;
  }
  .photo-solver.solver-v82 .solver-input-tabs,
  .photo-solver.solver-v141 .solver-topbar-v141 > .solver-input-tabs{
    padding-left:0!important;
  }
}
