/* ==========================================================
 * MOYAMOVA 1.12.8 — Mobile Favorites + Mistakes
 * Same visual language as Mobile Dictionaries.
 * Existing collection logic remains authoritative.
 * ========================================================== */
@media(max-width:899px){
  html[data-mobile-shell="favorites"],
  html[data-mobile-shell="mistakes"]{
    --footer-h-actual:0px;
  }

  html[data-mobile-shell="favorites"] .header,
  html[data-mobile-shell="favorites"] .app-footer,
  html[data-mobile-shell="mistakes"] .header,
  html[data-mobile-shell="mistakes"] .app-footer{
    display:none!important;
  }

  html[data-mobile-shell="favorites"] #app.content,
  html[data-mobile-shell="mistakes"] #app.content{
    display:block!important;
    width:100%!important;
    max-width:none!important;
    min-height:var(--mobile-viewport-height)!important;
    padding:
      max(8px,var(--mobile-safe-top,0px))
      max(10px,var(--mobile-safe-right,0px))
      calc(18px + var(--mobile-safe-bottom,0px))
      max(10px,var(--mobile-safe-left,0px))!important;
    overflow:visible!important;
    box-sizing:border-box;
  }

  .mobile-collection-bar{
    width:100%;
    max-width:560px;
    margin:0 auto 10px;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto 44px;
    align-items:center;
    gap:8px;
    min-height:52px;
  }

  .mobile-collection-back{
    min-width:0;
    height:44px;
    display:inline-flex;
    align-items:center;
    gap:8px;
    justify-self:start;
    padding:0 12px 0 10px;
    border:1px solid rgba(69,88,165,.12);
    border-radius:14px;
    background:rgba(255,255,255,.78);
    color:inherit;
    box-shadow:0 5px 18px rgba(44,55,112,.06);
    font:inherit;
    font-size:12px;
    font-weight:750;
  }
  .mobile-collection-back__arrow{font-size:20px;line-height:1;transform:translateY(-1px)}
  .mobile-collection-title{
    min-width:0;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    text-align:center;font-size:13px;font-weight:800
  }
  .mobile-collection-menu{
    width:44px;height:44px;display:grid;place-items:center;
    border:1px solid rgba(69,88,165,.12);border-radius:14px;
    background:rgba(255,255,255,.78);color:inherit;
    box-shadow:0 5px 18px rgba(44,55,112,.06);
    font:inherit;font-size:18px;font-weight:800;letter-spacing:1px
  }

  html[data-mobile-shell="favorites"] .home--favorites,
  html[data-mobile-shell="mistakes"] .home--mistakes{
    width:100%!important;
    max-width:560px!important;
    min-width:0!important;
    margin:0 auto!important;
    padding:0!important;
  }

  html[data-mobile-shell="favorites"] .dicts-card.dicts-card--fixed,
  html[data-mobile-shell="mistakes"] .dicts-card.dicts-card--fixed{
    width:100%!important;
    margin:0!important;
    padding:10px!important;
    border-radius:17px!important;
    box-shadow:none!important;
  }

  html[data-mobile-shell="favorites"] .dicts-header,
  html[data-mobile-shell="mistakes"] .dicts-header{
    min-height:40px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    margin:0 0 8px!important;
    padding:0 0 8px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-header h3,
  html[data-mobile-shell="mistakes"] .dicts-header h3{
    display:none!important;
  }

  html[data-mobile-shell="favorites"] .dicts-flags,
  html[data-mobile-shell="mistakes"] .dicts-flags{
    margin-left:auto!important;
    gap:7px!important;
  }

  html[data-mobile-shell="favorites"] .dict-flag,
  html[data-mobile-shell="mistakes"] .dict-flag{
    width:42px!important;height:38px!important;border-radius:12px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-scroll,
  html[data-mobile-shell="mistakes"] .dicts-scroll{
    max-height:none!important;height:auto!important;overflow:visible!important;padding:0!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tbody,
  html[data-mobile-shell="mistakes"] .dicts-table tbody{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:7px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row,
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row{
    display:grid!important;
    grid-template-columns:36px minmax(0,1fr) auto 60px!important;
    align-items:center!important;
    column-gap:8px!important;
    min-height:58px!important;
    margin:0!important;
    padding:8px 10px 8px 12px!important;
    border-radius:14px!important;
    box-sizing:border-box!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row>td,
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row>td{
    min-width:0!important;
    padding:0!important;
    font-size:12px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row>td:first-child,
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row>td:first-child{
    width:36px!important;min-width:36px!important;
    display:flex!important;align-items:center!important;justify-content:flex-start!important;
    font-size:20px!important;line-height:1!important;overflow:visible!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row>td:nth-child(2),
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row>td:nth-child(2){
    overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
    font-weight:700!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row>td:nth-child(3),
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row>td:nth-child(3){
    min-width:42px!important;
    padding:6px 9px!important;
    border-radius:999px!important;
    background:rgba(255,255,255,.75)!important;
    font-size:10px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row>td:nth-child(4),
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row>td:nth-child(4){
    width:60px!important;min-width:60px!important;
    display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:9px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-preview,
  html[data-mobile-shell="favorites"] .dicts-delete,
  html[data-mobile-shell="mistakes"] .mistakes-preview,
  html[data-mobile-shell="mistakes"] .mistakes-delete{
    margin-left:0!important;
    font-size:14px!important;
    line-height:1!important;
  }

  html[data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected,
  html[data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected{
    border-color:#21b7f4!important;
    background:#eefaff!important;
  }

  html[data-mobile-shell="favorites"] .dicts-footer,
  html[data-mobile-shell="mistakes"] .dicts-footer{
    position:static!important;
    margin:10px 0 0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }

  html[data-mobile-shell="favorites"] .dicts-actions,
  html[data-mobile-shell="mistakes"] .dicts-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }

  html[data-mobile-shell="favorites"] .dicts-actions .btn-primary,
  html[data-mobile-shell="mistakes"] .dicts-actions .btn-primary{
    width:100%!important;
    min-height:48px!important;
    margin:0!important;
    border-radius:14px!important;
    font-size:12px!important;
    font-weight:800!important;
  }

  html[data-theme="dark"][data-mobile-shell="favorites"] .mobile-collection-back,
  html[data-theme="dark"][data-mobile-shell="favorites"] .mobile-collection-menu,
  html[data-theme="dark"][data-mobile-shell="mistakes"] .mobile-collection-back,
  html[data-theme="dark"][data-mobile-shell="mistakes"] .mobile-collection-menu{
    background:rgba(24,36,52,.92);
    border-color:rgba(142,166,215,.16);
    box-shadow:none;
  }

  /* Shared bottom sheet, same as other migrated screens. */
  html[data-mobile-shell="favorites"] .oc-overlay,
  html[data-mobile-shell="mistakes"] .oc-overlay{
    inset:0!important;background:rgba(12,20,38,.30);
    backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  }
  html[data-mobile-shell="favorites"] .oc-panel,
  html[data-mobile-shell="mistakes"] .oc-panel{
    left:8px!important;right:8px!important;top:auto!important;
    bottom:max(8px,var(--mobile-safe-bottom,0px))!important;
    width:auto!important;min-width:0!important;max-width:560px!important;
    max-height:min(82dvh,calc(var(--mobile-viewport-height) - 24px));
    margin:0 auto;border-radius:22px;overflow:hidden;
    transform:translateY(calc(100% + 28px))!important;transition:transform .22s ease!important;
  }
  html[data-mobile-shell="favorites"] body.menu-open .oc-panel,
  html[data-mobile-shell="mistakes"] body.menu-open .oc-panel{transform:translateY(0)!important}
  html[data-mobile-shell="favorites"] .oc-back,
  html[data-mobile-shell="mistakes"] .oc-back{display:none!important}
  html[data-mobile-shell="favorites"] .oc-body,
  html[data-mobile-shell="mistakes"] .oc-body{
    display:block!important;min-height:0;overflow-x:hidden!important;overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    padding:10px 12px calc(82px + var(--mobile-safe-bottom,0px))!important;
  }
}

@media(max-width:390px){
  html[data-mobile-shell="favorites"] .mobile-collection-title,
  html[data-mobile-shell="mistakes"] .mobile-collection-title{display:none}
  html[data-mobile-shell="favorites"] .mobile-collection-bar,
  html[data-mobile-shell="mistakes"] .mobile-collection-bar{
    grid-template-columns:minmax(0,1fr) 44px;
  }
}


/* ==========================================================
 * MOYAMOVA 1.12.22 — dark mobile Favorites / Mistakes selection
 * ========================================================== */
@media (max-width:899px){
  html[data-theme="dark"][data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected,
  html[data-theme="dark"][data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected,
  html.dark[data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected,
  html.dark[data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected{
    border-color:#21b7f4!important;
    background:#102334!important;
    color:#edf5ff!important;
  }

  html[data-theme="dark"][data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected>td,
  html[data-theme="dark"][data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected>td,
  html.dark[data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected>td,
  html.dark[data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected>td{
    color:#edf5ff!important;
  }

  html[data-theme="dark"][data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected>td:nth-child(3),
  html[data-theme="dark"][data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected>td:nth-child(3),
  html.dark[data-mobile-shell="favorites"] .dicts-table tr.dict-row.is-selected>td:nth-child(3),
  html.dark[data-mobile-shell="mistakes"] .dicts-table tr.dict-row.is-selected>td:nth-child(3){
    background:#16293a!important;
    color:#59b8ff!important;
  }
}
