/* 公式表 on Matematik Tambahan papers (partials/paper-formula.blade.php, js/paper-formula.js). */

/* The header button: like ⚙ (36 px, grey) on phones; 公式表 with its label on computers. */
body.pui-app .pa-formula-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 4px; height: 36px; min-width: 36px; padding: 0 10px; border: 0; border-radius: 12px; background: #f2f2f2; color: #5c5a55; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
body.pui-app .pa-formula-btn .material-symbols-outlined { --icon-size: 20px; font-size: 20px; }
body.pui-app .pa-formula-btn:hover { background: #e9e9e9; }
body.pui-app .pa-formula-btn[aria-expanded="true"] { background: #1f1d1a; color: #fff; }
body.pw-app.pa-exam .pa-formula-btn,
body.pw-app.pa-result .pa-formula-btn { order: 0; }
@media (max-width: 720px) {
    body.pui-app .pa-formula-btn { width: 36px; padding: 0; }
    body.pui-app .pa-formula-btn span:not(.material-symbols-outlined) { display: none; }
}

/* The drawer: from the right on computers (the question stays in view), from the bottom on phones. */
body.pf-on { overflow: hidden; }
.pf-sheet { position: fixed; inset: 0; z-index: 460; }
.pf-sheet[hidden] { display: none; }
.pf-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.18); opacity: 0; transition: opacity 0.25s ease; }
.pf-sheet.is-open .pf-backdrop { opacity: 1; }
.pf-panel { position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(560px, 46vw); background: #fff; color: #1f1d1a; box-shadow: -12px 0 40px rgba(0, 0, 0, 0.1); transform: translateX(104%); transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1); }
.pf-sheet.is-open .pf-panel { transform: none; }
.pf-panel:focus { outline: none; }
.pf-handle { display: none; }
.pf-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.pf-title { margin: 0; font-size: 18px; font-weight: 700; }
.pf-x { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #f2f2f3; color: #55555e; cursor: pointer; }
.pf-x:hover { background: #e9e9ec; color: #1f1d1a; }
.pf-x .material-symbols-outlined { --icon-size: 20px; font-size: 20px; }
.pf-tabs { display: flex; gap: 4px; margin: 6px 18px 0; padding: 3px; border-radius: 12px; background: #f2f2f3; }
.pf-tab { flex: 1; height: 36px; border: 0; border-radius: 10px; background: transparent; color: #6b6b75; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pf-tab.is-on { background: #fff; color: #1f1d1a; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.pf-body { flex: 1; overflow-y: auto; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.pf-note { margin: 2px 0 10px; color: #6b6b75; font-size: 13px; line-height: 1.5; }
.pf-how { margin-top: 0; }
.pf-page { display: block; width: 100%; margin: 0 0 10px; padding: 0; overflow: hidden; border: 1px solid #ececec; border-radius: 12px; background: #fff; cursor: zoom-in; }
.pf-page img { display: block; width: 100%; height: auto; }

@media (max-width: 720px) {
    .pf-backdrop { background: rgba(0, 0, 0, 0.32); }
    .pf-panel { top: auto; left: 0; width: auto; height: 90vh; height: 90dvh; border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.1); transform: translateY(104%); }
    .pf-handle { display: block; flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: #e2e2e2; }
    .pf-head { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .pf-panel, .pf-backdrop { transition: none !important; }
}
