/* ================================================================
   QLPS — trang mở đầu kiểu iOS / iPadOS (sao từ màn hình chính tuanviethoang.io.vn)
   ================================================================ */

/* ---------- Màu & hình nền ---------- */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --w-bg: rgba(255, 255, 255, .8);
  --w-fg: #111114;
  --w-sub: rgba(60, 60, 67, .62);
  --w-track: rgba(60, 60, 67, .14);
  --w-red: #ff3b30;
  --w-orange: #ff9500;

  --s-bg: rgba(242, 242, 247, .97);
  --s-card: #fff;
  --s-fg: #111114;
  --s-sub: #6e6e73;
  --s-line: rgba(60, 60, 67, .14);
  --s-fill: rgba(118, 118, 128, .12);
  --accent: #007aff;
  --soon-bg: rgba(255, 149, 0, .14);
  --soon-fg: #c25e00;
  --live-bg: rgba(52, 199, 89, .15);
  --live-fg: #1f7a35;

  --pill: rgba(255, 255, 255, .24);
  --pill-border: rgba(255, 255, 255, .22);
  --folder-bg: rgba(255, 255, 255, .3);
  --wall-dim: 1;

  --wall-aurora:
    radial-gradient(60% 50% at 15% 10%, #7c6cff 0%, transparent 70%),
    radial-gradient(55% 45% at 90% 25%, #ff7aa8 0%, transparent 70%),
    radial-gradient(70% 55% at 70% 95%, #22c1c3 0%, transparent 70%),
    radial-gradient(60% 50% at 5% 85%, #fdbb2d 0%, transparent 65%),
    linear-gradient(160deg, #3a3fbd, #1c2a6b);
  --wall-ocean:
    radial-gradient(70% 55% at 20% 12%, #4facfe 0%, transparent 70%),
    radial-gradient(60% 50% at 88% 42%, #00e0d4 0%, transparent 65%),
    radial-gradient(75% 60% at 35% 100%, #6a11cb 0%, transparent 70%),
    linear-gradient(170deg, #0f4c81, #061a40);
  --wall-sunset:
    radial-gradient(65% 50% at 18% 8%, #ffcc70 0%, transparent 70%),
    radial-gradient(60% 50% at 92% 32%, #ff5f8a 0%, transparent 70%),
    radial-gradient(75% 60% at 50% 100%, #8e2de2 0%, transparent 70%),
    linear-gradient(165deg, #ff8f7a, #6b2c91);
  --wall-forest:
    radial-gradient(65% 50% at 15% 12%, #c6f68d 0%, transparent 65%),
    radial-gradient(60% 50% at 90% 45%, #2bc0a4 0%, transparent 70%),
    radial-gradient(75% 60% at 30% 100%, #134e5e 0%, transparent 70%),
    linear-gradient(165deg, #3f8f5a, #0b3a3a);
  --wall-graphite:
    radial-gradient(60% 50% at 20% 10%, #6b7385 0%, transparent 70%),
    radial-gradient(60% 50% at 90% 70%, #3a4252 0%, transparent 70%),
    linear-gradient(165deg, #2b303b, #0e1015);
  --wall: var(--wall-aurora);
}
:root[data-wall="ocean"]    { --wall: var(--wall-ocean); }
:root[data-wall="sunset"]   { --wall: var(--wall-sunset); }
:root[data-wall="forest"]   { --wall: var(--wall-forest); }
:root[data-wall="graphite"] { --wall: var(--wall-graphite); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --w-bg: rgba(28, 28, 30, .72);
    --w-fg: #fff;
    --w-sub: rgba(235, 235, 245, .6);
    --w-track: rgba(235, 235, 245, .16);
    --w-red: #ff453a;
    --w-orange: #ff9f0a;
    --s-bg: rgba(28, 28, 30, .97);
    --s-card: #2c2c2e;
    --s-fg: #fff;
    --s-sub: #98989f;
    --s-line: rgba(84, 84, 88, .6);
    --s-fill: rgba(118, 118, 128, .24);
    --accent: #0a84ff;
    --soon-bg: rgba(255, 159, 10, .18);
    --soon-fg: #ffb340;
    --live-bg: rgba(48, 209, 88, .18);
    --live-fg: #4ade80;
    --pill: rgba(40, 40, 46, .38);
    --pill-border: rgba(255, 255, 255, .1);
    --folder-bg: rgba(60, 60, 67, .45);
    --wall-dim: .62;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --w-bg: rgba(28, 28, 30, .72);
  --w-fg: #fff;
  --w-sub: rgba(235, 235, 245, .6);
  --w-track: rgba(235, 235, 245, .16);
  --w-red: #ff453a;
  --w-orange: #ff9f0a;
  --s-bg: rgba(28, 28, 30, .97);
  --s-card: #2c2c2e;
  --s-fg: #fff;
  --s-sub: #98989f;
  --s-line: rgba(84, 84, 88, .6);
  --s-fill: rgba(118, 118, 128, .24);
  --accent: #0a84ff;
  --soon-bg: rgba(255, 159, 10, .18);
  --soon-fg: #ffb340;
  --live-bg: rgba(48, 209, 88, .18);
  --live-fg: #4ade80;
  --pill: rgba(40, 40, 46, .38);
  --pill-border: rgba(255, 255, 255, .1);
  --folder-bg: rgba(60, 60, 67, .45);
  --wall-dim: .62;
}

/* ---------- Khung ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; overscroll-behavior: none; }
html { height: 100%; }
/* Paint the wallpaper on the page canvas too, so the strip Safari shows below the viewport
   (behind its toolbar / home indicator) continues the wallpaper instead of a black band. */
html {
  background-color: var(--dock, #25407d);
}
body {
  font-family: var(--font);
  color: #fff;
  background: transparent;
  /* Scrollable by 1px on purpose: iOS Safari only collapses its bottom toolbar when the page scrolls.
     The sub-apps scroll, so without this the bar here would sit above the toolbar strip and look thicker
     than everywhere else. The visible UI is position:fixed, so the 1px never shows. */
  min-height: calc(100vh + 1px); min-height: calc(100lvh + 1px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }

/* The strip under the page on iPhone is Safari's own toolbar area, painted with <meta name="theme-color">.
   The page must stay above it (inset: 0), and the bottom bar uses the same solid colour (--dock, set by
   app.js per wallpaper and light/dark) so the bar and that strip read as one continuous surface. */
.device { position: fixed; inset: 0; }
.screen {
  position: absolute; inset: 0;
  overflow: hidden;
  container: screen / size;
  display: flex; flex-direction: column;
  isolation: isolate;
}
.wallpaper {
  position: absolute; inset: 0; z-index: -1;
  background: var(--wall);
  filter: brightness(var(--wall-dim));
  transition: filter .4s ease;
}

/* ---------- Kích thước theo màn hình (container query) ---------- */
.layer {
  --cols: 4; --icon: 60px; --label: 13px; --cell-h: 88px;
  --pad-x: 24px; --pad-y: 14px; --min-gap: 16px; --wr: 22px;
}
@container screen (min-width: 600px) {
  .layer { --cols: 6; --icon: 70px; --label: 13px; --cell-h: 98px; --pad-x: 52px; --pad-y: 22px; --min-gap: 22px; --wr: 26px; }
}
@container screen (min-width: 1000px) {
  .layer { --cols: 8; --icon: 72px; --pad-x: 76px; }
}
@container screen (min-width: 1400px) {
  .layer { --cols: 10; --icon: 76px; --cell-h: 104px; --pad-x: max(76px, calc((100cqw - 1240px) / 2)); }
}
@container screen (max-height: 620px) {
  .layer { --icon: 52px; --cell-h: 74px; --min-gap: 10px; }
}

/* ---------- Thanh trạng thái ----------
   Ẩn ở mọi thiết bị: điện thoại, máy tính bảng, máy tính đều đã có giờ/pin của riêng mình. */
.status {
  display: none; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 13px) 28px 0;
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.sb-date { display: none; margin-left: 8px; }
.sb-right { display: flex; gap: 6px; align-items: center; }
.sb-right svg { height: 11.5px; fill: currentColor; }
@container screen (min-width: 600px) {
  .status { font-size: 14px; padding-inline: 26px; }
  .sb-date { display: inline; }
}

/* ---------- Màn hình chính ---------- */
.home {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding-top: calc(env(safe-area-inset-top) + 8px);
  padding-bottom: 0;
}
.pager {
  flex: 1; min-height: 0;
  display: flex;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--icon));
  grid-template-rows: repeat(var(--rows, 5), var(--cell-h));
  justify-content: space-between;
  align-content: space-between;
  padding: var(--pad-y) var(--pad-x);
}

/* Biểu tượng ứng dụng */
.app {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: var(--icon);
  padding: 0; border: 0; background: none;
  color: #fff; text-decoration: none; cursor: pointer;
  -webkit-touch-callout: none; user-select: none;
}
.icon {
  width: var(--icon); height: var(--icon); flex: none;
  border-radius: 23%;
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(165deg, var(--c1), var(--c2));
  color: var(--fg, #fff);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  transition: transform .12s cubic-bezier(.3, .7, .4, 1.3), filter .12s ease;
}
.icon::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 50%);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .18);
}
.icon.light::before { background: none; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .08); }
.icon svg {
  width: 54%; height: 54%;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.label {
  max-width: calc(var(--icon) + 22px);
  font-size: var(--label); font-weight: 500; line-height: 1.2; letter-spacing: -.005em;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
@media (hover: hover) { .app:hover .icon { filter: brightness(1.07); } }
.app:active .icon { transform: scale(.88); filter: brightness(.82); }
.app:focus-visible { outline: none; }
.app:focus-visible .icon { outline: 3px solid #fff; outline-offset: 3px; }

/* Biểu tượng Lịch: thứ + ngày như iOS */
.cal { display: flex; flex-direction: column; align-items: center; line-height: 1; color: #111; }
.cal b { font-size: calc(var(--icon) * .15); font-weight: 600; color: #ff3b30; text-transform: capitalize; }
.cal span { font-size: calc(var(--icon) * .48); font-weight: 300; margin-top: 1px; letter-spacing: -.03em; }

/* Thư mục */
.icon.folder-icon {
  background: var(--folder-bg);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 8%; padding: 15%; place-items: stretch;
}
.folder-icon::before { display: none; }
.folder-icon i { border-radius: 28%; background: linear-gradient(165deg, var(--c1), var(--c2)); }

/* ---------- Widget ---------- */
/* Như iOS: widget kéo từ đỉnh biểu tượng hàng trên tới đáy biểu tượng hàng dưới (không tính nhãn). */
.widget {
  width: 100%; height: calc(100% - var(--cell-h) + var(--icon)); align-self: start;
  position: relative; overflow: hidden;
  border-radius: var(--wr);
  background: var(--w-bg);
  color: var(--w-fg);
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .16);
  container-type: size;
}
.wi { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 10cqmin 9cqmin; }

.w-clock .wi { padding: 6cqmin; align-items: center; justify-content: center; }
.w-clock svg { width: 100%; height: 100%; }
.w-clock .tk { stroke: var(--w-sub); stroke-width: .7; stroke-linecap: round; }
.w-clock .num { fill: var(--w-fg); font: 600 9.5px var(--font); text-anchor: middle; dominant-baseline: central; }
.w-clock .hh, .w-clock .hm { stroke: var(--w-fg); stroke-linecap: round; }
.w-clock .hh { stroke-width: 3.4; }
.w-clock .hm { stroke-width: 2.4; }
.w-clock .hs { stroke: var(--w-orange); stroke-width: 1; stroke-linecap: round; }
.w-clock .hub { fill: var(--w-fg); }
.w-clock .hub-s { fill: var(--w-orange); }
/* Đồng hồ và lịch theo đúng hình mẫu của người dùng (18/10/2026: "chỉnh như hình", bản gốc thvn-vp.io.vn): có dòng GMT+7, chữ lịch
   nhỏ và thoáng. Đây là hai widget trang trí chỉ để xem; chữ trong chúng KHÔNG áp quy ước 13px (đã báo người dùng), bài đo bỏ qua .widget. */
.w-clock .tz { fill: var(--w-fg); font: 700 5.6px var(--font); letter-spacing: .08em; text-anchor: middle; dominant-baseline: central; }
.w-clock .tz2 { fill: var(--w-sub); font: 600 4.6px var(--font); letter-spacing: .04em; text-anchor: middle; dominant-baseline: central; }

.w-calendar .m { font-size: 8.5cqmin; font-weight: 700; color: var(--w-red); text-transform: uppercase; letter-spacing: .02em; }
.w-calendar .g {
  flex: 1; display: grid; grid-template-columns: repeat(7, 1fr);
  align-content: space-between; margin-top: 3cqmin;
}
.w-calendar .g span {
  height: 10.5cqmin; display: grid; place-items: center;
  font-size: 6.6cqmin; font-weight: 600; font-variant-numeric: tabular-nums;
}
.w-calendar .g .wd { color: var(--w-sub); font-size: 5.6cqmin; }
.w-calendar .g .today { width: 10.5cqmin; justify-self: center; border-radius: 50%; background: var(--w-red); color: #fff; }

.w-greeting .k { font-size: 6.6cqmin; font-weight: 700; color: var(--w-sub); text-transform: uppercase; letter-spacing: .06em; }
.w-greeting .t { margin-top: 3cqmin; font-size: 14cqmin; font-weight: 700; line-height: 1.04; letter-spacing: -.025em; }
.w-greeting .foot { margin-top: auto; }
.w-greeting .n { font-size: 7cqmin; font-weight: 600; }
.w-greeting .n b { color: var(--w-sub); font-weight: 600; }
.w-greeting .bar { height: 3.2cqmin; margin-top: 3.5cqmin; border-radius: 9cqmin; background: var(--w-track); overflow: hidden; }
.w-greeting .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #30d158, #34c759); }

/* ---------- Dải chấm trang + Tìm kiếm + Dock ---------- */
.pills { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 4px 0 12px; }
.dots {
  display: flex; gap: 8px; padding: 9px 11px; border-radius: 99px;
  background: var(--pill);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.dots button {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .42); cursor: pointer;
  transition: background .2s ease;
}
.dots button[aria-current="true"] { background: #fff; }
.dots button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Thanh điều hướng dưới: nút Home tròn nổi ở giữa, nằm trong khoảng lõm của thanh (giống các ứng dụng con). */
.subbar {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 1fr 1fr 92px 1fr 1fr; align-items: end;
  /* Labels sit just above the home indicator instead of a full safe-area gap below them. */
  padding: 0 6px max(6px, calc(env(safe-area-inset-bottom) - 14px));
}
.sb-bg {
  /* nền kéo xuống 160px dưới thanh (NGUYEN-TAC §2): viewport-fit=cover mà iPhone cấp thiếu chiều cao thì dải đáy vẫn liền màu thanh */
  position: absolute; inset: 0 0 -160px; z-index: -1;
  border-radius: 26px 26px 0 0;
  background: var(--dock, #25407d);
  -webkit-mask: radial-gradient(circle at 50% 2px, transparent 41px, #000 42px);
  mask: radial-gradient(circle at 50% 2px, transparent 41px, #000 42px);
}
.sb-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 0; border: 0; background: none; color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-size: 13px; font-weight: 600; line-height: 1.2; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.sb-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.sb-item:active { opacity: .6; }
.sb-home {
  justify-self: center; align-self: start;
  width: 66px; height: 66px; margin-top: -31px; padding: 0; border: 0; cursor: pointer;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(160deg, #e58a3c, #c2581d); color: #fff;
  box-shadow: 0 0 0 3.5px #0a84ff, 0 8px 22px rgba(194, 88, 29, .45);
  transition: transform .15s ease;
}
.sb-home svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sb-home:active { transform: scale(.92); }
.sb-item:focus-visible, .sb-home:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 12px; }
/* Desktop only: on phones and tablets the bar must span the full width to join Safari's toolbar strip. */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .subbar { width: min(560px, 100%); align-self: center; }
}

/* Phản hồi chạm tức thì */
.app, .sb-item, .sb-home, .search-pill, .dots button, .sp-row, .wall-opt, .seg button { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.sb-item:active { opacity: .5; }

/* Hiệu ứng mở trang */
@keyframes pop { from { opacity: 0; transform: scale(.7); } }
.home.intro .app, .home.intro .widget {
  animation: pop .5s cubic-bezier(.2, .9, .3, 1.15) both;
  animation-delay: calc(var(--i, 0) * 28ms + 60ms);
}

/* ---------- Lớp phủ: thư mục, tìm kiếm, trang chi tiết ---------- */
.overlay { position: absolute; inset: 0; z-index: 20; opacity: 0; transition: opacity .28s ease; }
.overlay.open { opacity: 1; }

.folder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .16);
  backdrop-filter: blur(28px) saturate(1.3); -webkit-backdrop-filter: blur(28px) saturate(1.3);
}
.folder-title { margin: 0 0 22px; font-size: 30px; font-weight: 600; letter-spacing: -.02em; text-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.folder-box {
  display: grid; grid-template-columns: repeat(3, var(--icon)); gap: 22px 28px;
  padding: 28px 30px; border-radius: 38px;
  background: var(--folder-bg);
  transform: scale(.82);
  transition: transform .38s cubic-bezier(.2, .9, .3, 1.15);
}
.folder.open .folder-box { transform: none; }

.spotlight {
  display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top) + 54px) 16px 16px;
  background: rgba(0, 0, 0, .28);
  backdrop-filter: blur(34px) saturate(1.3); -webkit-backdrop-filter: blur(34px) saturate(1.3);
}
.sp-bar, .sp-panel { width: 100%; max-width: 620px; }
.sp-bar { display: flex; align-items: center; gap: 12px; transform: translateY(-14px); transition: transform .3s cubic-bezier(.2, .9, .3, 1); }
.spotlight.open .sp-bar { transform: none; }
.sp-field {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 13px;
  background: rgba(255, 255, 255, .2);
}
.sp-field svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; opacity: .85; }
.sp-field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  color: #fff; font: 500 17px var(--font);
}
.sp-field input::placeholder { color: rgba(255, 255, 255, .7); }
.sp-field input::-webkit-search-cancel-button { display: none; }
.sp-cancel { border: 0; background: none; font-size: 16px; font-weight: 500; cursor: pointer; padding: 6px 2px; }
.sp-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 18px; }
.sp-head { margin: 0 6px 8px; font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; opacity: .75; }
.sp-results {
  overflow-y: auto; border-radius: 16px;
  background: var(--w-bg); color: var(--w-fg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
}
.sp-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border: 0; background: none; text-align: left; cursor: pointer;
  color: inherit; position: relative;
}
.sp-row + .sp-row::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; border-top: 1px solid var(--w-track); }
.sp-row[aria-selected="true"] { background: rgba(0, 122, 255, .14); }
.sp-row .icon { --icon: 38px; box-shadow: none; }
.sp-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-txt b { font-size: 15.5px; font-weight: 600; }
.sp-txt small { font-size: 13px; color: var(--w-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-tag { font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--soon-bg); color: var(--soon-fg); flex: none; }
.sp-empty { margin: 0; padding: 22px; text-align: center; color: var(--w-sub); }

/* Trang chi tiết (sheet) */
.sheet-wrap {
  opacity: 1; z-index: 30;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background .3s ease;
}
.sheet-wrap.open { background: rgba(0, 0, 0, .38); }
.sheet {
  width: 100%; max-width: 540px; max-height: 90%;
  overflow-y: auto; overscroll-behavior: contain;
  border-radius: 24px 24px 0 0;
  background: var(--s-bg); color: var(--s-fg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  padding: 0 20px calc(env(safe-area-inset-bottom) + 26px);
  transform: translateY(100%);
  transition: transform .42s cubic-bezier(.2, .9, .25, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
}
.sheet-wrap.open .sheet { transform: none; }
@container screen (min-width: 600px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 24px; max-height: 84%; padding-bottom: 26px; opacity: 0; transform: translateY(24px) scale(.96); transition: transform .38s cubic-bezier(.2, .9, .25, 1), opacity .25s ease; }
  .sheet-wrap.open .sheet { opacity: 1; transform: none; }
  .grabber { visibility: hidden; }
}
.sheet-top {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 7px; height: 44px;
  background: linear-gradient(var(--s-bg) 70%, transparent);
}
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--s-line); }
.sheet-close {
  position: absolute; right: -6px; top: 12px;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--s-fill); color: var(--s-sub); cursor: pointer;
}
.sheet-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.sheet-close:focus-visible, .btn:focus-visible, .wall-opt:focus-visible, .seg button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.sh-hero { display: flex; align-items: center; gap: 16px; margin: 0 0 22px; }
.sh-hero .icon { --icon: 86px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.sh-hero h2 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.sh-sub { margin: 2px 0 0; font-size: 14.5px; color: var(--s-sub); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
  background: var(--soon-bg); color: var(--soon-fg);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.live { background: var(--live-bg); color: var(--live-fg); }

.group-title { margin: 22px 4px 8px; font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--s-sub); }
.card { background: var(--s-card); border-radius: 14px; padding: 14px 16px; }
.card + .card { margin-top: 12px; }
.card p { margin: 0; font-size: 16px; line-height: 1.5; }
.card p + p { margin-top: 10px; }
.rows { padding-block: 2px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; font-size: 16px; }
.row + .row { border-top: 1px solid var(--s-line); }
.row .v { color: var(--s-sub); text-align: right; }
.note { margin: 10px 6px 0; font-size: 13px; color: var(--s-sub); }

.walls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.wall-opt {
  aspect-ratio: 9 / 15; position: relative;
  border: 0; border-radius: 12px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.wall-opt[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.wall-opt span {
  position: absolute; left: 0; right: 0; bottom: 6px;
  font-size: 13px; font-weight: 600; color: #fff; text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; border-radius: 10px; background: var(--s-fill); }
.seg button {
  padding: 8px 4px; border: 0; border-radius: 8px; background: none;
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--s-fg);
}
.seg button[aria-pressed="true"] { background: var(--s-card); box-shadow: 0 2px 8px rgba(0, 0, 0, .14); }

.logo { width: 86px; height: 86px; flex: none; border-radius: 23%; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }

/* Vùng chạm từ 44px cho nút chọn loại máy / giao diện; nút thường (.btn) trong trang Giới thiệu */
.seg button { min-height: 44px; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px;
  border: 0; border-radius: 12px; background: var(--s-fill); color: var(--accent);
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn.primary { display: flex; width: 100%; margin-top: 12px; background: var(--accent); color: #fff; }
.btn[hidden] { display: none; }
.done-line { margin: 0 4px 10px; font-size: 15px; font-weight: 600; color: var(--live-fg); }

/* Các bước đưa ứng dụng ra màn hình chính: hình điện thoại (chỉ hình khối) bên trái, mô tả bên phải */
.guide { padding-block: 4px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.steps li + li { border-top: 1px solid var(--s-line); }
.steps b { font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--s-sub); }
.steps p { margin: 2px 0 0; font-size: 16px; line-height: 1.4; }
.phone { width: 64px; height: 112px; flex: none; }
.phone .body { fill: var(--s-card); stroke: var(--s-sub); stroke-width: 1.5; }
.phone .ui { fill: rgba(118, 118, 128, .3); }
.phone .hl { fill: rgba(0, 122, 255, .22); stroke: var(--accent); stroke-width: 1.6; }
.phone circle.hl { fill: var(--accent); stroke: none; }
@media (prefers-reduced-motion: no-preference) {
  .phone .hl { animation: ph-nhay 1.6s ease-in-out infinite; }
  @keyframes ph-nhay { 50% { fill-opacity: .4; } }
}

/* Mã QR truy cập: nền trắng cố định (máy quét cần mã đen trên nền sáng, cả khi giao diện tối) */
.qr-card { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.qr { width: 136px; height: 136px; flex: none; border-radius: 10px; box-shadow: 0 0 0 1px var(--s-line); }
.qr-side { flex: 1 1 160px; min-width: 0; }
.qr-url { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.qr-side p { margin: 4px 0 0; font-size: 14px; line-height: 1.4; color: var(--s-sub); }
.qr-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Chuyển trang mượt giữa Màn hình chính và các ứng dụng (Chrome/Edge 126+, Safari 18.2+): trang cũ mờ dần
   sang trang mới thay vì nháy trắng. Trang nào cũng phải bật thì mới có hiệu ứng. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
}
/* The bottom bar is the same element on Home and in every app: during the page change it stays where it is and
   only its colours cross-fade, while the content fades underneath. */
.subbar { view-transition-name: subbar; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .18s; }
}
/* Never let iOS zoom the page in when a field gets the focus: every form control is at least 16px on touch screens. */
@media (hover: none) and (pointer: coarse), (max-width: 999px) {
  input, select, textarea { font-size: max(16px, 1em) !important; }
}

/* ---------- nút quay lại (‹) của mọi lớp: thư mục, tìm kiếm, trang chi tiết ---------- */
.ly-back { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  color: inherit; background: rgba(255, 255, 255, .18); -webkit-tap-highlight-color: transparent; }
.ly-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ly-back:active { transform: scale(.92); }
.folder > .ly-back { position: absolute; left: 16px; top: calc(env(safe-area-inset-top) + 14px); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.sheet-top .sheet-back { position: absolute; left: -6px; top: 8px; width: 34px; height: 34px; background: var(--s-fill); color: var(--accent); }
.sheet-top .sheet-back svg { width: 19px; height: 19px; }
.sheet-close { top: 8px; width: 34px; height: 34px; }
.sheet-close[hidden] { display: none; }

/* ---------- MỘT KÍCH THƯỚC THANH DƯỚI: Màn hình chính và mọi ứng dụng (apps' app.css hold the same numbers) ----------
   51 px + --sab, items from the top, the centre button 31 px above the bar; the columns never widen with a label. */
:root { --sab: max(6px, calc(env(safe-area-inset-bottom) - 14px)); --bar-h: calc(51px + var(--sab)); }
.subbar { box-sizing: border-box; height: var(--bar-h); min-height: var(--bar-h); max-height: var(--bar-h); align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 92px repeat(2, minmax(0, 1fr)); }
.sb-item { box-sizing: border-box; height: 100%; min-width: 0; overflow: hidden; justify-content: flex-start; }


/* Logo MyTV thay biểu tượng QLPS trên trang mở đầu (người dùng 20/10/2026): nền trắng, logo giữa ô */
.icon.icon-img { background: #fff; }
.icon.icon-img::before { background: none; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .08); }
.icon.icon-img img { width: 78%; height: auto; display: block; pointer-events: none; }

/* QLPS mở trong khung lồng phủ kín màn hình (toan_man.js, trang_chu.js moTrongKhung): toàn màn hình không tắt vì không chuyển trang */
.khung-app { position: fixed; inset: 0; z-index: 2147483000; width: 100%; height: 100%; border: 0; background: #0e1116; }
.khung-app[hidden] { display: none; }
