:root {
    --bg: #06080f;
    --bg-elevated: rgba(12, 18, 29, 0.88);
    --bg-strong: rgba(15, 24, 38, 0.95);
    --panel-border: rgba(133, 155, 188, 0.24);
    --panel-highlight: rgba(108, 176, 255, 0.18);
    --text: #eef4ff;
    --muted: #94a7c5;
    --accent: #6cb0ff;
    --accent-strong: #9bcdff;
    --danger: #ff7c88;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    --radius: 22px;
    --font-sans: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at 16% 16%, rgba(108, 176, 255, 0.16), transparent 24%),
        radial-gradient(circle at 82% 12%, rgba(76, 255, 186, 0.08), transparent 18%),
        linear-gradient(180deg, #080c15 0%, #05070d 100%);
}

body.app-page {
    overflow: hidden;
}

body.auth-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.015), transparent 24%),
        linear-gradient(transparent, rgba(255, 255, 255, 0.01));
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

input,
textarea,
select {
    width: 100%;
    color: var(--text);
    background: rgba(7, 11, 18, 0.84);
    border: 1px solid rgba(133, 155, 188, 0.18);
    border-radius: 14px;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(108, 176, 255, 0.72);
    box-shadow: 0 0 0 4px rgba(108, 176, 255, 0.12);
    background: rgba(10, 15, 24, 0.92);
}

textarea {
    resize: none;
}

a {
    color: var(--accent-strong);
}

.app-shell,
.workspace,
.canvas-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 560px);
    gap: 28px;
    padding: 28px;
}

.auth-hero,
.auth-panel,
.auth-card {
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(14, 21, 33, 0.92) 0%, rgba(10, 15, 24, 0.82) 100%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-hero,
.auth-panel {
    padding: 32px;
}

.auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(circle at top left, rgba(108, 176, 255, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(14, 21, 33, 0.92) 0%, rgba(10, 15, 24, 0.82) 100%);
}

.auth-hero h1 {
    max-width: 14ch;
    font-size: clamp(2.35rem, 5vw, 4.6rem);
    line-height: 0.96;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    justify-content: center;
}

.auth-panel-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-card-grid,
.auth-form,
.account-copy {
    display: flex;
    flex-direction: column;
}

.auth-card-grid {
    gap: 16px;
}

.auth-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
}

.auth-form {
    gap: 14px;
}

.auth-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.auth-copy-large {
    max-width: 44ch;
    font-size: 1.05rem;
}

.auth-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-feature-list span {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(133, 155, 188, 0.18);
    background: rgba(9, 14, 22, 0.68);
    color: var(--text);
    font-size: 0.92rem;
}

.auth-flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(133, 155, 188, 0.18);
    background: rgba(7, 11, 18, 0.62);
    line-height: 1.5;
}

.auth-flash-error {
    border-color: rgba(255, 124, 136, 0.32);
    color: #ffd6db;
}

.auth-flash-info {
    border-color: rgba(108, 176, 255, 0.28);
    color: #dbe9ff;
}

.workspace,
.canvas-shell {
    position: relative;
}

.canvas {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;
    background:
        radial-gradient(circle at top left, rgba(108, 176, 255, 0.12), transparent 24%),
        linear-gradient(rgba(123, 145, 176, 0.075) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123, 145, 176, 0.075) 1px, transparent 1px),
        linear-gradient(180deg, #0a0f18 0%, #070b12 100%);
    background-size: auto, 30px 30px, 30px 30px, auto;
    cursor: grab;
}

.canvas.is-panning {
    cursor: grabbing;
}

.canvas-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(420px, calc(100vw - 40px));
    padding: 26px 28px;
    transform: translate(-50%, -50%);
    border: 1px dashed rgba(133, 155, 188, 0.24);
    border-radius: 22px;
    background: rgba(6, 9, 15, 0.82);
    text-align: center;
    pointer-events: none;
}

.canvas-empty-state h2 {
    margin: 0 0 10px;
    font-size: 1.5rem;
}

.canvas-empty-state p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.overlay-panel {
    position: absolute;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(14, 21, 33, 0.92) 0%, rgba(10, 15, 24, 0.82) 100%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    touch-action: pan-y;
}

.overlay-panel.is-hidden {
    display: none;
}

.overlay-panel.is-collapsed .panel-body {
    display: none;
}

.projects-panel {
    top: 18px;
    left: 18px;
    width: min(320px, calc(100vw - 36px));
    max-height: calc(100vh - 110px);
}

.controls-panel {
    top: 18px;
    left: 50%;
    width: min(860px, calc(100vw - 420px));
    transform: translateX(-50%);
}

.note-viewer-panel {
    top: 18px;
    left: 18px;
    z-index: 24;
    width: min(45vw, 780px);
    max-width: calc(100vw - 36px);
    height: calc(100vh - 36px);
    max-height: calc(100vh - 36px);
    transform: translateX(calc(-100% - 32px));
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
}

