/**
 * Font Cut v3 — canvas-first layout
 * Base tokens, header, dropdown and theme come from /css/common.css
 */

/* =========================
   TOKENS
   ========================= */
:root {
    --fc-canvas: #141417;
    --fc-dot: rgba(255, 255, 255, 0.055);
    --fc-surface: rgba(34, 34, 40, 0.9);
    --fc-surface-solid: #222228;
    --fc-edge: rgba(255, 255, 255, 0.07);
    --fc-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
    --fc-hover: rgba(255, 255, 255, 0.07);
    --fc-field: rgba(255, 255, 255, 0.045);
    --fc-field-edge: rgba(255, 255, 255, 0.08);
    --fc-muted: #8e93a0;
    --fc-artboard: #fbfbfa;
    --fc-grid: rgba(20, 20, 30, 0.055);
    --fc-grid-major: rgba(20, 20, 30, 0.11);
    --fc-dim: #7d828f;
    --fc-sel: #4c7dff;
    --fc-guide: #f0508c;
    --fc-strong: #f3f4f6;
    --fc-strong-text: #111113;
    --fc-radius: 14px;
    color-scheme: dark;
}

.light-theme {
    color-scheme: light;
    --fc-canvas: #e9e9ec;
    --fc-dot: rgba(0, 0, 0, 0.07);
    --fc-surface: rgba(255, 255, 255, 0.92);
    --fc-surface-solid: #ffffff;
    --fc-edge: rgba(0, 0, 0, 0.06);
    --fc-shadow: 0 10px 30px rgba(17, 24, 39, 0.12), 0 1px 2px rgba(17, 24, 39, 0.08);
    --fc-hover: rgba(17, 24, 39, 0.06);
    --fc-field: rgba(17, 24, 39, 0.035);
    --fc-field-edge: rgba(17, 24, 39, 0.09);
    --fc-muted: #6b7280;
    --fc-artboard: #ffffff;
    --fc-dim: #8b8f99;
    --fc-strong: #111827;
    --fc-strong-text: #ffffff;
}

[hidden] { display: none !important; }

/* =========================
   PAGE SHELL
   ========================= */
html, body { height: 100%; }
body { overflow: hidden; }

.fc-app {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 12px 12px;
    text-align: left;
}

.fc-app > header { flex-shrink: 0; }

/* =========================
   CANVAS
   ========================= */
.fc-canvas {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: var(--fc-radius);
    background-color: var(--fc-canvas);
    background-image: radial-gradient(var(--fc-dot) 1px, transparent 1.2px);
    background-size: 22px 22px;
    isolation: isolate;
}

#work {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.fc-canvas.is-grab #work { cursor: grab; }
.fc-canvas.is-grabbing #work,
.fc-canvas.is-grabbing #work * { cursor: grabbing !important; }

