@font-face { font-family: "BVP"; src: url("vendor/fonts/BeVietnamPro-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "BVP"; src: url("vendor/fonts/BeVietnamPro-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
	/* Bản 3.x: nền không gian tối, kính mờ, màu nhấn theo công cụ (biến --ac, --ac2, --ac-on, --ac-rgb đặt ở cuối app.css theo data-mode). */
	--bg0: #05080f; --pnl: #0d1524; --pnl-h: #121c30;
	--glass: rgba(10, 16, 28, .74); --glass-2: rgba(16, 24, 40, .88);
	--line: rgba(150, 180, 230, .14); --line-2: rgba(150, 180, 230, .26);
	--tx: #eaf1fb; --mu: #9aa9c0; --mu2: #6b7b93;
	--ac: #4da3ff; --ac2: #8b7bff; --ac-on: #061426; --ac-rgb: 77, 163, 255;
	--ac-ink: color-mix(in srgb, var(--ac) 62%, #fff); --ac-soft: rgba(var(--ac-rgb), .13); --ac-line: rgba(var(--ac-rgb), .5);
	--bad: #ef6a70; --ok: #4fd1a0; --warn: #ffb84d;
	--r: 12px; --r-sm: 9px; --mbar: 58px;
	--ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--tx); font: 14px/1.45 "BVP", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(var(--ac-rgb), .35); }
#app { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; isolation: isolate;
	background:
		radial-gradient(1000px 520px at 50% -10%, rgba(var(--ac-rgb), .17), transparent 70%),
		radial-gradient(760px 460px at 100% 105%, rgba(var(--ac-rgb), .08), transparent 70%),
		radial-gradient(1.1px 1.1px at 14% 26%, rgba(255, 255, 255, .6), transparent) 0 0 / 290px 230px,
		radial-gradient(1px 1px at 63% 71%, rgba(255, 255, 255, .45), transparent) 0 0 / 370px 310px,
		radial-gradient(1.4px 1.4px at 86% 18%, rgba(255, 255, 255, .5), transparent) 0 0 / 510px 420px,
		var(--bg0); }

/* ---- thanh trên (kính mờ) ---- */
.menubar { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); min-height: var(--mbar); background: var(--glass); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); z-index: 7; flex: none; }
.menubar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--ac-rgb), .55) 30%, rgba(var(--ac-rgb), .55) 70%, transparent); opacity: .55; }
.mb-l, .mb-r, .mb-c { display: flex; align-items: center; min-width: 0; }
.mb-l { gap: 2px; }
.mb-r { gap: 8px; justify-content: flex-end; }
.mb-c { gap: 10px; justify-content: center; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 14px 0 0; margin-right: 6px; border-right: 1px solid var(--line); height: 34px; }
.brand .mark { display: flex; filter: drop-shadow(0 4px 12px rgba(var(--ac-rgb), .45)); }
.brand svg { display: block; }
.wm { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.wm b { font-size: 10.5px; letter-spacing: .22em; color: var(--mu); font-weight: 700; }
.wm em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--tx); white-space: nowrap; margin-top: 2px; }
.mbi { height: 34px; padding: 0 13px; border: 0; background: none; color: var(--mu); border-radius: var(--r-sm); cursor: pointer; font-size: 14px; white-space: nowrap; transition: background .15s, color .15s; }
.mbi:hover, .mbi[aria-expanded="true"] { background: rgba(255, 255, 255, .07); color: var(--tx); }
.fname { position: relative; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 15px; border-radius: 999px; background: rgba(255, 255, 255, .045); border: 1px solid var(--line); color: var(--tx); font-size: 13px; }
.fname:empty { display: none; }
.fname.dirty::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px var(--warn); vertical-align: 1px; }
.autosave { color: var(--mu2); font-size: 12px; white-space: nowrap; }