.note-viewer-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.inspector-panel {
    top: 18px;
    right: 18px;
    width: min(360px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
}

.canvas-utility-stack {
    position: absolute;
    z-index: 25;
    left: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.canvas-utility-compact {
    gap: 12px;
}

.utility-icon-button {
    min-width: 50px;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1;
}

.utility-center-button {
    min-width: 88px;
}

.floating-zoom-controls {
    display: inline-flex;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(14, 21, 33, 0.92) 0%, rgba(10, 15, 24, 0.82) 100%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.floating-zoom-controls .ghost-button {
    min-width: 48px;
}

.drawer-toggle-button {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 31;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    font-size: 1.15rem;
    transition: transform 180ms ease, opacity 180ms ease;
}

body.drawer-open .drawer-toggle-button {
    opacity: 0;
    pointer-events: none;
    transform: translateX(8px);
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    z-index: 28;
    background: rgba(4, 7, 12, 0.46);
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.workspace-drawer {
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 32;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 16px;
    width: min(392px, calc(100vw - 36px));
    padding: 18px;
    border: 1px solid var(--panel-border);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(14, 21, 33, 0.96) 0%, rgba(10, 15, 24, 0.94) 100%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    overflow: hidden;
    touch-action: pan-y;
    transform: translateX(calc(100% + 30px));
    opacity: 0;
    pointer-events: none;
    transition: transform 220ms ease, opacity 220ms ease;
}

.workspace-drawer.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.drawer-header,
.drawer-body,
.drawer-accordion-body,
.drawer-subsection,
.drawer-note-preview,
.drawer-chip-list {
    display: flex;
    flex-direction: column;
}

.drawer-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.drawer-body {
    flex: 1;
    min-height: 0;
    gap: 14px;
    overflow: auto;
    padding-right: 4px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.drawer-body::-webkit-scrollbar {
    width: 8px;
}

.drawer-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(133, 155, 188, 0.16);
}

.drawer-accordion {
    border: 1px solid rgba(133, 155, 188, 0.14);
    border-radius: 18px;
    background: rgba(7, 11, 18, 0.52);
    overflow: hidden;
}

.drawer-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 0 16px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.drawer-accordion summary::-webkit-details-marker {
    display: none;
}

.drawer-accordion summary::after {
    content: "+";
    color: var(--muted);
    font-size: 1.1rem;
}

.drawer-accordion[open] summary::after {
    content: "−";
}

.drawer-accordion-body {
    min-height: 0;
    gap: 14px;
    padding: 0 16px 16px;
}

.drawer-subsection {
    gap: 10px;
}

.drawer-chip-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
}

.drawer-map-title-input {
    min-width: 0;
    width: 100%;
}

.drawer-note-preview {
    gap: 14px;
}

.drawer-note-preview-header .panel-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.drawer-body .map-list {
    max-height: 260px;
}

.reset-ui-button {
    min-width: 124px;
    justify-content: center;
}

.export-png-button {
    min-width: 124px;
    justify-content: center;
}

.add-image-button {
    min-width: 124px;
    justify-content: center;
}

.user-button {
    min-width: 124px;
    justify-content: center;
}

.panel-header,
.panel-actions,
.topbar,
.topbar-left,
.topbar-actions,
.toolbar,
.toolbar-group,
.inspector-actions,
.editor-toolbar,
.modal-header,
.segmented-control {
    display: flex;
    gap: 12px;
}

.panel-header,
.modal-header {
    align-items: flex-start;
    justify-content: space-between;
}

.panel-body,
.inspector-body,
.inspector-content,
.user-modal-grid,
.user-account-copy,
.share-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}

.projects-panel .panel-body,
.inspector-panel .panel-body {
    overflow: auto;
}

.controls-panel-body {
    gap: 12px;
}

.note-viewer-body {
    flex: 1;
    overflow: hidden;
}

.control-section {
    border: 1px solid rgba(133, 155, 188, 0.12);
    border-radius: 18px;
    background: rgba(8, 12, 18, 0.48);
}

.note-viewer-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.note-viewer-panel .panel-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar,
.toolbar,
.tab-row {
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
}

.topbar,
.toolbar {
    flex-wrap: wrap;
}

.toolbar-group {
    align-items: center;
    flex-wrap: wrap;
}

.tab-row {
    min-height: 58px;
    overflow-x: auto;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
}

.panel-copy,
.map-item-meta,
.empty-copy,
.toolbar-hint,
.editor-help,
.meta-box,
.inspector-empty,
.empty-markdown {
    color: var(--muted);
}

.map-title-input {
    min-width: min(44vw, 540px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: clamp(1.35rem, 2vw, 1.95rem);
    font-weight: 700;
    box-shadow: none;
}

.map-title-input:focus {
    border: 0;
    box-shadow: none;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.9rem;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(108, 176, 255, 0.14);
    color: var(--accent-strong);
    font-size: 0.82rem;
}

.account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(133, 155, 188, 0.16);
    background: rgba(7, 11, 18, 0.62);
}

.account-copy {
    gap: 4px;
    min-width: 0;
}

.account-label,
.account-email {
    color: var(--muted);
}

.account-label {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.account-email {
    font-size: 0.86rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-account-box,
.share-box-header,
.share-url-row {
    display: flex;
    gap: 12px;
}

.user-account-box,
.share-box-header {
    align-items: center;
    justify-content: space-between;
}

.share-box-header {
    align-items: flex-start;
}

.share-url-row {
    align-items: center;
}

.share-url-row input {
    flex: 1;
}

.map-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
}

.map-item,
.tab-chip,
.primary-button,
.ghost-button,
.panel-icon-button,
.segment {
    border: 1px solid transparent;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.map-item,
.tab-chip,
.ghost-button,
.panel-icon-button,
.segment {
    color: var(--text);
    background: rgba(9, 14, 22, 0.68);
    border-color: rgba(133, 155, 188, 0.16);
}

.map-item:hover,
.tab-chip:hover,
.primary-button:hover,
.ghost-button:hover,
.panel-icon-button:hover,
.segment:hover {
    transform: translateY(-1px);
}

.map-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    text-align: left;
    border-radius: 16px;
}

.map-item.active,
.tab-chip.active,
.segment.active {
    border-color: rgba(108, 176, 255, 0.52);
    background: linear-gradient(180deg, rgba(22, 35, 55, 0.98) 0%, rgba(15, 23, 35, 0.98) 100%);
    box-shadow: inset 0 0 0 1px rgba(108, 176, 255, 0.14);
}

.map-item-title {
    font-weight: 600;
}

.primary-button,
.ghost-button,
.tab-chip,
.segment,
.panel-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    font-weight: 600;
}

.primary-button {
    color: #08101a;
    background: linear-gradient(180deg, #8fc7ff 0%, #69afff 100%);
    border-color: rgba(255, 255, 255, 0.06);
}

.full-width {
    width: 100%;
}

.small-button {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 12px;
}

.danger-button {
    color: #ffd7db;
    border-color: rgba(255, 124, 136, 0.28);
}

.panel-icon-button {
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    font-size: 1rem;
}

.toolbar-label {
    color: var(--muted);
    font-size: 0.9rem;
    margin-right: 4px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    color: var(--muted);
    font-size: 0.9rem;
}

.field input:not([type="color"]):not([type="range"]),
.field select {
    min-height: 44px;
    padding: 0 14px;
}

.field input[type="color"] {
    min-height: 44px;
    padding: 4px;
    border-radius: 12px;
}

.field input[type="range"] {
    min-height: 44px;
    padding: 0 8px;
}

.field-grid {
    display: grid;
    gap: 12px;
}

.two-column-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-column-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-box {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(7, 11, 18, 0.52);
    border: 1px solid rgba(133, 155, 188, 0.12);
    font-size: 0.92rem;
    line-height: 1.5;
}

.inspector-empty {
    line-height: 1.6;
}

.edge-layer,
.node-layer {
    position: absolute;
    inset: 0;
}

.edge-layer {
    pointer-events: auto;
}

.node-layer {
    pointer-events: none;
}

.edge-group {
    cursor: pointer;
}

.edge-hitbox {
    fill: none;
    stroke: transparent;
    stroke-width: 18;
}

.edge-visual {
    fill: none;
    stroke: var(--edge-color, #7aa5ff);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    shape-rendering: geometricPrecision;
    filter:
        drop-shadow(0 0 var(--edge-shadow, 0px) rgba(0, 0, 0, 0.45))
        drop-shadow(0 0 var(--edge-glow, 0px) var(--edge-color, #7aa5ff));
}

.edge-visual.edge-style-dashed,
.edge-visual.edge-style-dotted,
.edge-visual.edge-style-straight-dashed {
    animation: edgeFlow var(--edge-flow-duration, 1.5s) linear infinite;
    will-change: stroke-dashoffset;
}

.edge-visual.edge-style-dashed,
.edge-visual.edge-style-straight-dashed {
    --edge-flow-distance: -20;
    --edge-flow-duration: 1.45s;
}

.edge-visual.edge-style-dotted {
    --edge-flow-distance: -14;
    --edge-flow-duration: 1.2s;
}

.edge-group.selected .edge-visual {
    stroke-width: 4;
}

.edge-label {
    fill: var(--edge-color, #dbe9ff);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(7, 11, 16, 0.94);
    stroke-width: 5;
    stroke-linejoin: round;
}

.draft-edge {
    stroke-dasharray: 10 8;
}

.node {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    pointer-events: auto;
    user-select: none;
}

.node-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, transparent 22%),
        var(--node-bg);
    color: var(--node-text);
    box-shadow:
        0 26px 58px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    cursor: grab;
}

.public-share-page .node-card {
    cursor: pointer;
}

.node-card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1.5px;
    border-radius: inherit;
    background: linear-gradient(var(--node-border), var(--node-border));
    pointer-events: none;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.node-card.effect-none::before {
    opacity: 0;
}

.node-card.effect-rgb-led::before {
    background: conic-gradient(from 0deg, #ff4d6d, #ffd54a, #44f2c4, #59a8ff, #c55cff, #ff4d6d);
    filter:
        saturate(1.35)
        drop-shadow(0 0 8px rgba(255, 255, 255, 0.24))
        drop-shadow(0 0 18px rgba(89, 168, 255, 0.26))
        drop-shadow(0 0 28px rgba(255, 77, 109, 0.18));
}

.node-card.effect-rgb-led {
    animation: rgbGlowPulse 2.6s ease-in-out infinite;
    box-shadow:
        0 26px 58px rgba(0, 0, 0, 0.34),
        0 0 14px rgba(255, 77, 109, 0.16),
        0 0 26px rgba(89, 168, 255, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.node-card.effect-matrix-hud::before {
    background:
        linear-gradient(90deg, rgba(72, 255, 148, 0.98), rgba(72, 255, 148, 0.2) 20%, rgba(72, 255, 148, 0.98) 44%, rgba(72, 255, 148, 0.22) 68%, rgba(72, 255, 148, 0.98));
    background-size: 180% 100%;
    filter: drop-shadow(0 0 16px rgba(72, 255, 148, 0.28));
    animation: matrixBorderSweep 3s linear infinite;
}

.node-card.effect-matrix-hud::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: repeating-linear-gradient(0deg, transparent 0 18px, rgba(72, 255, 148, 0.04) 18px 19px);
    opacity: 0.75;
    pointer-events: none;
}

.node-card.effect-glow-pulse::before {
    background: linear-gradient(var(--node-border), var(--node-border));
    filter:
        drop-shadow(0 0 10px var(--node-border))
        drop-shadow(0 0 22px var(--node-border));
    animation: pulseGlow 2.6s ease-in-out infinite;
}

.node-card.effect-neon-corners::before {
    opacity: 0;
}

.node-card.effect-neon-corners::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 14px;
    background:
        linear-gradient(var(--node-border), var(--node-border)) left top / 28px 2px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) left top / 2px 28px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) right top / 28px 2px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) right top / 2px 28px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) left bottom / 28px 2px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) left bottom / 2px 28px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) right bottom / 28px 2px no-repeat,
        linear-gradient(var(--node-border), var(--node-border)) right bottom / 2px 28px no-repeat;
    filter:
        drop-shadow(0 0 8px var(--node-border))
        drop-shadow(0 0 18px rgba(108, 176, 255, 0.22));
    opacity: 0.96;
    pointer-events: none;
    animation: cornersBlink 2.8s ease-in-out infinite;
}