.fc-area { fill: var(--fc-artboard); }
.fc-grid-line { fill: none; stroke: var(--fc-grid); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.fc-grid-major { fill: none; stroke: var(--fc-grid-major); stroke-width: 1px; vector-effect: non-scaling-stroke; }

.fc-obj { cursor: move; }
.fc-hit { fill: transparent; }
.fc-weed { stroke-width: 1.2px; }
#work.is-hover .fc-obj:hover .fc-hit { fill: rgba(76, 125, 255, 0.07); }

/* sheet dimension rulers */
.fc-dim { cursor: pointer; }
.fc-dim path { fill: none; stroke: var(--fc-dim); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.fc-dim text {
    fill: var(--fc-dim);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
.fc-dim:hover path { stroke: var(--fc-sel); }
.fc-dim:hover text { fill: var(--fc-sel); }

/* selection */
.fc-sel { fill: none; stroke: var(--fc-sel); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.fc-sel.is-out, .fc-out { stroke: var(--error-color); }
.fc-out { fill: none; stroke-width: 1.5px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }

.fc-handle {
    fill: #ffffff;
    stroke: var(--fc-sel);
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.25));
}

.fc-handle:hover { fill: var(--fc-sel); }
.fc-handle-rot { cursor: grab; }
.fc-handle-rot:active { cursor: grabbing; }
.fc-rot-line { stroke: var(--fc-sel); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }

.fc-guide { stroke: var(--fc-sel); stroke-width: 1px; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; pointer-events: none; opacity: 0.75; }
.fc-guide.is-centre { stroke: var(--fc-guide); opacity: 1; stroke-dasharray: 6 4; }

.fc-tag { pointer-events: none; }
.fc-tag rect { fill: #16161a; opacity: 0.92; }
.fc-tag text {
    fill: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.fc-empty {
    position: absolute;
    display: grid;
    place-content: center;
    text-align: center;
    gap: 6px;
    color: #8b8f99;
    font-size: var(--font-size-base);
    pointer-events: none;
}

.fc-empty-title { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); color: #4b5060; }

/* =========================
   FLOATING SURFACES
   ========================= */
.fc-pill,
.fc-round,
.fc-dock,
.fc-pop,
.fc-inspector {
    background: var(--fc-surface);
    border: 1px solid var(--fc-edge);
    box-shadow: var(--fc-shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
}

.fc-corner { position: absolute; z-index: 5; display: flex; align-items: center; gap: 8px; }
.fc-corner:has(.fc-pop:not([hidden])) { z-index: 40; }
.fc-tl { top: 14px; left: 14px; }
.fc-tc { top: 18px; left: 50%; transform: translateX(-50%); pointer-events: none; }

.fc-pop-wrap { position: relative; }

.fc-pill {
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 0 14px;
    border-radius: 12px;
    color: var(--text-color);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.fc-pill > i:first-child { color: var(--fc-muted); }
.fc-pill .fc-caret { font-size: 10px; color: var(--fc-muted); transition: transform var(--transition-base); }
.fc-pill[aria-expanded="true"] .fc-caret { transform: rotate(180deg); }
.fc-pill:hover { background: var(--fc-surface-solid); }

.fc-round {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--fc-muted);
    font-size: 13px;
    cursor: pointer;
}

.fc-round:hover, .fc-round[aria-expanded="true"] { color: var(--text-color); }

.fc-status { font-size: var(--font-size-sm); color: var(--fc-muted); }
.fc-status.is-error { color: var(--error-color); }
.fc-status:empty { display: none; }

.fc-badge {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    padding: 5px 12px;
    border-radius: 99px;
    background: var(--fc-surface);
    box-shadow: var(--fc-shadow);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    white-space: nowrap;
}

.fc-badge:empty { display: none; }
.fc-badge.warn { color: var(--warning-color); }
.fc-badge.bad { color: var(--error-color); }
.fc-badge::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: currentColor; vertical-align: 1px; }

/* popovers */
.fc-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    border-radius: var(--fc-radius);
    padding: 14px;
    animation: fc-pop-in 0.14s ease-out;
}

@keyframes fc-pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.fc-pop h3 { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); color: var(--text-color); }
.fc-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.fc-sheet-pop { width: 312px; display: grid; gap: 12px; }
.fc-sheet-pop .fc-pop-head { margin-bottom: 0; }

.fc-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.fc-preset {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 8px 4px 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--fc-field);
    color: var(--fc-muted);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.fc-preset:hover { color: var(--text-color); background: var(--fc-hover); }
.fc-preset.active { border-color: var(--fc-sel); color: var(--text-color); }

.fc-preset-shape { width: 30px; height: 30px; display: grid; place-items: center; }
.fc-preset-shape > span { display: block; border-radius: 3px; border: 1.5px solid currentColor; opacity: 0.85; }

.fc-dims { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.fc-x { color: var(--fc-muted); }

.fc-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--font-size-sm); color: var(--fc-muted); }

.fc-select {
    height: 32px;
    padding: 0 28px 0 10px;
    border-radius: 9px;
    border: 1px solid var(--fc-field-edge);
    background: var(--fc-field);
    color: var(--text-color);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.fc-select option { background: var(--fc-surface-solid); color: var(--text-color); }

.fc-swatches { display: flex; gap: 6px; }

.fc-sw {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: var(--sw, transparent);
    box-shadow: 0 0 0 1px var(--fc-field-edge);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.fc-sw:hover { transform: scale(1.1); }
.fc-sw.active { box-shadow: 0 0 0 2px var(--fc-surface-solid), 0 0 0 3.5px var(--fc-sel); }

.fc-sw-custom {
    display: grid;
    place-items: center;
    background: conic-gradient(#f44, #fd4, #4d4, #4df, #44f, #f4f, #f44);
    overflow: hidden;
}

.fc-sw-custom i { font-size: 9px; color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.6); pointer-events: none; }
.fc-sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.fc-help { width: 320px; }
.fc-help h3 { margin-bottom: 10px; }
.fc-help dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: var(--font-size-sm); }
.fc-help dt { color: var(--fc-muted); }

kbd {
    font-family: inherit;
    font-size: 0.82em;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--fc-field);
    border: 1px solid var(--fc-field-edge);
    border-bottom-width: 2px;
}

/* segmented control */
.fc-seg {
    display: inline-flex;
    padding: 2px;
    border-radius: 9px;
    background: var(--fc-field);
    border: 1px solid var(--fc-field-edge);
}

.fc-seg-full { display: flex; }

.fc-seg button {
    flex: 1;
    min-width: 34px;
    height: 26px;
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--fc-muted);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.fc-seg button:hover { color: var(--text-color); }
.fc-seg button.active { background: var(--fc-surface-solid); color: var(--text-color); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }

/* =========================
   DOCK
   ========================= */
.fc-dock {
    position: absolute;
    z-index: 6;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px;
    border-radius: 16px;
}

.fc-dock-sep { width: 1px; height: 22px; margin: 0 6px; background: var(--fc-edge); flex-shrink: 0; }
.light-theme .fc-dock-sep { background: rgba(0, 0, 0, 0.1); }

.fc-dock-btn {
    min-width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--fc-muted);
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.fc-dock-btn:hover:not(:disabled) { background: var(--fc-hover); color: var(--text-color); }
.fc-dock-btn:disabled { opacity: 0.3; cursor: default; }

.fc-toggle[aria-pressed="true"] { color: var(--fc-sel); background: rgba(76, 125, 255, 0.12); }
.fc-toggle[aria-pressed="true"]:hover { color: var(--fc-sel); background: rgba(76, 125, 255, 0.18); }

.fc-dock-zoom { display: flex; align-items: center; }
.fc-zoom-label { min-width: 54px; font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); font-variant-numeric: tabular-nums; color: var(--text-color); }

