:root {
    --bg-whiteboard: #f8fafc;
    --border-frame: #475569;
    --border-subtle: #cbd5e1;
    --text-ink: #0f172a;
    --text-dim: #475569;
    --text-muted: #64748b;
    --color-sub: #0284c7; --bg-sub: #f0f9ff; --text-sub: #0369a1;
    --color-vrb: #e11d48; --bg-vrb: #fff1f2; --text-vrb: #be123c;
    --color-adj: #059669; --bg-adj: #ecfdf5; --text-adj: #047857;
    --color-oth: #d97706; --bg-oth: #fffbeb; --text-oth: #b45309;
    --board-card-height: 72px;
    --board-card-font: 28px;
    --board-card-fixed-width: 175px;
    --board-card-padding: 0 20px;
    --card-gap: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
html {
    height: 100%;
    height: 100dvh;
}
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-whiteboard);
    background-image: 
        linear-gradient(rgba(203, 213, 225, 0.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(203, 213, 225, 0.35) 1px, transparent 1px);
    background-size: 48px 48px;
    color: var(--text-ink);
    height: 100%;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    touch-action: none;
}
.workspace {
    width: 100vw;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
    display: flex;
}
aside.word-bank {
    width: max-content;
    max-width: 48vw;
    min-width: 250px;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 30;
    padding: 0.75rem 0.6rem calc(0.75rem + var(--safe-bottom)) 0.85rem;
    overflow: hidden;
    position: relative;
}
.filter-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
    z-index: 35;
}
.filter-tab {
    background: transparent;
    border: 1.5px solid rgba(148, 163, 184, 0.45);
    color: var(--text-dim);
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
}
.filter-tab:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--border-frame);
    color: var(--text-ink);
}
.filter-tab.active {
    background: rgba(71, 85, 105, 0.16);
    border-color: #334155;
    color: #0f172a;
    box-shadow: none;
}
.bank-list-wrapper {
    flex: 1;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.bank-list {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(24, minmax(0, 1fr));
    gap: 3px 5px;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    align-content: stretch;
}
.bank-chip {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1.5px solid #94a3b8;
    border-radius: 6px;
    padding: 0 var(--chip-padding-x, 6px);
    font-size: var(--chip-font-size, 12.5px);
    font-weight: 700;
    color: var(--text-ink);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: transform 0.1s, box-shadow 0.1s;
    height: 100%;
    min-height: 0;
}
.bank-chip:active {
    cursor: grabbing;
    transform: scale(0.96);
}
body.show-classes .bank-chip.cat-sub { border-color: var(--color-sub); background: rgba(240, 249, 255, 0.88); color: var(--text-sub); }
body.show-classes .bank-chip.cat-vrb { border-color: var(--color-vrb); background: rgba(255, 241, 242, 0.88); color: var(--text-vrb); }
body.show-classes .bank-chip.cat-adj { border-color: var(--color-adj); background: rgba(236, 253, 245, 0.88); color: var(--text-adj); }
body.show-classes .bank-chip.cat-oth { border-color: var(--color-oth); background: rgba(255, 251, 235, 0.88); color: var(--text-oth); }

main.board-area {
    flex: 1;
    height: 100%;
    background: transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.board-viewport {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
}
.whiteboard-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.board-card {
    position: absolute;
    height: var(--board-card-height);
    background: #fff;
    background-image: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.3) 40%, rgba(0,0,0,0.02) 100%);
    border: 2.5px solid #475569;
    outline: 3px solid rgba(255,255,255,0.85);
    outline-offset: 1px;
    border-radius: 8px;
    color: var(--text-ink);
    font-size: var(--board-card-font);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    box-shadow: 0 6px 14px rgba(15,23,42,0.16), 0 2px 4px rgba(15,23,42,0.08), inset 0 1px 0 #fff;
    cursor: grab;
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
    z-index: 10;
}
.board-card.magnet-displaced {
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1) !important;
}
.board-card.dragging { transition: none !important; z-index: 100 !important; }
body.card-mode-equal .board-card {
    width: var(--board-card-fixed-width);
    min-width: var(--board-card-fixed-width);
    max-width: var(--board-card-fixed-width);
    padding: 0 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.card-mode-fit .board-card {
    width: auto;
    min-width: 105px;
    padding: var(--board-card-padding);
    white-space: nowrap;
}
body.show-classes .board-card.cat-sub { border-color: var(--color-sub); background: var(--bg-sub); color: var(--text-sub); }
body.show-classes .board-card.cat-vrb { border-color: var(--color-vrb); background: var(--bg-vrb); color: var(--text-vrb); }
body.show-classes .board-card.cat-adj { border-color: var(--color-adj); background: var(--bg-adj); color: var(--text-adj); }
body.show-classes .board-card.cat-oth { border-color: var(--color-oth); background: var(--bg-oth); color: var(--text-oth); }
.board-card.sentence-valid {
    border-color: #10b981 !important;
    box-shadow: 0 8px 18px rgba(16,185,129,0.25), 0 0 0 2px rgba(16,185,129,0.35) !important;
}
.board-card .class-label {
    display: none;
    position: absolute;
    bottom: 3px;
    right: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0.85;
}
body.show-classes .board-card .class-label { display: block; }
.class-label:empty { display: none !important; }
.drag-proxy {
    position: fixed;
    pointer-events: none;
    touch-action: none;
    z-index: 9999;
    transform: translate(-50%, -50%) scale(1.03);
    box-shadow: 0 16px 28px -4px rgba(15,23,42,0.25), 0 8px 12px -2px rgba(15,23,42,0.12), 0 0 0 2.5px #0284c7;
    opacity: 0.97;
    transition: transform 0.1s cubic-bezier(0.2,0.8,0.2,1), box-shadow 0.15s ease, border-color 0.15s ease !important;
}
.drag-proxy.magnetic-lock {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow: 0 0 0 3.5px #0284c7, 0 18px 36px rgba(2, 132, 199, 0.35), 0 0 24px rgba(56, 189, 248, 0.45);
    border-color: #0284c7 !important;
}

/* Floating Transparent Bottom-Right Dock Overlay */
footer.bottom-dock {
    position: fixed;
    bottom: calc(0.85rem + var(--safe-bottom));
    right: 1rem;
    background: transparent;
    border: none;
    box-shadow: none;
    height: auto;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    z-index: 100;
    pointer-events: auto;
}
.btn-dock {
    background: transparent;
    border: 1.5px solid rgba(71, 85, 105, 0.35);
    color: var(--text-ink);
    padding: 0.35rem 0.75rem;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 36px;
    transition: all 0.15s ease;
    box-shadow: none;
}
.btn-dock:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(71, 85, 105, 0.65);
}
.btn-dock:active {
    transform: scale(0.96);
}
.btn-dock.active {
    background: transparent;
    border-color: #334155;
    color: #0f172a;
}
.btn-dock .dot-indicator {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    transition: background 0.15s ease;
}
.btn-dock:not(.active) .dot-indicator {
    background: #94a3b8;
}