.node-card.effect-prism-flow::before {
    background: linear-gradient(120deg, #ff7bc1, #7ed2ff, #8dffb6, #ffe27a, #ff7bc1);
    background-size: 280% 280%;
    filter:
        saturate(1.22)
        drop-shadow(0 0 12px rgba(126, 210, 255, 0.24))
        drop-shadow(0 0 24px rgba(255, 123, 193, 0.18));
    animation: prismShift 7s linear infinite;
}

.node-card.effect-ember-glow::before {
    background: linear-gradient(135deg, #ffb366, #ff6f3c, #ffd17b);
    filter:
        drop-shadow(0 0 10px rgba(255, 111, 60, 0.34))
        drop-shadow(0 0 24px rgba(255, 180, 77, 0.24));
    animation: emberBorderFlicker 2.2s steps(2, end) infinite;
}

.node-card.effect-ember-glow::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 16% 88%, rgba(255, 118, 58, 0.3), transparent 36%),
        radial-gradient(circle at 84% 16%, rgba(255, 212, 120, 0.24), transparent 30%);
    opacity: 0.8;
    pointer-events: none;
    animation: emberHalo 3.2s ease-in-out infinite;
}

.node-card.effect-frost-edge::before {
    background: linear-gradient(135deg, #d9f6ff, #79d6ff, #effdff);
    filter:
        drop-shadow(0 0 12px rgba(121, 214, 255, 0.24))
        drop-shadow(0 0 22px rgba(214, 247, 255, 0.18));
}

.node-card.effect-frost-edge::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 28%),
        repeating-linear-gradient(135deg, transparent 0 12px, rgba(217, 246, 255, 0.06) 12px 14px, transparent 14px 24px);
    opacity: 0.82;
    pointer-events: none;
    animation: frostShimmer 4.8s linear infinite;
}