.fc-dock-add,
.fc-dock-export {
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

.fc-dock-add { background: var(--fc-sel); color: #ffffff; }
.fc-dock-export { margin-left: 6px; background: var(--fc-strong); color: var(--fc-strong-text); }
.fc-dock-add:hover, .fc-dock-export:hover:not(:disabled) { filter: brightness(1.08); }
.fc-dock-add:active, .fc-dock-export:active:not(:disabled) { transform: scale(0.97); }
.fc-dock-export:disabled { opacity: 0.35; cursor: default; }

/* =========================
   INSPECTOR
   ========================= */
.fc-inspector {
    position: absolute;
    z-index: 7;
    top: 14px;
    right: 14px;
    width: 292px;
    max-height: calc(100% - 28px);
    overflow-y: auto;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: var(--fc-radius);
    animation: fc-slide-in 0.18s ease-out;
    scrollbar-width: thin;
}

@keyframes fc-slide-in {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: none; }
}

.fc-insp-grab, .fc-insp-done { display: none; }

.fc-text {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--fc-field-edge);
    border-radius: 10px;
    background: var(--fc-field);
    color: var(--text-color);
    font-size: 17px;
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
    resize: none;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.fc-text:focus { outline: none; border-color: var(--fc-sel); }
.fc-text::placeholder { color: var(--fc-muted); }

.fc-font-btn {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--fc-field-edge);
    border-radius: 10px;
    background: var(--fc-field);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.fc-font-btn span { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-font-btn i { font-size: 10px; color: var(--fc-muted); }
.fc-font-btn:hover, .fc-font-btn[aria-expanded="true"] { border-color: var(--fc-sel); }

.fc-font-list {
    left: 0;
    right: 0;
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
    display: grid;
    gap: 1px;
    scrollbar-width: thin;
}

.fc-font-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 6px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
}

.fc-font-item:hover { background: var(--fc-hover); }
.fc-font-item.is-current { background: rgba(76, 125, 255, 0.12); }
.fc-font-item .fa-check { margin-left: auto; color: var(--fc-sel); font-size: 12px; }
.fc-font-sample { font-size: 19px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-font-tag { font-size: 10px; color: var(--fc-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.fc-font-upload { color: var(--fc-muted); font-size: var(--font-size-sm); border-top: 1px solid var(--fc-edge); border-radius: 0 0 9px 9px; margin-top: 4px; }
.fc-font-upload:hover { color: var(--text-color); }

/* number field with prefix label and unit suffix */
.fc-num {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--fc-field-edge);
    border-radius: 9px;
    background: var(--fc-field);
    cursor: text;
    min-width: 0;
    transition: border-color var(--transition-fast);
}

.fc-num:focus-within { border-color: var(--fc-sel); }

.fc-pre {
    flex-shrink: 0;
    min-width: 11px;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--fc-muted);
}

.fc-pre i { font-size: 10px; }
.fc-pre-wide { font-weight: var(--font-weight-medium); }

.fc-num input {
    flex: 1;
    width: 0;
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text-color);
    font-size: var(--font-size-base);
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}

.fc-num input:focus { outline: none; }
.fc-num input::-webkit-outer-spin-button,
.fc-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.fc-unit { flex-shrink: 0; font-size: 11px; color: var(--fc-muted); }
.fc-num-sm { width: 104px; height: 32px; }

.fc-insp-grid { display: grid; grid-template-columns: 1fr 28px 1fr; gap: 6px; align-items: center; }
.fc-insp-grid3 { grid-template-columns: 1fr 1fr 1fr; }
.fc-insp-grid2 { grid-template-columns: 1fr 1fr; }

.fc-lock {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fc-muted);
    font-size: 12px;
    cursor: pointer;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.fc-lock:hover { background: var(--fc-hover); }
.fc-lock[aria-pressed="true"] { color: var(--fc-sel); }

.fc-insp-actions { display: flex; align-items: center; gap: 2px; padding-top: 2px; }
.fc-spacer { flex: 1; }

.fc-ibtn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--fc-muted);
    font-size: 13px;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.fc-ibtn:hover { background: var(--fc-hover); color: var(--text-color); }
