/* ---------- Akhbar AI Android: "Pocket" phone design ---------- */
.mbar, .mnav, .msheet, .pk-hero, #pkCard { display: none; }
@media (max-width: 1024px) {
  html, body { overflow-x: hidden; }
  body { background: #f2f6f3; }
  .app { display: block; }
  .sidebar { display: none !important; }
  main { padding: 0 16px 104px !important; max-width: 100vw; }
  svg { flex: none; }

  /* header */
  .mbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30; margin: 0 -16px 10px; padding: calc(12px + env(safe-area-inset-top)) 18px 10px; background: rgba(242,246,243,.94); backdrop-filter: blur(8px); }
  .mbar small { display: block; font-size: 12.5px; color: var(--muted); }
  .mbar b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -.01em; color: var(--ink); }
  .mbar .logo { width: 38px; height: 38px; border-radius: 11px; background: var(--pk); color: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--pk); }
  body[data-mview="today"] .mbar { position: absolute; right: 0; left: auto; margin: 0; background: transparent; backdrop-filter: none; }
  body[data-mview="today"] .mbar > div { display: none; }
  .topbar { display: none !important; }

  /* tab bar */
  .mnav { display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 6px; box-shadow: 0 8px 28px rgba(1,65,28,.14); }
  .mnav button { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 7px 0 6px; border-radius: 16px; position: relative; transition: background .25s var(--ease), color .25s; }
  .mnav button .i svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
  .mnav button.on { color: var(--pk); font-weight: 700; background: var(--pk-soft); }
  .mnav button.on .i svg { transform: translateY(-1px) scale(1.08); }
  .mnav .dot[hidden] { display: none !important; }
  .mnav .dot { position: absolute; top: 2px; right: 18%; min-width: 17px; height: 17px; border-radius: 9px; background: #c0352b; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }

  /* More sheet */
  .msheet { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .msheet.open { opacity: 1; pointer-events: auto; }
  .msheet > div { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 24px 24px 0 0; padding: 10px 16px calc(22px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .32s var(--ease); }
  .msheet.open > div { transform: none; }
  .msheet .grab { width: 42px; height: 5px; border-radius: 3px; background: #d5dbd7; margin: 2px auto 14px; }
  .msheet .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .msheet .grid button { border: 1px solid var(--line); background: #f6f9f7; border-radius: 16px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink); }
  .msheet .grid button svg { width: 24px; height: 24px; fill: none; stroke: var(--pk-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .msheet .grid button.on { border-color: var(--pk-2); background: var(--pk-soft); color: var(--pk); font-weight: 700; }

  /* ---------- Today ---------- */
  .cd-head { display: block; margin: 0 0 12px; padding-top: calc(14px + env(safe-area-inset-top)); padding-right: 52px; }
  .cd-date { margin: 0; font-size: 12.5px; color: var(--muted); font-weight: 500; }
  .cd-hi { font-size: 22px; line-height: 1.25; }
  .cd-sub { font-size: 13px; }
  .cd-refresh { margin-top: 10px; }
  .cd-exams { display: none; }
  .pk-hero { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--pk), var(--pk-2)); color: #fff; border-radius: 22px; padding: 18px 18px 18px 20px; margin-bottom: 12px; box-shadow: 0 10px 24px rgba(1,65,28,.22); animation: pkRise .5s var(--ease) both; }
  .pk-hero .k { font-size: 12.5px; color: #bfe0ca; }
  .pk-hero .t { display: block; font-size: 19px; line-height: 1.25; margin: 4px 0 10px; max-width: 190px; }
  .pk-hero .chip { display: inline-block; font-size: 12px; background: rgba(255,255,255,.16); border-radius: 999px; padding: 4px 10px; }
  .pk-hero .s1, .pk-hero .s2 { position: absolute; font-style: normal; color: rgba(255,255,255,.35); font-size: 10px; animation: pkTw 2.4s ease-in-out infinite; }
  .pk-hero .s1 { left: 46%; top: 12px; } .pk-hero .s2 { left: 54%; bottom: 14px; animation-delay: 1.2s; }
  @keyframes pkTw { 50% { opacity: .2; transform: scale(.7); } }
  .pk-ring { position: relative; width: 92px; height: 92px; flex: none; }
  .pk-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
  .pk-ring circle { fill: none; stroke-width: 7; } .pk-ring .bg { stroke: rgba(255,255,255,.2); } .pk-ring .fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
  .pk-ring > span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
  .pk-ring b { font-size: 26px; line-height: 1; } .pk-ring small { font-size: 11px; color: #cfe8d7; }

  .cd-kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .cd-kpi { flex-direction: row-reverse; justify-content: flex-end; gap: 10px; padding: 12px; border-radius: 18px; }
  .cd-kpi .k { order: 2; font-size: 11.5px; } .cd-kpi .v { font-size: 21px; margin: 0; line-height: 1.1; }
  .cd-kpi .s, .cd-spark, .cd-streak { display: none; }
  .cd-kpi > div:first-child { display: flex; flex-direction: column; }
  .cd-kpi .cd-ico, .cd-kpi .cd-ring { width: 38px !important; height: 38px !important; border-radius: 12px; }
  .cd-kpi:nth-child(2)::before, .cd-kpi:nth-child(4)::before { content: ""; width: 38px; height: 38px; border-radius: 12px; flex: none; background: center / 20px no-repeat; }
  .cd-kpi:nth-child(2)::before { background-color: #fdf1dc; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b26b00' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6z'/%3E%3Cpath d='M9 12h7M9 16h7M9 8h3'/%3E%3C/svg%3E"); }
  .cd-kpi:nth-child(4)::before { background-color: #fdeceb; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c0352b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3c1 4 5 5 5 10a5 5 0 0 1-10 0c0-2 1-3 2-4 0 2 1 3 2 3 0-3-1-6 1-9z'/%3E%3C/svg%3E"); }

  .cd-grid { display: block; margin: 0; } .cd-col { display: block; }
  .cd-card { border-radius: 20px; padding: 14px 14px; margin-bottom: 12px; }
  .cd-card-h h2 { font-size: 16px; }
  /* must-read: swipe cards */
  #todayEditorials { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 4px 14px 6px; scrollbar-width: none; }
  #todayEditorials::-webkit-scrollbar { display: none; }
  #todayEditorials .cd-row { flex: 0 0 72%; scroll-snap-align: start; flex-direction: column; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; background: #fbfdfb; }
  #todayEditorials .cd-row:first-child { border-top: 1px solid var(--line); }
  #todayEditorials .t-title { font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #todayEditorials .t-meta .tag { display: none; }
  #todayEditorials .cd-an { width: 100%; justify-content: center; background: var(--pk); color: #fff; border-color: var(--pk); }
  .cd-hl { gap: 10px; } .cd-time { min-width: 34px; font-size: 12px; }
  #weeklyCard { margin-bottom: 12px; } #weeklyCard .wk-card { flex-wrap: wrap; border-radius: 20px; }
  #weeklyCard .wk-card button { width: 100%; }
  .cd-theme { grid-template-columns: 112px minmax(0, 1fr) 36px; gap: 10px; font-size: 13px; }
  .cd-tip { flex-wrap: wrap; } .cd-tip button { width: 100%; }
  .cd-rev .cd-ring { width: 64px !important; height: 64px !important; }

  /* ---------- Read (editorials) ---------- */
  .fd-bar { flex-wrap: wrap; gap: 8px; }
  .fd-bar #search { min-width: 0; width: 100%; flex-basis: 100%; border-radius: 14px; padding: 11px 14px; }
  .fd-chips { flex: 1; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; } .fd-chips button { padding: 7px 12px; white-space: nowrap; }
  .fd-today, .fd-more { padding: 7px 11px; border-radius: 999px; }
  .fd-hero { padding: 16px; gap: 12px; border-radius: 20px; flex-direction: column; align-items: flex-start; }
  .fd-hero h2 { font-size: 18px; } .fd-hero .ring { width: 70px !important; height: 70px !important; }
  .fd-hero .fd-acts, .fd-hero .row { width: 100%; } .fd-hero button { flex: 1; }
  .fd-row { gap: 10px; padding: 11px 12px; border-radius: 18px; flex-wrap: wrap; }
  .fd-row .ring { width: 44px !important; height: 44px !important; }
  .fd-row .fd-act { width: 100%; justify-content: flex-end; }
  .fd-row h3, .fd-row .fd-title { font-size: 14.5px; }

  /* ---------- analysis as a bottom sheet ---------- */
  .drawer { align-items: flex-end; justify-content: stretch; }
  .drawer-inner { width: 100% !important; max-width: 100% !important; height: 90vh; border-radius: 24px 24px 0 0; padding: 18px 18px calc(110px + env(safe-area-inset-bottom)); animation: pkSheet .35s var(--ease); }
  .drawer-inner::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: #d5dbd7; margin: -6px auto 10px; }
  .drawer-tools { margin: -10px -18px 10px; top: -18px; border-radius: 24px 24px 0 0; flex-wrap: wrap; }
  .drawer h2 { font-size: 19px; }
  .drawer h4 { display: inline-flex; align-items: center; gap: 6px; }
  .drawer section, .drawer .an-sec { border-radius: 16px; }
  @keyframes pkSheet { from { transform: translateY(100%); } to { transform: none; } }

  /* ---------- Words ---------- */
  .vc-bar { flex-wrap: wrap; gap: 8px; } .vc-bar #vocabSearch { flex-basis: 100%; border-radius: 14px; padding: 11px 14px; }
  .vc-bar #vocabPrint { margin-left: auto; padding: 7px 11px; }
  #pkCard { display: block; margin: 4px 0 14px; }
  .pk-flash { position: relative; height: 190px; perspective: 900px; cursor: pointer; }
  .pk-flash .f { position: absolute; inset: 0; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 6px; backface-visibility: hidden; transition: transform .6s var(--ease); }
  .pk-flash .front { background: linear-gradient(135deg, var(--pk), var(--pk-2)); color: #fff; box-shadow: 0 10px 24px rgba(1,65,28,.22); }
  .pk-flash .front small { color: #bfe0ca; font-size: 12px; } .pk-flash .front b { font-size: 30px; letter-spacing: -.01em; } .pk-flash .front span { font-size: 13px; color: #d4ecdc; }
  .pk-flash .moon { position: absolute; right: 14px; top: 12px; color: rgba(255,255,255,.35); }
  .pk-flash .back { background: #fff; border: 1px solid var(--pk-line); transform: rotateY(180deg); }
  .pk-flash .back small { color: var(--pk-2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
  .pk-flash .back p { margin: 0; font-size: 16px; line-height: 1.45; } .pk-flash .back span { font-size: 13px; color: var(--muted); } .pk-flash .back i { font-size: 12.5px; color: var(--muted); }
  .pk-flash.flip .front { transform: rotateY(-180deg); } .pk-flash.flip .back { transform: rotateY(0); }
  .pk-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
  .pk-grade button { border: 0; border-radius: 14px; padding: 11px 0; font-weight: 700; }
  .pk-grade [data-pkg="again"] { background: #fdeceb; color: #c0352b; } .pk-grade [data-pkg="good"] { background: #fdf1dc; color: #8a5300; } .pk-grade [data-pkg="easy"] { background: var(--pk); color: #fff; }
  .pk-done { background: var(--pk-soft); color: var(--pk); border-radius: 16px; padding: 14px; font-weight: 600; font-size: 13.5px; }
  .vc-add { flex-direction: column; gap: 8px; } .vc-add input, .vc-add button { width: 100%; flex: none !important; height: auto; }
  .vc-bar #vocabSort { flex: 1 1 100%; } #vocabMeta { display: none; }
  #statsRow { display: none !important; }
  .vc-card { border-radius: 18px; }

  /* other screens */
  .stats:not(.hidden) { display: flex !important; overflow-x: auto; gap: 10px; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .stats > * { min-width: 46%; scroll-snap-align: start; }
  .cov-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .cov-tile { padding: 12px; } .cov-name { font-size: 13px; min-height: 34px; } .cov-pct { font-size: 20px; } .cov-mini { display: none; } .cov-tile.sel::after { display: none; }
  .cov-hero { gap: 14px; } .cov-ring, .cov-ring svg { width: 86px; height: 86px; }
  .toolbar { flex-wrap: wrap; } .toolbar select { flex: 1 1 45%; min-width: 0; }
  .panel { padding: 14px; border-radius: 18px; }
  .hl-row { grid-template-columns: 12px minmax(0, 1fr); row-gap: 8px; }
  .hl-row .hl-act { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
  .cov-foot { flex-wrap: wrap; gap: 4px; }
  .fd-status { margin-bottom: 10px; }
}

/* ---------- iPad portrait: Pocket, but roomier ---------- */
@media (min-width: 640px) and (max-width: 1024px) {
  main { padding: 0 28px 110px !important; }
  .mbar { margin: 0 -28px 12px; padding-left: 30px; padding-right: 30px; }
  .mbar b { font-size: 28px; }
  .cd-head { padding-right: 60px; } .cd-hi { font-size: 28px; }
  .pk-hero { padding: 24px 28px; } .pk-hero .t { font-size: 24px; max-width: 360px; } .pk-ring { width: 110px; height: 110px; } .pk-ring b { font-size: 32px; }
  .cd-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .cd-kpis + .cd-grid { grid-template-columns: minmax(0, 1fr); }
  #todayEditorials .cd-row { flex: 0 0 42%; }
  .cd-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .cd-col .cd-card, #weeklyCard { margin-bottom: 0; }
  .mnav { left: 50%; right: auto; width: 520px; transform: translateX(-50%); }
  .pk-flash { height: 230px; } .pk-flash .front b { font-size: 38px; }
  #pkCard { max-width: 640px; margin-left: auto; margin-right: auto; }
  .fd-hero { flex-direction: row; align-items: center; } .fd-hero .ring { width: 96px !important; height: 96px !important; }
  .drawer-inner { max-width: 760px !important; margin: 0 auto; height: 88vh; }
  .drawer { justify-content: center; }
  .cov-grid { grid-template-columns: repeat(3, 1fr); }
}