.node-card.effect-hazard-stripe::before {
    background: repeating-linear-gradient(135deg, #ffd35a 0 12px, #161208 12px 24px);
    background-size: 140% 140%;
    filter:
        drop-shadow(0 0 12px rgba(255, 211, 90, 0.2))
        drop-shadow(0 0 22px rgba(0, 0, 0, 0.24));
    animation: hazardMove 3.2s linear infinite;
}

.node-card.effect-circuit-board::before {
    background:
        repeating-linear-gradient(90deg, rgba(125, 255, 176, 0.98) 0 8px, transparent 8px 22px),
        repeating-linear-gradient(180deg, rgba(125, 255, 176, 0.42) 0 6px, transparent 6px 18px);
    background-size: 180% 100%, 100% 160%;
    filter:
        drop-shadow(0 0 10px rgba(125, 255, 176, 0.26))
        drop-shadow(0 0 18px rgba(125, 255, 176, 0.16));
    animation: circuitPulse 4s linear infinite;
}

.node-card.effect-circuit-board::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 14% 18%, rgba(125, 255, 176, 0.96) 0 2px, transparent 3px),
        radial-gradient(circle at 86% 24%, rgba(125, 255, 176, 0.96) 0 2px, transparent 3px),
        radial-gradient(circle at 26% 82%, rgba(125, 255, 176, 0.92) 0 2px, transparent 3px),
        radial-gradient(circle at 78% 76%, rgba(125, 255, 176, 0.92) 0 2px, transparent 3px);
    opacity: 0.94;
    pointer-events: none;
    animation: circuitNodes 2.4s steps(2, end) infinite;
}