.fc-ibtn.fc-danger:hover { background: rgba(239, 68, 68, 0.14); color: var(--error-color); }

.fc-insp-more { border-top: 1px solid var(--fc-edge); padding-top: 8px; }

.fc-insp-more summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px;
    list-style: none;
    font-size: var(--font-size-sm);
    color: var(--fc-muted);
    cursor: pointer;
    user-select: none;
}

.fc-insp-more summary::-webkit-details-marker { display: none; }
.fc-insp-more summary:hover { color: var(--text-color); }
.fc-insp-more summary i { font-size: 10px; transition: transform var(--transition-base); }
.fc-insp-more[open] summary i { transform: rotate(180deg); }
.fc-more-body { display: grid; gap: 10px; padding-top: 8px; }

.fc-hint { font-size: var(--font-size-sm); color: var(--warning-color); }

.fc-link { background: none; border: 0; padding: 0; font: inherit; color: var(--fc-sel); cursor: pointer; }
.fc-link:hover { text-decoration: underline; }

.fc-weed-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }

/* switch */
.fc-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-size-sm);
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
}

.fc-switch input { position: absolute; opacity: 0; pointer-events: none; }

.fc-switch-track {
    position: relative;
    width: 30px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 99px;
    background: var(--toggle-unchecked-bg);
    transition: background-color var(--transition-fast);
}

.fc-switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-fast);
}

.fc-switch input:checked + .fc-switch-track { background: var(--fc-sel); }
.fc-switch input:checked + .fc-switch-track::after { transform: translateX(12px); }
.fc-switch input:focus-visible + .fc-switch-track { outline: 2px solid var(--fc-sel); outline-offset: 2px; }

/* =========================
   MOBILE
   ========================= */
@media (max-width: 760px) {
    .fc-app { padding: 0 6px 6px; }
    .fc-app > header { flex-direction: row; padding: 6px 12px; margin-bottom: 6px; }
    .fc-app > header h1 { font-size: var(--font-size-xl); }
    .fc-app .header-left { align-items: flex-start; }

    .fc-canvas { border-radius: 12px; }
    .fc-tl { top: 10px; left: 10px; }
    .fc-tc { top: 58px; }
    .fc-help-wrap { display: none; }

    /* dock spans the bottom edge */
    .fc-dock {
        left: 8px;
        right: 8px;
        bottom: 8px;
        transform: none;
        justify-content: space-between;
        padding: 6px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px) * 0.5);
    }

    .fc-hide-touch { display: none !important; }
    .fc-dock-btn { min-width: 42px; height: 42px; }
    .fc-dock-add, .fc-dock-export { height: 42px; padding: 0 14px; }
    .fc-dock-export span { display: none; }
    .fc-dock-export { margin-left: 2px; }
    body.fc-has-sel .fc-dock { opacity: 0; pointer-events: none; transform: translateY(12px); }
    .fc-dock { transition: opacity 0.18s, transform 0.18s; }

    /* popovers become bottom sheets */
    .fc-pop.fc-sheet-pop {
        position: fixed;
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        border-radius: 18px;
        max-height: 78%;
        overflow-y: auto;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        animation: fc-sheet-up 0.2s ease-out;
    }

    /* inspector becomes a bottom sheet */
    .fc-inspector {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-height: 58%;
        border-radius: 18px 18px 0 0;
        border-bottom: 0;
        padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
        animation: fc-sheet-up 0.2s ease-out;
    }

    .fc-insp-grab { display: block; justify-self: center; width: 36px; height: 4px; border-radius: 99px; background: var(--fc-field-edge); margin-bottom: 2px; }

    .fc-insp-done {
        display: block;
        height: 44px;
        border: 0;
        border-radius: 12px;
        background: var(--fc-strong);
        color: var(--fc-strong-text);
        font-size: var(--font-size-md);
        font-weight: var(--font-weight-semibold);
        cursor: pointer;
    }

    /* 16px stops iOS zooming into fields */
    .fc-num input, .fc-select, .fc-text { font-size: 16px; }
    .fc-num { height: 42px; }
    .fc-ibtn { width: 42px; height: 42px; }
    .fc-font-list { max-height: 40vh; }
}

@keyframes fc-sheet-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 380px) {
    .fc-dock-add span { display: none; }
    .fc-dock-add { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .fc-pop, .fc-inspector, .fc-dock { animation: none !important; transition: none !important; }
}