/* ---- nút ---- */
.btn, .tool { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid transparent; background: transparent; color: var(--tx); border-radius: 10px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease), box-shadow .2s; }
.btn { border-color: var(--line); background: rgba(255, 255, 255, .05); }
.btn:hover:not(:disabled), .tool:hover { background: rgba(255, 255, 255, .1); border-color: var(--line-2); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--ac), var(--ac2)); border-color: transparent; color: var(--ac-on); font-weight: 700; box-shadow: 0 8px 22px -8px rgba(var(--ac-rgb), .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08) saturate(1.05); box-shadow: 0 12px 28px -8px rgba(var(--ac-rgb), .85), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.danger { color: #ffb4b6; border-color: rgba(239, 106, 112, .4); background: transparent; }
.btn.danger:hover:not(:disabled) { background: rgba(239, 106, 112, .14); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 28px; font-size: 15.5px; border-radius: 14px; }
.tool { color: var(--mu); }
.tool:hover { color: var(--tx); }
#bRead[aria-pressed="true"] { border-color: var(--ac-line); color: var(--ac-ink); background: var(--ac-soft); }
#app.empty #bRead, #app.empty #bSave, #app.empty #bMore { opacity: .4; pointer-events: none; }
#app.empty .menubar .btn.primary { background: rgba(255, 255, 255, .08); color: var(--mu); box-shadow: none; }
.split { position: relative; display: inline-flex; }
.split #bSave { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 15px; }
.split .save-more { padding: 0 9px; border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(0, 0, 0, .22); }

.ic { width: 18px; height: 18px; display: inline-block; background: currentColor; flex: none;
	-webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ic-open { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7v12a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-7l-2-3H5a2 2 0 0 0-2 2z'/%3E%3C/svg%3E"); }
.ic-plus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ic-save { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0 4-4m-4 4-4-4M5 21h14'/%3E%3C/svg%3E"); }
.ic-print { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 9V3h12v6M6 18H4a1 1 0 0 1-1-1v-6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1h-2'/%3E%3Crect x='6' y='14' width='12' height='7'/%3E%3C/svg%3E"); }
.ic-close { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.ic-caret { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); }
.ic-key { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='6' width='19' height='12' rx='2'/%3E%3Cpath d='M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10'/%3E%3C/svg%3E"); }
.ic-up { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E"); }
.ic-down { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.ic-copy { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M4 16V6a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E"); }
.ic-eye { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.ic-eye-off { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M10.6 5.1A10 10 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3.2 4M6.6 6.6C3.9 8.3 2 12 2 12s3.6 7 10 7a9.6 9.6 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2'/%3E%3C/svg%3E"); }
.ic-trash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13'/%3E%3C/svg%3E"); }
.ic-grip { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01' stroke-width='3'/%3E%3C/svg%3E"); }
.ic-play-from { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4.5v15'/%3E%3Cpath d='M9 4.5v15l11-7.5z' fill='black'/%3E%3C/svg%3E"); }
.ic-play { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4.5v15l12-7.5z' fill='black'/%3E%3C/svg%3E"); }
.ic-presenter { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='4' width='12' height='9' rx='1.5'/%3E%3Cpath d='M17.5 6h4M17.5 10h4M2.5 17h19M8 13v4'/%3E%3C/svg%3E"); }
.ic-full { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3H5a2 2 0 0 0-2 2v3'/%3E%3Cpath d='M21 8V5a2 2 0 0 0-2-2h-3'/%3E%3Cpath d='M3 16v3a2 2 0 0 0 2 2h3'/%3E%3Cpath d='M16 21h3a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E"); }
.ic-exitfull { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v3a2 2 0 0 1-2 2H3'/%3E%3Cpath d='M21 8h-3a2 2 0 0 1-2-2V3'/%3E%3Cpath d='M3 16h3a2 2 0 0 1 2 2v3'/%3E%3Cpath d='M16 21v-3a2 2 0 0 1 2-2h3'/%3E%3C/svg%3E"); }


/* ---- vùng làm việc: khung LibreOffice như một cửa sổ nổi ---- */
.stage { flex: 1; min-height: 0; position: relative; z-index: 0; isolation: isolate; color: var(--tx); }

/* ---- màn hình đầu ---- */
.drop { position: absolute; inset: var(--mbar) 0 0 0; display: flex; align-items: center; justify-content: center; overflow: auto; overscroll-behavior: contain; padding: 24px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); z-index: 3; }
#app:not(.empty) .drop { display: none; }
.drop-in { max-width: 640px; width: 100%; margin: auto; padding: 8px 24px 28px; text-align: center; animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero-art { position: relative; display: inline-block; width: 168px; height: 168px; margin-bottom: 10px; perspective: 700px; }
.hero-art svg { position: absolute; left: 50%; top: 50%; width: 118px; height: 118px; margin: -59px 0 0 -59px; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); animation: float 6s ease-in-out infinite; }
.hero-art::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgba(var(--ac-rgb), .4); background: radial-gradient(circle at 50% 0, #fff 0 2.5px, rgba(var(--ac-rgb), .9) 3px, transparent 7px); box-shadow: 0 0 40px -6px rgba(var(--ac-rgb), .35), inset 0 0 40px -14px rgba(var(--ac-rgb), .3); animation: orbit 16s linear infinite; }
.hero-art::after { content: ""; position: absolute; inset: 22px -34px; border-radius: 50%; border: 1px solid var(--line); transform: rotate(-14deg); }
@keyframes orbit { from { transform: rotateX(72deg) rotateZ(0); } to { transform: rotateX(72deg) rotateZ(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(4px); } }
.drop-in h1 { margin: 6px 0 26px; font-size: 42px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; background: linear-gradient(180deg, #fff 30%, color-mix(in srgb, var(--ac) 45%, #b7c4da)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btnrow { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 4px 0 2px; }
.drop::after { content: ""; position: absolute; inset: 18px; border: 2px dashed var(--ac); border-radius: 28px; background: var(--ac-soft); opacity: 0; pointer-events: none; transition: opacity .18s; }
#app.dragging .drop::after { opacity: 1; }
.restore { margin: 30px auto 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; background: var(--ac-soft); border: 1px solid var(--ac-line); border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(8px); }
.restore p { margin: 0; flex-basis: 100%; color: var(--ac-ink); font-size: 13.5px; }

/* ---- menu thả xuống, hộp thoại, thông báo (kính mờ) ---- */
.dd, .modal, .toast, .help, .ime, #app.reading .rbar { background: var(--glass-2); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--line-2); }
.dd { position: fixed; z-index: 80; color: var(--tx); border-radius: 14px; box-shadow: 0 22px 56px rgba(0, 0, 0, .6); padding: 6px; min-width: 260px; max-height: calc(100vh - 60px); overflow: auto; animation: ddin .14s var(--ease); overscroll-behavior: contain; }
.dd button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: 0; border-radius: 9px; padding: 9px 12px; color: inherit; cursor: pointer; white-space: nowrap; }
.dd button:hover:not(:disabled), .dd button:focus-visible { background: rgba(var(--ac-rgb), .16); outline: none; }
.dd button:disabled { opacity: .38; cursor: default; }
.dd .kb { margin-left: auto; padding-left: 24px; color: var(--mu2); font-size: 12px; }
.dd .mdiv { height: 1px; background: var(--line); margin: 6px 4px; }
@keyframes ddin { from { opacity: 0; transform: translateY(-5px) scale(.985); } to { opacity: 1; transform: none; } }
.mov { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 5, 10, .66); backdrop-filter: blur(4px); }
.modal { color: var(--tx); border-radius: 20px; max-width: 460px; width: 100%; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; animation: ddin .18s var(--ease); }
.modal h2 { margin: 0; padding: 18px 22px 4px; font-size: 17px; letter-spacing: -.01em; }
.modal .mb { padding: 8px 22px 18px; line-height: 1.55; color: var(--mu); }
.modal .mf { padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .025); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: flex-start; gap: 11px; color: var(--tx); padding: 13px 20px 13px 16px; border-radius: 14px; box-shadow: 0 18px 48px rgba(0, 0, 0, .6); z-index: 95; max-width: min(560px, 92vw); font-size: 13.5px; animation: ddin .22s var(--ease); }
.toast::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; background: var(--ok); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E"); }
.toast.bad::before { background: var(--bad); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.5 20h19z'/%3E%3Cpath d='M12 10v5M12 18v.01'/%3E%3C/svg%3E"); }

/* ---- màn chờ tải ---- */
.busy { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; color: var(--mu); font-weight: 400; font-size: 14px; background: radial-gradient(700px 420px at 50% 42%, rgba(var(--ac-rgb), .16), transparent 70%), #04070d; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.busy::before { content: ""; width: 58px; height: 58px; border-radius: 50%; order: 0; background: conic-gradient(from 0deg, transparent 0 40%, var(--ac) 85%, var(--ac2)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); animation: spin 1.05s linear infinite; filter: drop-shadow(0 0 14px rgba(var(--ac-rgb), .55)); }
#busyText { order: 2; letter-spacing: .02em; }
.busy-sub { order: 1; }
.busy .bar { order: 3; }
@keyframes spin { to { transform: rotate(360deg); } }
kbd { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); color: var(--mu); white-space: nowrap; }

/* ---- hướng dẫn nhanh ---- */
.help { width: min(660px, 94vw); max-height: 86vh; padding: 0; border-radius: 20px; color: var(--tx); box-shadow: 0 34px 90px rgba(0, 0, 0, .65); }
.help::backdrop { background: rgba(3, 5, 10, .66); backdrop-filter: blur(4px); }
.help-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; border-bottom: 1px solid var(--line); font-size: 15px; }
.help-b2 { padding: 6px 22px 20px; overflow: auto; max-height: calc(86vh - 60px); }
.help h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ac-ink); margin: 18px 0 6px; }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.help dt { color: var(--mu); }
.help dd { margin: 0; }
.help p { color: var(--mu); font-size: 12.5px; margin: 8px 0 0; }

/* ---- toàn màn hình ---- */
.rbar { display: none; }
#app.reading .rbar { display: flex; align-items: center; gap: 2px; position: fixed; right: 18px; top: 16px; z-index: 60; padding: 5px; border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .55); transition: opacity .25s, transform .25s; }
#app.reading .rbar.idle { opacity: 0; pointer-events: none; transform: translateY(-8px); }
.rb { width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--tx); cursor: pointer; }
.rb:hover { background: rgba(255, 255, 255, .12); }
.rb .ic { width: 17px; height: 17px; }
#app.reading .menubar { display: none !important; }

/* ---- màn hình hẹp ---- */
@media (max-width: 1100px) { .btn .lbl-d, #bIme span, #bRead span { display: none; } #bIme, #bRead { padding: 0 11px; } .autosave { display: none; } }
@media (max-width: 860px) { .wm, .fname { display: none; } .menubar { grid-template-columns: auto 1fr auto; } }
@media (max-width: 640px) {
	.menubar { gap: 4px; padding-left: 8px; padding-right: 8px; }
	.mbi { padding: 0 9px; }
	.brand { padding-right: 8px; margin-right: 2px; }
	.btn span { display: none; }
	.btn.lg span { display: inline; }
	.btn.lg { padding: 0 22px; }
	.drop-in h1 { font-size: 32px; }
	.hero-art { width: 132px; height: 132px; } .hero-art svg { width: 92px; height: 92px; margin: -46px 0 0 -46px; }
}
@media (max-width: 420px) { .brand { display: none; } .drop-in h1 { font-size: 27px; margin-bottom: 18px; } .help dl { grid-template-columns: 1fr; gap: 2px 0; } .help dd { margin-bottom: 6px; } }
@media (max-height: 560px) { :root { --mbar: 48px; } .hero-art { display: none; } .drop-in h1 { font-size: 26px; margin-bottom: 14px; } }
@media (pointer: coarse) { .dd button { height: 46px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- in ---- */
#printArea { display: none; }
@media print {
	html, body, #app { height: auto; background: #fff; overflow: visible; }
	.menubar, .tabrow, .toast, .busy, .drop, .rbar, .help, .dd, .mov { display: none !important; }
	.host.off { display: none !important; }
	body.print-area #app, body.print-area .toast { display: none !important; }
	body.print-area #printArea { display: block; color: #000; background: #fff; font: 10pt/1.3 "BVP", system-ui, sans-serif; }
	.pr-sheet h1 { font-size: 12pt; margin: 0 0 6pt; }
	.pr-sheet table { border-collapse: collapse; }
	.pr-sheet td { border: .5pt solid #999; padding: 2pt 4pt; vertical-align: top; white-space: pre-wrap; }
}

/* ---- Phần riêng của bản LibreOffice (phủ lên core.css) ---- */
/* Khung LibreOffice: cửa sổ nổi, bo góc, bóng đổ; toàn màn hình thì tràn hết. */
.stage > canvas#qtcanvas { position: absolute; inset: 4px 14px 14px; width: calc(100% - 28px); height: calc(100% - 18px); border: 0; padding: 0; margin: 0; outline: 0; background: #fff; border-radius: 14px; box-shadow: 0 0 0 1px var(--line-2), 0 30px 70px -28px rgba(0, 0, 0, .85), 0 0 80px -30px rgba(var(--ac-rgb), .35); visibility: hidden; caret-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
#app.live .stage > canvas#qtcanvas { visibility: visible; animation: winin .45s var(--ease) both; }
@keyframes winin { from { opacity: 0; transform: translateY(10px) scale(.992); } to { opacity: 1; transform: none; } }
#app.reading .stage > canvas#qtcanvas { inset: 0; width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
#app:not(.empty) .drop { display: none; }
#app.empty .stage > canvas#qtcanvas { visibility: hidden; }

/* Màn chờ: số % lớn + thanh có ánh sáng */
.busy-sub { font-weight: 400; font-size: 13px; color: var(--mu); max-width: 420px; text-align: center; min-height: 0; }
.busy-sub:empty { display: none; }
.busy-sub.num { font-size: 54px; line-height: 1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; background: linear-gradient(135deg, #fff, var(--ac) 60%, var(--ac2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 22px rgba(var(--ac-rgb), .4)); }
.busy .bar { width: min(380px, 72vw); height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.busy .bar i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--ac), var(--ac2)); box-shadow: 0 0 16px rgba(var(--ac-rgb), .8); transition: width .25s; }
.busy .bar.ind i { width: 38%; animation: lobar 1.2s ease-in-out infinite; }
@keyframes lobar { 0% { transform: translateX(-110%); } 100% { transform: translateX(290%); } }

.help-b2 p { margin: 8px 0; line-height: 1.55; }
/* Ô Gõ có dấu */
.ime { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(660px, calc(100vw - 24px)); z-index: 40; display: flex; gap: 10px; align-items: stretch; padding: 12px; border-radius: 18px; box-shadow: 0 22px 60px rgba(0, 0, 0, .6); animation: ddin .2s var(--ease); }
.ime[hidden] { display: none; }
.ime textarea { flex: 1; resize: none; background: rgba(0, 0, 0, .3); color: var(--tx); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; font: 15px/1.45 "BVP", system-ui, sans-serif; outline: none; transition: border-color .15s, box-shadow .15s; }
.ime textarea::placeholder { color: var(--mu2); }
.ime textarea:focus { border-color: var(--ac-line); box-shadow: 0 0 0 3px rgba(var(--ac-rgb), .15); }
.ime-b { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
#app:not(.live) #bIme, #app.empty #bIme { opacity: .3; pointer-events: none; }
.ic-kbd { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5.5' width='19' height='13' rx='2'/%3E%3Cpath d='M6.5 10h.01M10 10h.01M14 10h.01M17.5 10h.01M7 14.5h10'/%3E%3C/svg%3E"); }

/* ô nhập ẩn nhận chữ từ mọi bộ gõ + khung hiện chữ đang gõ */
#kb { position: fixed; left: 50%; bottom: 64px; width: 2px; height: 2px; opacity: 0; border: 0; padding: 0; margin: 0; resize: none; overflow: hidden; font-size: 16px; caret-color: transparent; pointer-events: none; z-index: 41; background: transparent; color: transparent; outline: 0; }
.kbchip { position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 41; max-width: min(520px, calc(100vw - 32px)); padding: 7px 14px; border-radius: 999px; background: var(--glass-2); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--ac-line); box-shadow: 0 14px 40px rgba(0, 0, 0, .55), 0 0 0 3px rgba(var(--ac-rgb), .12); color: var(--tx); font: 16px/1.4 "BVP", system-ui, sans-serif; white-space: pre; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.kbchip[hidden] { display: none; }

body[data-mode="writer"] { --ac: #4da3ff; --ac2: #8b7bff; --ac-on: #061426; --ac-rgb: 77, 163, 255; }