.node-card.effect-solar-flare::before {
    background: linear-gradient(135deg, #fff0a8, #ffb046, #ff6d3d, #fff0a8);
    background-size: 220% 220%;
    filter:
        drop-shadow(0 0 12px rgba(255, 176, 70, 0.3))
        drop-shadow(0 0 28px rgba(255, 109, 61, 0.18));
    animation: solarPulse 3.4s ease-in-out infinite;
}

.node-card.effect-solar-flare::after {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 50% -12%, rgba(255, 236, 153, 0.28), transparent 44%),
        radial-gradient(circle at 12% 100%, rgba(255, 136, 84, 0.2), transparent 30%);
    opacity: 0.82;
    pointer-events: none;
    animation: solarPulse 3.4s ease-in-out infinite reverse;
}

.node-card.effect-blueprint-grid::before {
    background: linear-gradient(90deg, #6cd9ff, #8bbdff);
    filter:
        drop-shadow(0 0 10px rgba(108, 217, 255, 0.22))
        drop-shadow(0 0 18px rgba(139, 189, 255, 0.16));
}

.node-card.effect-blueprint-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(90deg, transparent 0 11px, rgba(108, 217, 255, 0.08) 11px 12px, transparent 12px),
        linear-gradient(transparent 0 11px, rgba(108, 217, 255, 0.08) 11px 12px, transparent 12px);
    background-size: 28px 28px;
    opacity: 0.72;
    pointer-events: none;
}

.node-card.effect-velvet-aura::before {
    background: linear-gradient(135deg, #ff92d3, #9e7dff, #6bd8ff);
    background-size: 220% 220%;
    filter:
        drop-shadow(0 0 12px rgba(158, 125, 255, 0.22))
        drop-shadow(0 0 24px rgba(255, 146, 211, 0.18));
    animation: velvetBreathe 4.6s ease-in-out infinite;
}

.node-card.effect-velvet-aura::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 24%, rgba(255, 146, 211, 0.18), transparent 34%),
        radial-gradient(circle at 78% 74%, rgba(107, 216, 255, 0.16), transparent 30%);
    opacity: 0.88;
    pointer-events: none;
}

.node-card.effect-glitch-frame::before {
    background: linear-gradient(90deg, #6ce8ff, #ff72be, #6ce8ff);
    filter:
        drop-shadow(0 0 10px rgba(108, 232, 255, 0.2))
        drop-shadow(0 0 20px rgba(255, 114, 190, 0.16));
    animation: glitchBorder 2.4s steps(2, end) infinite;
}

.node-card.effect-glitch-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(transparent 0 18%, rgba(255, 114, 190, 0.06) 18% 22%, transparent 22% 52%, rgba(108, 232, 255, 0.08) 52% 56%, transparent 56%),
        linear-gradient(90deg, transparent 0 48%, rgba(255, 255, 255, 0.04) 48% 52%, transparent 52%);
    opacity: 0.84;
    mix-blend-mode: screen;
    pointer-events: none;
    animation: glitchScan 1.6s steps(3, end) infinite;
}

.node.selected .node-card {
    box-shadow:
        0 0 0 1px rgba(108, 176, 255, 0.44),
        0 28px 64px rgba(0, 0, 0, 0.48),
        0 0 34px rgba(108, 176, 255, 0.12);
}

.node.selected .node-card.effect-rgb-led {
    box-shadow:
        0 0 0 1px rgba(108, 176, 255, 0.44),
        0 28px 64px rgba(0, 0, 0, 0.48),
        0 0 20px rgba(255, 77, 109, 0.22),
        0 0 38px rgba(89, 168, 255, 0.2);
}