/* Transparent Search Input */
.bank-search {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.bank-search input {
    background: transparent;
    border: 1.5px solid rgba(71, 85, 105, 0.35);
    color: var(--text-ink);
    padding: 0.35rem 0.75rem 0.35rem 1.9rem;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    outline: none;
    height: 36px;
    width: 130px;
    transition: all 0.2s ease;
    box-shadow: none;
}
.bank-search input:focus {
    width: 170px;
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--color-sub);
}
.bank-search svg {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

/* Transparent Zoom Controls */
.dock-zoom {
    display: flex;
    align-items: center;
    background: transparent;
    border: 1.5px solid rgba(71, 85, 105, 0.35);
    border-radius: 9px;
    overflow: hidden;
    height: 36px;
    box-shadow: none;
}
.dock-zoom .zoom-btn {
    background: transparent;
    border: none;
    color: var(--text-ink);
    width: 30px;
    height: 100%;
    cursor: pointer;
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.dock-zoom .zoom-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}
.dock-zoom .zoom-val {
    padding: 0 0.3rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-dim);
    min-width: 40px;
    text-align: center;
}

.success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16,185,129,0.2);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    pointer-events: none;
}
.success-overlay.show { display: flex; }
.success-card {
    background: #fff;
    border: 3px solid #10b981;
    padding: 2rem 3.5rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}
.success-card h2 { font-size: 2.2rem; font-weight: 800; color: #059669; margin-bottom: 0.35rem; }
.success-card p { font-size: 1.25rem; color: var(--text-ink); font-weight: 700; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff;
    border: 2px solid var(--border-frame);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    padding: 1.75rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.4rem; }
.modal p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1.25rem; }
.modal-form { display: flex; flex-direction: column; gap: 0.85rem; }
.form-group label { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.35rem; display: block; }
.form-control {
    width: 100%;
    background: #fff;
    border: 1.5px solid var(--border-frame);
    color: var(--text-ink);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
}
.modal-buttons { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

/* File Import Syntax Guide & Example */
.file-syntax-guide {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}
.syntax-badge-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}
.syntax-badge {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.35rem 0.55rem;
    border-radius: 7px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.syntax-badge code {
    font-weight: 800;
    font-family: monospace;
    font-size: 0.85rem;
    background: rgba(0,0,0,0.06);
    padding: 1px 4px;
    border-radius: 4px;
}
.syntax-sub { background: var(--bg-sub); color: var(--text-sub); border: 1.5px solid var(--color-sub); }
.syntax-vrb { background: var(--bg-vrb); color: var(--text-vrb); border: 1.5px solid var(--color-vrb); }
.syntax-adj { background: var(--bg-adj); color: var(--text-adj); border: 1.5px solid var(--color-adj); }
.syntax-oth { background: var(--bg-oth); color: var(--text-oth); border: 1.5px solid var(--color-oth); }

.syntax-example-box {
    background: #f8fafc;
    border: 1.5px solid var(--border-frame);
    border-radius: 9px;
    padding: 0.75rem 0.85rem;
}
.syntax-example-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-ink);
}
.btn-download-example {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: #0284c7;
    text-decoration: none;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.25);
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-download-example:hover {
    background: rgba(2, 132, 199, 0.16);
    border-color: rgba(2, 132, 199, 0.4);
}
.syntax-code {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-family: monospace;
    font-size: 0.84rem;
    color: #1e293b;
    margin: 0;
    line-height: 1.45;
    user-select: all;
}
.syntax-tip {
    font-size: 0.78rem !important;
    color: var(--text-dim) !important;
    margin: 0 !important;
}

@media (max-width: 900px) {
    footer.bottom-dock { flex-wrap: wrap; justify-content: flex-end; }
    aside.word-bank { max-width: 55vw; }
}

