
.profile-card {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
[data-theme] .profile-card {
    border-color: transparent;
    box-shadow: none;
}

.pc-surface {
    position: absolute;
    inset: 0;
    z-index: -10000;
    border-radius: inherit;
    background: var(--clr-card-bg, var(--pg-card));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
}
[data-theme="dark"] .pc-surface {
    border: 1px solid var(--clr-card-border, #1a1a1a);
    box-shadow: 0 24px 60px rgba(0,0,0,0.7);
}

[data-layout="banner"] .profile-card::before { content: none; }
[data-layout="banner"] .pc-surface::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 110px;
    background: linear-gradient(135deg, var(--accent, #b7bdc4), rgba(255,255,255,0.06));
    z-index: 0;
}

[data-layout="banner"] .banner-image-layer {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

[data-layout="banner"] .pc-surface::before {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

:root {
    --op-w: min(560px, calc(100vw - 2rem));
}
[data-op-el] {
    translate: var(--op-t, none);
    scale: var(--op-sc, none);
}
[data-op-el] > * { --op-t: none; --op-sc: none; }

[data-op-el="card"] {
    width: var(--op-sw, auto);
    height: var(--op-sh, auto);
}
[data-op-el="card"] > * { --op-sw: auto; --op-sh: auto; }

.op-fab,
.op-bar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 999000010;
    font-family: var(--font-mono, monospace);
}

.op-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(12,12,14,0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: rgba(255,255,255,0.82);
    cursor: pointer !important;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, scale 0.18s ease;
}
.op-fab:hover {
    background: rgba(22,22,26,0.9);
    border-color: color-mix(in srgb, var(--accent, #fff) 45%, rgba(255,255,255,0.14));
    color: #fff;
    scale: 1.06;
}
.op-fab svg { width: 17px; height: 17px; display: block; }

.op-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(12,12,14,0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 48px rgba(0,0,0,0.55);
    animation: op-bar-in 0.28s cubic-bezier(.16,1,.3,1);
}
@keyframes op-bar-in {
    from { opacity: 0; translate: 0 -10px; }
    to   { opacity: 1; translate: 0 0; }
}

.op-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.7rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 9px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.78);
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.op-btn:hover:not(:disabled) { background: rgba(255,255,255,0.11); color: #fff; }
.op-btn:disabled { opacity: 0.4; cursor: not-allowed !important; }
.op-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.op-btn-primary {
    background: var(--accent, #fff);
    border-color: transparent;
    color: #0a0a0a;
}
.op-btn-primary:hover:not(:disabled) { filter: brightness(1.12); color: #0a0a0a; }
.op-bar-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.12); }

.op-layer {
    position: fixed;
    inset: 0;
    z-index: 999000000;
    pointer-events: none;
    overflow: hidden;
}

.op-unit-probe {
    position: absolute;
    top: 0; left: 0;
    width: var(--op-w, 560px);
    height: 0;
    visibility: hidden;
}

.op-grid {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    background-image:
        repeating-linear-gradient(to right,
            color-mix(in srgb, var(--accent, #ffffff) 34%, transparent) 0 1px,
            transparent 1px var(--op-cell, 14px)),
        repeating-linear-gradient(to bottom,
            color-mix(in srgb, var(--accent, #ffffff) 34%, transparent) 0 1px,
            transparent 1px var(--op-cell, 14px));
    background-position: var(--op-ox, 0px) var(--op-oy, 0px);
    -webkit-mask-image: radial-gradient(130% 95% at 50% var(--op-fy, 50%), #000 0%, rgba(0,0,0,0.4) 55%, transparent 100%);
    mask-image: radial-gradient(130% 95% at 50% var(--op-fy, 50%), #000 0%, rgba(0,0,0,0.4) 55%, transparent 100%);
}
.op-grid.is-on { opacity: 0.55; }
.op-grid.is-hot { opacity: 0.85; }

.op-guide {
    position: absolute;
    background: var(--accent, #ff2fd0);
    box-shadow: 0 0 6px color-mix(in srgb, var(--accent, #ffffff) 70%, transparent);
    opacity: 0.9;
}
.op-guide-v { width: 1px; top: 0; bottom: 0; }
.op-guide-h { height: 1px; left: 0; right: 0; }

.op-hit {
    position: absolute;
    pointer-events: auto;
    border-radius: 10px;
    cursor: grab !important;
    touch-action: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.op-hit * { cursor: grab !important; }
.op-hit:hover { background: color-mix(in srgb, var(--accent, #ffffff) 9%, transparent); }
.op-hit.is-selected {
    background: color-mix(in srgb, var(--accent, #ffffff) 12%, transparent);
    box-shadow: 0 0 0 1.5px var(--accent, #fff), 0 0 0 5px color-mix(in srgb, var(--accent, #ffffff) 16%, transparent);
}
.op-hit.is-dragging,
.op-hit.is-dragging * { cursor: grabbing !important; }

.op-hit-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    translate: -50% 0;
    padding: 0.16rem 0.42rem;
    border-radius: 5px;
    background: rgba(8,8,10,0.92);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    font-family: var(--font-mono, monospace);
    font-size: 0.5rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.op-hit:hover .op-hit-label,
.op-hit.is-selected .op-hit-label { opacity: 1; }

.op-readout {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    translate: -50% 0;
    z-index: 999000010;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    max-width: calc(100vw - 2rem);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(12,12,14,0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: rgba(255,255,255,0.7);
    font-family: var(--font-mono, monospace);
    font-size: 0.56rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.op-readout b { color: #fff; font-weight: 600; }
.op-readout-dim { color: rgba(255,255,255,0.4); }
.op-readout-pct {
    padding: 0.1rem 0.4rem;
    border-radius: 5px;
    background: color-mix(in srgb, var(--accent, #b7bdc4) 22%, transparent);
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.op-toast {
    position: fixed;
    top: 4.2rem;
    right: 1rem;
    z-index: 999000010;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(12,12,14,0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: rgba(255,255,255,0.85);
    font-family: var(--font-mono, monospace);
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    animation: op-bar-in 0.25s cubic-bezier(.16,1,.3,1);
}
.op-toast-err { border-color: rgba(255,90,90,0.45); color: #ff9d9d; }

@keyframes op-wiggle {
    from { rotate: calc(-1 * var(--op-amp, 0.6deg)); }
    to   { rotate: var(--op-amp, 0.6deg); }
}
.op-editing [data-op-el] {
    animation: op-wiggle 0.3s ease-in-out infinite alternate;
    animation-delay: var(--op-phase, 0s);
    outline: 1px dashed rgba(255,255,255,0.25);
    outline-offset: 3px;
    border-radius: 8px;
}
.op-editing [data-op-el].op-lift { position: relative; }
.op-editing [data-op-el].op-active {
    animation: none;
    rotate: 0deg;
    scale: var(--op-sc, 1.025);
    z-index: 900;
    outline-color: var(--accent, #fff);
    filter: drop-shadow(0 12px 26px rgba(0,0,0,0.55));
}
.op-measuring [data-op-el] {
    animation: none !important;
    rotate: 0deg !important;
    scale: 1 !important;
    transition: none !important;
}

.op-measuring-flat [data-op-el] {
    transform: none !important;
    translate: none !important;
}

.op-measuring [data-op-el="card"] {
    width: auto !important;
    height: auto !important;
}

.op-editing,
.op-editing body { user-select: none; -webkit-user-select: none; }
.op-editing .profile-wrap a,
.op-editing .profile-wrap button,
.op-editing .profile-wrap input,
.op-editing .profile-wrap canvas { pointer-events: none !important; }
.op-editing #global-tooltip { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .op-editing [data-op-el] { animation: none; }
    .op-bar, .op-toast { animation: none; }
}

.op-resizing [data-op-el] {
    animation: none;
    rotate: 0deg;
}

.op-hit.is-picking { cursor: pointer; }
.op-hit.is-picking.is-selected { cursor: default; }
.op-resizing [data-op-el].op-active {
    scale: var(--op-sc, none);
    outline: none;
}

.op-hit.is-resized::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #b7bdc4) 45%, transparent);
}

.op-frame {
    position: absolute;
    pointer-events: none;
    z-index: 950;
    box-shadow: 0 0 0 1.5px var(--accent, #b7bdc4),
                0 0 0 5px color-mix(in srgb, var(--accent, #b7bdc4) 16%, transparent);
    border-radius: 4px;
}

.op-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 4px;
    background: #0c0c10;
    border: 1.5px solid var(--accent, #b7bdc4);
    pointer-events: auto;
    touch-action: none;
    transition: scale 0.12s ease, background 0.12s ease;
}

.op-handle:hover,
.op-handle.is-active {
    background: var(--accent, #b7bdc4);
    scale: 1.25;
}

.op-handle[data-dir="nw"] { left: 0;    top: 0;    cursor: nwse-resize !important; }
.op-handle[data-dir="n"]  { left: 50%;  top: 0;    cursor: ns-resize !important; }
.op-handle[data-dir="ne"] { left: 100%; top: 0;    cursor: nesw-resize !important; }
.op-handle[data-dir="e"]  { left: 100%; top: 50%;  cursor: ew-resize !important; }
.op-handle[data-dir="se"] { left: 100%; top: 100%; cursor: nwse-resize !important; }
.op-handle[data-dir="s"]  { left: 50%;  top: 100%; cursor: ns-resize !important; }
.op-handle[data-dir="sw"] { left: 0;    top: 100%; cursor: nesw-resize !important; }
.op-handle[data-dir="w"]  { left: 0;    top: 50%;  cursor: ew-resize !important; }

.op-handle[data-dir="n"],
.op-handle[data-dir="s"] { width: 26px; margin-left: -13px; }
.op-handle[data-dir="e"],
.op-handle[data-dir="w"] { height: 26px; margin-top: -13px; }

.op-modes {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border-radius: 9px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
}

.op-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 26px;
    padding: 0 0.55rem;
    border: none;
    background: none;
    border-radius: 7px;
    color: rgba(255,255,255,0.6);
    font-family: inherit;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.op-mode:hover { color: #fff; }
.op-mode.is-active {
    background: color-mix(in srgb, var(--accent, #b7bdc4) 30%, rgba(255,255,255,0.12));
    color: #fff;
}
.op-mode svg { width: 12px; height: 12px; }

@media (prefers-reduced-motion: reduce) {
    .op-handle { transition: none; }
}

.op-editing .op-unclipped,
html:not(.op-editing) .portfolio-page-card:has([data-op-el][style*="--op-t"]),
html:not(.op-editing) .portfolio-page-card:has([data-op-el][style*="--op-sc"]),
html:not(.op-editing) .portfolio-page-card:has([data-op-el][style*="--op-sw"]) {
    overflow: visible;
}
html:not(.op-editing) .portfolio-page-content:has([data-op-el][style*="--op-t"]),
html:not(.op-editing) .portfolio-page-content:has([data-op-el][style*="--op-sc"]),
html:not(.op-editing) .portfolio-page-content:has([data-op-el][style*="--op-sw"]) {
    overflow: visible;
}
.op-measuring .portfolio-page-card,
.op-editing .portfolio-page-card {
    scale: 1;
    opacity: 1;
    transition: none;
}

html:not(.op-editing) .portfolio-page-content:has([data-op-el][style*="--op-t"]) > .portfolio-custom-copy,
html:not(.op-editing) .portfolio-page-content:has([data-op-el][style*="--op-sc"]) > .portfolio-custom-copy,
html:not(.op-editing) .portfolio-page-content:has([data-op-el][style*="--op-sw"]) > .portfolio-custom-copy {
    max-height: calc(var(--pg-content-max, min(58svh,680px)) - 5rem);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-inline-end: .25rem;
}