.node-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.node-title {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(133, 155, 188, 0.18);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-not-started {
    color: #b7c5db;
    background: rgba(133, 155, 188, 0.12);
}

.status-in-progress {
    color: #8fd1ff;
    background: rgba(108, 176, 255, 0.14);
    border-color: rgba(108, 176, 255, 0.24);
}

.status-conflict {
    color: #ffb5bd;
    background: rgba(255, 124, 136, 0.14);
    border-color: rgba(255, 124, 136, 0.24);
}

.status-completed {
    color: #7bf0b0;
    background: rgba(90, 217, 143, 0.14);
    border-color: rgba(90, 217, 143, 0.24);
}

.status-archived {
    color: #d6c4ff;
    background: rgba(172, 147, 255, 0.14);
    border-color: rgba(172, 147, 255, 0.24);
}

.node-content {
    flex: 1;
    overflow: auto;
    padding: 12px 16px 18px;
    font-size: 0.9rem;
    line-height: 1.48;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.node-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.node-content.is-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
}

.node-image-frame {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(133, 155, 188, 0.12);
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(108, 176, 255, 0.08), transparent 42%),
        rgba(7, 11, 18, 0.72);
    overflow: hidden;
}

.node-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.node-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.connector-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid #081018;
    border-radius: 999px;
    background: linear-gradient(180deg, #8ec5ff 0%, #68afff 100%);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.34);
    cursor: crosshair;
    z-index: 3;
    opacity: 0.3;
    transition: opacity 140ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.node:hover .connector-handle,
.node.selected .connector-handle,
.connector-handle:focus-visible {
    opacity: 1;
}

.connector-handle:hover {
    box-shadow:
        0 12px 22px rgba(0, 0, 0, 0.34),
        0 0 18px rgba(104, 175, 255, 0.34);
}

.connector-right {
    top: 50%;
    right: -11px;
    transform: translateY(-50%);
}

.connector-left {
    top: 50%;
    left: -11px;
    transform: translateY(-50%);
}

.connector-top {
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
}

.connector-bottom {
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
}

.connector-right:hover,
.connector-left:hover {
    transform: translateY(-50%) scale(1.08);
}

.connector-top:hover,
.connector-bottom:hover {
    transform: translateX(-50%) scale(1.08);
}

.note-viewer-content {
    flex: 1;
    min-height: 0;
    padding: 20px 22px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(133, 155, 188, 0.12);
    border-radius: 18px;
    background: rgba(8, 12, 18, 0.52);
    font-size: 1rem;
    line-height: 1.65;
}

.note-viewer-content.is-image-view {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    overflow: hidden;
}

.note-viewer-image-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(133, 155, 188, 0.14);
    border-radius: 18px;
    background:
        radial-gradient(circle at top left, rgba(108, 176, 255, 0.08), transparent 40%),
        rgba(7, 11, 18, 0.82);
    overflow: hidden;
}

.note-viewer-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}

.code-block {
    max-width: 100%;
    min-width: 0;
    margin: 0 0 0.9em;
    border: 1px solid rgba(133, 155, 188, 0.15);
    border-radius: 14px;
    background: rgba(7, 11, 18, 0.8);
    overflow: hidden;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(133, 155, 188, 0.12);
    background: rgba(255, 255, 255, 0.03);
}

.code-language {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.code-copy-button {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(108, 176, 255, 0.18);
    border-radius: 999px;
    color: var(--text);
    background: rgba(10, 16, 26, 0.7);
}

.task-list {
    padding-left: 0;
    list-style: none;
}

.task-list-item + .task-list-item {
    margin-top: 0.55rem;
}

.task-list-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    margin: 0.08rem 0 0;
    accent-color: #7bf0b0;
    cursor: default;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.resize-handle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 16px;
    height: 16px;
    border-right: 2px solid rgba(255, 255, 255, 0.62);
    border-bottom: 2px solid rgba(255, 255, 255, 0.62);
    border-bottom-right-radius: 4px;
    opacity: 0.84;
    cursor: nwse-resize;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 7, 12, 0.72);
    backdrop-filter: blur(10px);
}

.modal-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 22px;
    overflow: auto;
    border: 1px solid rgba(133, 155, 188, 0.34);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(12, 18, 28, 0.97) 0%, rgba(9, 14, 22, 0.95) 100%);
    box-shadow: var(--shadow);
    transform: translate(-50%, -50%);
}

.user-modal-panel {
    width: min(620px, calc(100vw - 32px));
}

.share-actions {
    flex-wrap: wrap;
}

.ghost-button.is-disabled,
.ghost-button[aria-disabled="true"] {
    opacity: 0.55;
    pointer-events: none;
}

.public-header-panel {
    top: 18px;
    right: 18px;
    width: min(460px, calc(100vw - 36px));
}

.editor-body {
    min-height: 420px;
}

.editor-textarea,
.editor-preview {
    min-height: 420px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(133, 155, 188, 0.18);
    background: rgba(7, 11, 18, 0.84);
}

.editor-preview {
    overflow: auto;
}

@media (hover: none) and (pointer: coarse) {
    .connector-handle {
        width: 26px;
        height: 26px;
        opacity: 0.74;
    }

    .connector-right {
        right: -13px;
    }

    .connector-left {
        left: -13px;
    }

    .connector-top {
        top: -13px;
    }

    .connector-bottom {
        bottom: -13px;
    }

    .resize-handle {
        right: 8px;
        bottom: 8px;
        width: 22px;
        height: 22px;
    }
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 80;
    max-width: min(360px, calc(100vw - 36px));
    padding: 14px 16px;
    border: 1px solid rgba(108, 176, 255, 0.24);
    border-radius: 16px;
    background: rgba(8, 12, 18, 0.94);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
}

.toast[data-tone="error"] {
    border-color: rgba(255, 124, 136, 0.32);
}

.markdown-body > *:first-child {
    margin-top: 0;
}

.markdown-body > *:last-child {
    margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 0 0 0.65em;
    line-height: 1.2;
}

.markdown-body h1 {
    font-size: 1.3em;
}

.markdown-body h2 {
    font-size: 1.16em;
}

.markdown-body h3 {
    font-size: 1.05em;
}

.markdown-body p,
.markdown-body ul,
.markdown-body .code-block {
    margin: 0 0 0.9em;
}

.markdown-body ul {
    padding-left: 1.15rem;
}

.markdown-body code,
.markdown-body pre {
    font-family: var(--font-mono);
}

.markdown-body code {
    padding: 0.12rem 0.35rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.markdown-body pre {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0.95rem 1rem;
    overflow: auto;
    background: transparent;
    box-sizing: border-box;
}

.markdown-body pre code {
    display: block;
    padding: 0;
    background: transparent;
}

[hidden] {
    display: none !important;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@keyframes matrixBorderSweep {
    from {
        background-position: 0% 50%;
    }

    to {
        background-position: 180% 50%;
    }
}

@keyframes pulseGlow {
    0%,
    100% {
        opacity: 0.9;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.005);
    }
}

@keyframes rgbGlowPulse {
    0%,
    100% {
        box-shadow:
            0 26px 58px rgba(0, 0, 0, 0.34),
            0 0 12px rgba(255, 77, 109, 0.14),
            0 0 24px rgba(89, 168, 255, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    50% {
        box-shadow:
            0 26px 58px rgba(0, 0, 0, 0.34),
            0 0 18px rgba(255, 77, 109, 0.24),
            0 0 34px rgba(89, 168, 255, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }
}

@keyframes cornersBlink {
    0%,
    100% {
        opacity: 0.84;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.01);
    }
}

@keyframes prismShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes emberBorderFlicker {
    0%,
    100% {
        opacity: 0.94;
        transform: scale(1);
    }

    40% {
        opacity: 0.82;
        transform: scale(1.002);
    }

    70% {
        opacity: 1;
        transform: scale(1.006);
    }
}

@keyframes emberHalo {
    0%,
    100% {
        opacity: 0.64;
        transform: scale(0.98);
    }

    50% {
        opacity: 0.92;
        transform: scale(1.02);
    }
}

@keyframes frostShimmer {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 0 0, 48px 0;
    }
}

@keyframes hazardMove {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 48px 0;
    }
}

@keyframes circuitPulse {
    0%,
    100% {
        background-position: 0 0, 0 0;
        opacity: 0.9;
    }

    50% {
        background-position: 42px 0, 0 30px;
        opacity: 1;
    }
}

@keyframes circuitNodes {
    0%,
    100% {
        opacity: 0.56;
    }

    50% {
        opacity: 1;
    }
}

@keyframes solarPulse {
    0%,
    100% {
        opacity: 0.86;
        background-position: 0% 50%;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        background-position: 100% 50%;
        transform: scale(1.012);
    }
}

@keyframes velvetBreathe {
    0%,
    100% {
        opacity: 0.88;
        background-position: 0% 50%;
    }

    50% {
        opacity: 1;
        background-position: 100% 50%;
    }
}

@keyframes glitchBorder {
    0%,
    100% {
        transform: translate(0, 0);
        opacity: 0.9;
    }

    25% {
        transform: translate(1px, -1px);
        opacity: 1;
    }

    50% {
        transform: translate(-1px, 1px);
        opacity: 0.82;
    }

    75% {
        transform: translate(1px, 1px);
        opacity: 0.96;
    }
}

@keyframes glitchScan {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 0 22px, 22px 0;
    }
}

@keyframes edgeFlow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: var(--edge-flow-distance, -20);
    }
}

@media (max-width: 1360px) {
    .controls-panel {
        width: min(760px, calc(100vw - 420px));
    }

    .note-viewer-panel {
        width: min(50vw, 720px);
    }
}

@media (max-width: 1120px) {
    .projects-panel,
    .inspector-panel,
    .controls-panel {
        width: min(360px, calc(100vw - 36px));
        transform: none;
    }

    .public-header-panel {
        width: min(360px, calc(100vw - 36px));
    }

    .controls-panel {
        top: auto;
        bottom: 18px;
        left: 50%;
        transform: translateX(-50%);
    }

    .note-viewer-panel {
        width: min(56vw, calc(100vw - 54px));
    }
}

@media (max-width: 760px) {
    .auth-shell {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .auth-hero,
    .auth-panel {
        padding: 22px;
    }

    .overlay-panel {
        gap: 12px;
        padding: 14px;
        border-radius: 20px;
    }

    .projects-panel,
    .controls-panel,
    .inspector-panel,
    .note-viewer-panel,
    .public-header-panel {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }

    .projects-panel,
    .controls-panel,
    .inspector-panel {
        transform: none;
    }

    .projects-panel {
        top: 12px;
        max-height: 28vh;
    }

    .controls-panel {
        top: auto;
        bottom: 108px;
        max-height: 34vh;
    }

    .controls-panel .panel-body {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .inspector-panel {
        top: auto;
        bottom: 12px;
        max-height: 38vh;
    }

    .note-viewer-panel {
        top: 12px;
        bottom: 12px;
        height: auto;
        max-height: none;
        transform: translateX(calc(-100% - 18px));
    }

    .public-header-panel {
        top: 12px;
    }

    .note-viewer-panel.is-open {
        transform: translateX(0);
    }

    .canvas-utility-stack {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: stretch;
    }

    .floating-zoom-controls {
        width: 100%;
        gap: 8px;
        padding: 8px;
        justify-content: center;
    }

    .floating-zoom-controls .ghost-button {
        flex: 1 1 0;
        min-height: 46px;
    }

    .canvas-utility-stack > .ghost-button {
        flex: 1 1 148px;
        min-height: 46px;
    }

    .topbar,
    .toolbar,
    .topbar-left,
    .topbar-actions,
    .inspector-actions,
    .user-account-box,
    .share-box-header,
    .share-url-row,
    .two-column-grid,
    .three-column-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions > *,
    .inspector-actions > *,
    .share-url-row > * {
        width: 100%;
    }

    .map-title-input {
        min-width: 0;
        width: 100%;
    }

    .modal-panel {
        top: 12px;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: none;
        transform: none;
    }

    .editor-body,
    .editor-textarea,
    .editor-preview {
        min-height: 320px;
    }
}

@media (max-width: 980px) {
    .workspace-drawer {
        width: min(420px, calc(100vw - 28px));
        top: 14px;
        right: 14px;
        bottom: 14px;
    }

    .drawer-toggle-button {
        top: 14px;
        right: 14px;
    }
}

@media (max-width: 760px) {
    body.auth-page {
        min-height: 100dvh;
    }

    .auth-shell {
        min-height: 100dvh;
        padding: 16px;
        gap: 16px;
    }

    .auth-hero,
    .auth-panel,
    .auth-card {
        border-radius: 22px;
    }

    .auth-panel {
        justify-content: flex-start;
    }

    .auth-hero h1 {
        max-width: none;
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .workspace-drawer {
        top: max(12px, env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
        left: max(12px, env(safe-area-inset-left));
        width: auto;
        height: min(72dvh, 760px);
        max-height: min(72dvh, 760px);
        padding: 16px;
        border-radius: 22px;
        transform: translateY(calc(100% + 32px));
    }

    .workspace-drawer.is-open {
        transform: translateY(0);
    }

    .drawer-header {
        align-items: center;
    }

    .drawer-body {
        padding-right: 0;
    }

    .drawer-accordion summary {
        min-height: 50px;
        padding: 0 14px;
    }

    .drawer-accordion-body {
        padding: 0 14px 14px;
    }

    .drawer-body .map-list {
        max-height: none;
    }

    .canvas-utility-stack.canvas-utility-compact {
        left: 12px;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 8px;
    }

    .canvas-utility-stack.canvas-utility-compact > .ghost-button {
        flex: 1 1 0;
        min-height: 46px;
    }

    .canvas-utility-stack.canvas-utility-compact > .utility-icon-button {
        flex: 0 0 64px;
    }

    .canvas-utility-stack.canvas-utility-compact > .utility-center-button {
        flex: 1 1 calc(50% - 8px);
    }

    .canvas-utility-stack.canvas-utility-compact .floating-zoom-controls {
        width: 100%;
        justify-content: stretch;
    }

    .canvas-utility-stack.canvas-utility-compact .floating-zoom-controls .ghost-button {
        flex: 1 1 0;
    }

    .drawer-toggle-button {
        top: max(12px, env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
        min-width: 46px;
        min-height: 46px;
    }

    .inspector-actions,
    .share-url-row,
    .user-account-box,
    .share-box-header {
        flex-direction: column;
        align-items: stretch;
    }

    .inspector-actions > *,
    .share-url-row > *,
    .share-actions > * {
        width: 100%;
    }

    .two-column-grid,
    .three-column-grid {
        grid-template-columns: 1fr;
    }

    .note-viewer-content {
        padding: 16px;
    }

    .toast {
        left: 12px;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        max-width: none;
    }
}
