/*
 * Vigenère Decoder — Cryptographic Archive UI
 * Scoped to #vcd-app so it can safely live inside WordPress/Kadence.
 */

#vcd-app,
#vcd-app * {
    box-sizing: border-box;
}

#vcd-app {
    --vcd-bg: #0B1016;
    --vcd-bg-2: #111923;
    --vcd-surface: #17212C;
    --vcd-surface-2: #1D2935;
    --vcd-border: #293541;
    --vcd-border-strong: #35434F;
    --vcd-text: #F1EEE6;
    --vcd-text-2: #B7B9B5;
    --vcd-muted: #7F8993;
    --vcd-accent: #C9A45C;
    --vcd-accent-light: #E2C887;
    --vcd-accent-dark: #8F713B;
    --vcd-success: #6FA37A;
    --vcd-warning: #C69A4A;
    --vcd-error: #B85C5C;
    --vcd-info: #718DA8;
    --vcd-radius-sm: 4px;
    --vcd-radius-md: 6px;
    --vcd-shadow: 0 18px 60px rgba(0,0,0,.24);
    --vcd-heading: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --vcd-font: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    position: relative;
    width: min(1120px, 100%);
    margin: 32px auto;
    overflow: hidden;
    color: var(--vcd-text);
    background:
        linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px),
        var(--vcd-bg);
    background-size: 44px 44px;
    border: 1px solid var(--vcd-border);
    box-shadow: var(--vcd-shadow);
    font-family: var(--vcd-font);
    line-height: 1.55;
    isolation: isolate;
}

#vcd-app.vcd-theme-light {
    --vcd-bg: #0B1016;
    --vcd-bg-2: #111923;
    --vcd-surface: #17212C;
    --vcd-surface-2: #1D2935;
    --vcd-border: #293541;
    --vcd-border-strong: #35434F;
    --vcd-text: #F1EEE6;
    --vcd-text-2: #B7B9B5;
    --vcd-muted: #7F8993;
    --vcd-accent: #C9A45C;
    --vcd-accent-light: #E2C887;
    --vcd-accent-dark: #8F713B;
    --vcd-success: #6FA37A;
    --vcd-warning: #C69A4A;
    --vcd-error: #B85C5C;
    --vcd-info: #718DA8;
}

#vcd-app button,
#vcd-app input,
#vcd-app select,
#vcd-app textarea {
    font: inherit;
}

#vcd-app button {
    margin: 0;
}

.vcd-header {
    min-height: 126px;
    padding: 30px 34px;
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    background: var(--vcd-bg-2);
    border-bottom: 1px solid var(--vcd-border);
}

.vcd-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 148px;
    height: 2px;
    background: var(--vcd-accent);
}

.vcd-brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 7px;
    border: 1px solid var(--vcd-accent-dark);
    background: rgba(201,164,92,.06);
}

.vcd-brand-mark span {
    border: 1px solid rgba(201,164,92,.65);
    background: rgba(201,164,92,.13);
}

.vcd-brand-mark span:nth-child(2) {
    background: var(--vcd-accent);
}

.vcd-brand-copy {
    min-width: 0;
}

.vcd-eyebrow,
.vcd-section-kicker {
    margin: 0 0 3px;
    color: var(--vcd-accent);
    font-family: var(--vcd-font);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.vcd-title {
    margin: 0;
    color: var(--vcd-text) !important;
    font-family: var(--vcd-heading) !important;
    font-size: clamp(24px, 3vw, 34px) !important;
    font-weight: 650 !important;
    line-height: 1.08 !important;
    letter-spacing: -.025em;
}

.vcd-subtitle {
    margin: 6px 0 0;
    color: var(--vcd-text-2) !important;
    font-size: 14px;
}

.vcd-header-status {
    margin-left: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    color: var(--vcd-muted);
    border: 1px solid var(--vcd-border);
    background: rgba(255,255,255,.015);
    font-size: 11px;
    white-space: nowrap;
}

.vcd-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--vcd-success);
    box-shadow: 0 0 0 3px rgba(111,163,122,.10);
}

.vcd-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(17,25,35,.92);
    border-bottom: 1px solid var(--vcd-border);
}

.vcd-tabs::-webkit-scrollbar { display: none; }

.vcd-tab {
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    padding: 0 22px;
    border: 0 !important;
    border-right: 1px solid var(--vcd-border) !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--vcd-muted) !important;
    font-size: 13px !important;
    font-weight: 650 !important;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
}

.vcd-tab:hover {
    color: var(--vcd-text) !important;
    background: rgba(255,255,255,.025) !important;
}

.vcd-tab.active {
    color: var(--vcd-text) !important;
    background: var(--vcd-bg) !important;
    box-shadow: inset 0 -2px 0 var(--vcd-accent);
}

.vcd-tab-index {
    color: var(--vcd-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
}

.vcd-panel {
    display: none;
    padding: 34px;
    background: rgba(11,16,22,.82);
}

.vcd-panel.active {
    display: block;
}

.vcd-tool-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.vcd-tool-heading h3,
.vcd-reference > h3,
.vcd-reference h4 {
    margin: 0;
    color: var(--vcd-text) !important;
    font-family: var(--vcd-heading) !important;
}

.vcd-tool-heading h3 {
    font-size: clamp(22px, 2.4vw, 30px) !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    letter-spacing: -.02em;
}

.vcd-tool-note {
    margin: 0 0 2px;
    max-width: 330px;
    color: var(--vcd-muted);
    font-size: 12px;
    text-align: right;
}

.vcd-cipher-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
    border: 1px solid var(--vcd-border);
    background: var(--vcd-bg-2);
}

.vcd-workspace,
.vcd-output-panel {
    min-width: 0;
    padding: 25px;
}

.vcd-workspace {
    border-right: 1px solid var(--vcd-border);
}

.vcd-output-panel {
    background: rgba(23,33,44,.68);
}

.vcd-field {
    min-width: 0;
}

.vcd-field + .vcd-field {
    margin-top: 17px;
}

.vcd-field-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 7px;
}

.vcd-label {
    display: block;
    margin: 0;
    color: var(--vcd-text-2) !important;
    font-family: var(--vcd-font) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.vcd-field-meta,
.vcd-help {
    color: var(--vcd-muted);
    font-size: 11px;
}

.vcd-help {
    display: block;
    margin: -3px 0 7px;
}

.vcd-textarea,
.vcd-input,
.vcd-select {
    width: 100%;
    margin: 0 !important;
    border: 1px solid var(--vcd-border-strong) !important;
    border-radius: var(--vcd-radius-sm) !important;
    outline: none !important;
    color: var(--vcd-text) !important;
    background: #0E151D !important;
    box-shadow: none !important;
    font-family: var(--vcd-font) !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.vcd-textarea {
    min-height: 138px;
    padding: 14px 15px !important;
    resize: vertical;
}

.vcd-main-textarea {
    min-height: 190px;
}

.vcd-input,
.vcd-select {
    min-height: 44px;
    padding: 9px 12px !important;
}

.vcd-textarea::placeholder,
.vcd-input::placeholder {
    color: #68737D !important;
    opacity: 1;
}

.vcd-textarea:focus,
.vcd-input:focus,
.vcd-select:focus {
    border-color: var(--vcd-accent) !important;
    background: #101922 !important;
    box-shadow: 0 0 0 3px rgba(201,164,92,.10) !important;
}

.vcd-key-block {
    margin-top: 18px;
}

.vcd-key-row {
    display: flex;
    gap: 8px;
}

.vcd-key-row .vcd-input {
    min-width: 0;
    font-weight: 600 !important;
    letter-spacing: .05em;
}

.vcd-icon-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: 1px solid var(--vcd-border-strong);
    border-radius: var(--vcd-radius-sm);
    color: var(--vcd-accent-light);
    background: var(--vcd-surface);
    cursor: pointer;
    font-size: 21px;
    line-height: 1;
    transition: border-color .18s ease, background .18s ease;
}

.vcd-icon-btn:hover {
    border-color: var(--vcd-accent);
    background: var(--vcd-surface-2);
}

.vcd-key-visual {
    min-height: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.vcd-key-letter {
    position: relative;
    width: 29px;
    height: 29px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(201,164,92,.48);
    border-radius: 3px;
    color: var(--vcd-accent-light);
    background: rgba(201,164,92,.07);
    font-size: 11px;
    font-weight: 700;
}

.vcd-key-letter span {
    position: absolute;
    right: 2px;
    bottom: -13px;
    color: var(--vcd-muted);
    font-size: 7px;
    font-weight: 500;
}

.vcd-options-row {
    display: grid;
    grid-template-columns: minmax(170px, 250px);
    margin-top: 18px;
}

.vcd-ops {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.vcd-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 15px;
    border: 1px solid transparent !important;
    border-radius: var(--vcd-radius-sm) !important;
    font-family: var(--vcd-font) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    cursor: pointer;
    transition: transform .12s ease, background .18s ease, border-color .18s ease, color .18s ease;
}

.vcd-btn:active {
    transform: translateY(1px);
}

.vcd-btn-primary {
    color: #12100A !important;
    background: var(--vcd-accent) !important;
    border-color: var(--vcd-accent) !important;
}

.vcd-btn-primary:hover {
    color: #0B1016 !important;
    background: var(--vcd-accent-light) !important;
    border-color: var(--vcd-accent-light) !important;
}

.vcd-btn-secondary {
    color: var(--vcd-text) !important;
    background: transparent !important;
    border-color: var(--vcd-border-strong) !important;
}

.vcd-btn-secondary:hover {
    border-color: var(--vcd-accent-dark) !important;
    background: rgba(201,164,92,.06) !important;
}

.vcd-btn-quiet {
    color: var(--vcd-text-2) !important;
    background: transparent !important;
    border-color: var(--vcd-border) !important;
}

.vcd-btn-quiet:hover {
    color: var(--vcd-text) !important;
    border-color: var(--vcd-border-strong) !important;
    background: rgba(255,255,255,.035) !important;
}

.vcd-btn-clear:hover {
    color: var(--vcd-error) !important;
    border-color: rgba(184,92,92,.45) !important;
}

.vcd-btn.vcd-sm {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 11px !important;
}

.vcd-btn-arrow {
    color: currentColor;
    font-size: 15px;
}

.vcd-shortcut {
    margin: 11px 0 0;
    color: var(--vcd-muted);
    font-size: 10px;
}

.vcd-shortcut kbd,
.vcd-reference kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid var(--vcd-border-strong);
    border-bottom-width: 2px;
    border-radius: 3px;
    color: var(--vcd-text-2);
    background: var(--vcd-surface);
    font-family: var(--vcd-font);
    font-size: 10px;
}

.vcd-output-head {
    min-height: 34px;
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 14px;
    margin-bottom: 8px;
}

.vcd-output-head .vcd-label {
    margin-top: 1px;
}

.vcd-output-actions {
    display: flex;
    gap: 6px;
}

.vcd-output-box {
    min-height: 278px;
    padding: 17px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    border: 1px solid var(--vcd-border-strong);
    border-radius: var(--vcd-radius-sm);
    color: var(--vcd-text);
    background: #0E151D;
    font-family: var(--vcd-font);
    font-size: 14px;
    line-height: 1.65;
}

.vcd-placeholder {
    color: var(--vcd-muted) !important;
}

.vcd-output-box .vcd-placeholder {
    font-style: normal;
}

.vcd-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 9px;
    border: 1px solid var(--vcd-border);
    background: rgba(17,25,35,.75);
}

.vcd-stat {
    min-width: 0;
    padding: 10px 9px;
    text-align: center;
    border-right: 1px solid var(--vcd-border);
}

.vcd-stat:last-child {
    border-right: 0;
}

.vcd-stat-label {
    display: block;
    margin-bottom: 2px;
    color: var(--vcd-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.vcd-stat span:last-child {
    color: var(--vcd-accent-light);
    font-size: 13px;
    font-weight: 700;
}

.vcd-tabula-section {
    margin-top: 30px;
    border-top: 1px solid var(--vcd-border);
    padding-top: 21px;
}

.vcd-section-toggle {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.vcd-section-toggle h4 {
    margin: 0;
    color: var(--vcd-text) !important;
    font-family: var(--vcd-heading) !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

.vcd-tabula-wrap {
    margin-top: 14px;
    overflow: auto;
    border: 1px solid var(--vcd-border);
    background: #0E151D;
}

.vcd-tabula {
    min-width: 720px;
    border-collapse: collapse;
    font-size: 10px;
}

.vcd-tabula th,
.vcd-tabula td {
    width: 25px;
    height: 25px;
    padding: 0;
    border: 1px solid var(--vcd-border);
    text-align: center;
}

.vcd-tabula th {
    color: var(--vcd-text);
    background: var(--vcd-surface);
    font-weight: 700;
}

.vcd-tabula td {
    color: var(--vcd-muted);
    background: #0E151D;
}

.vcd-tabula tr:hover td {
    background: rgba(201,164,92,.045);
}

.vcd-tabula td.vcd-tabula-diag {
    color: var(--vcd-accent-light);
    background: rgba(201,164,92,.10);
    font-weight: 700;
}

.vcd-info {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--vcd-border);
    border-left: 2px solid var(--vcd-accent);
    color: var(--vcd-text-2);
    background: rgba(201,164,92,.035);
    font-size: 13px;
}

.vcd-info strong {
    color: var(--vcd-text);
}

.vcd-analysis-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 20px;
}

.vcd-analysis-controls {
    display: flex;
    flex-direction: column;
}

.vcd-analysis-controls .vcd-field + .vcd-field {
    margin-top: 16px;
}

.vcd-analysis-btn {
    width: 100%;
    margin-top: auto;
}

.vcd-bf-results {
    margin-top: 24px;
    border-top: 1px solid var(--vcd-border);
    padding-top: 20px;
}

.vcd-bf-card {
    margin-bottom: 10px;
    padding: 16px;
    border: 1px solid var(--vcd-border);
    background: var(--vcd-bg-2);
}

.vcd-bf-card-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 10px;
}

.vcd-bf-badge {
    padding: 4px 7px;
    color: #17130A;
    background: var(--vcd-accent);
    border-radius: 3px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.vcd-bf-key {
    color: var(--vcd-accent-light);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
}

.vcd-bf-decoded {
    max-height: 120px;
    overflow: auto;
    padding: 11px 12px;
    border: 1px solid var(--vcd-border);
    background: #0E151D;
    color: var(--vcd-text);
    font-family: var(--vcd-font);
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.vcd-bf-use-btn {
    margin-top: 9px;
}

.vcd-frequency-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: end;
}

.vcd-frequency-input > .vcd-btn {
    margin-bottom: 0;
}

.vcd-freq-results {
    margin-top: 22px;
}

.vcd-freq-chart {
    min-height: 150px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin-top: 16px;
    padding: 12px 4px 26px;
    border-bottom: 1px solid var(--vcd-border-strong);
}

.vcd-freq-bar-wrap {
    height: 100%;
    min-width: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.vcd-freq-bar {
    width: min(100%, 24px);
    min-height: 1px;
    position: relative;
    background: var(--vcd-accent);
    cursor: default;
    transition: opacity .18s ease, height .35s ease;
}

.vcd-freq-bar:hover {
    opacity: .75;
}

.vcd-freq-bar .vcd-freq-tip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 5px);
    transform: translateX(-50%);
    z-index: 3;
    padding: 3px 6px;
    color: #0B1016;
    background: var(--vcd-text);
    border-radius: 3px;
    font-size: 9px;
    white-space: nowrap;
}

.vcd-freq-bar:hover .vcd-freq-tip {
    display: block;
}

.vcd-freq-letter {
    margin-top: 5px;
    color: var(--vcd-muted);
    font-size: 9px;
    font-weight: 700;
}

.vcd-freq-table {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.vcd-freq-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid var(--vcd-border);
    background: var(--vcd-surface);
    color: var(--vcd-text-2);
    font-size: 11px;
}

.vcd-freq-chip .fl {
    color: var(--vcd-accent-light);
    font-weight: 800;
}

.vcd-freq-chip .fp {
    color: var(--vcd-muted);
}

.vcd-english-ref {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 11px 13px;
    border: 1px solid var(--vcd-border);
    color: var(--vcd-muted);
    background: var(--vcd-bg-2);
    font-size: 10px;
}

.vcd-english-ref strong {
    margin-right: 4px;
    color: var(--vcd-text-2);
    font-weight: 700;
}

.vcd-english-ref span {
    padding: 3px 6px;
    background: var(--vcd-surface);
    color: var(--vcd-text-2);
    font-size: 10px;
}

.vcd-history-list {
    margin-top: 20px;
}

.vcd-history-item {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 9px;
    padding: 13px 15px;
    border: 1px solid var(--vcd-border);
    background: var(--vcd-bg-2);
}

.vcd-hi-badge {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 1px solid var(--vcd-border-strong);
    color: var(--vcd-text-2);
    background: var(--vcd-surface);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.vcd-hi-badge.encode {
    color: var(--vcd-accent-light);
    border-color: rgba(201,164,92,.32);
}

.vcd-hi-badge.decode {
    color: var(--vcd-success);
    border-color: rgba(111,163,122,.32);
}

.vcd-hi-body {
    min-width: 180px;
    flex: 1;
}

.vcd-hi-key {
    margin-bottom: 4px;
    color: var(--vcd-accent-light);
    font-size: 11px;
    font-weight: 700;
}

.vcd-hi-texts {
    color: var(--vcd-text);
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.vcd-hi-texts span {
    color: var(--vcd-muted);
}

.vcd-hi-time {
    margin-top: 4px;
    color: var(--vcd-muted);
    font-size: 10px;
}

.vcd-hi-actions {
    display: flex;
    gap: 6px;
}

.vcd-empty-state {
    padding: 22px 0;
}

.vcd-reference {
    max-width: 800px;
}

.vcd-reference > h3 {
    margin: 34px 0 10px;
    padding-top: 24px;
    border-top: 1px solid var(--vcd-border);
    font-size: 20px !important;
    font-weight: 600 !important;
}

.vcd-reference > h3:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.vcd-reference p,
.vcd-reference li {
    color: var(--vcd-text-2);
    font-size: 14px;
    line-height: 1.75;
}

.vcd-reference strong {
    color: var(--vcd-text);
}

.vcd-reference ol,
.vcd-reference ul {
    padding-left: 20px;
}

.vcd-reference code {
    padding: 1px 5px;
    border: 1px solid var(--vcd-border);
    border-radius: 3px;
    color: var(--vcd-accent-light);
    background: var(--vcd-surface);
    font-family: var(--vcd-font);
    font-size: .9em;
}

.vcd-example-box {
    margin: 13px 0;
    padding: 13px 15px;
    border-left: 2px solid var(--vcd-accent);
    background: rgba(201,164,92,.045);
    color: var(--vcd-text);
    font-size: 13px;
    line-height: 1.75;
}

.vcd-formula {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 13px 0;
    padding: 15px;
    border: 1px solid var(--vcd-border);
    background: var(--vcd-surface);
    color: var(--vcd-text);
    font-family: var(--vcd-font);
    font-size: 14px;
}

.vcd-ref-table {
    width: 100%;
    margin: 13px 0;
    border-collapse: collapse;
    font-size: 12px;
}

.vcd-ref-table th,
.vcd-ref-table td {
    padding: 10px 11px;
    border: 1px solid var(--vcd-border);
    text-align: left;
}

.vcd-ref-table th {
    color: var(--vcd-text);
    background: var(--vcd-surface);
    font-weight: 700;
}

.vcd-ref-table td {
    color: var(--vcd-text-2);
}

.vcd-spinner-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(11,16,22,.68);
}

.vcd-spinner {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(201,164,92,.18);
    border-top-color: var(--vcd-accent);
    border-radius: 50%;
    animation: vcd-spin .7s linear infinite;
}

@keyframes vcd-spin {
    to { transform: rotate(360deg); }
}

.vcd-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    max-width: 320px;
    padding: 10px 13px;
    border: 1px solid var(--vcd-border-strong);
    color: var(--vcd-text);
    background: var(--vcd-surface-2);
    box-shadow: 0 12px 30px rgba(0,0,0,.28);
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

.vcd-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Prevent theme/plugin defaults from introducing light form controls. */
#vcd-app select option {
    color: var(--vcd-text);
    background: var(--vcd-bg-2);
}

@media (max-width: 820px) {
    .vcd-cipher-grid {
        grid-template-columns: 1fr;
    }

    .vcd-workspace {
        border-right: 0;
        border-bottom: 1px solid var(--vcd-border);
    }

    .vcd-analysis-grid {
        grid-template-columns: 1fr;
    }

    .vcd-analysis-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .vcd-analysis-controls .vcd-field + .vcd-field {
        margin-top: 0;
    }

    .vcd-analysis-btn {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .vcd-frequency-input {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #vcd-app {
        margin: 18px auto;
        background-size: 34px 34px;
    }

    .vcd-header {
        min-height: 0;
        padding: 22px 18px;
        align-items: flex-start;
    }

    .vcd-brand-mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .vcd-header-status {
        display: none;
    }

    .vcd-title {
        font-size: 24px !important;
    }

    .vcd-subtitle {
        font-size: 12px;
    }

    .vcd-tab {
        min-height: 52px;
        padding: 0 15px;
        font-size: 12px !important;
    }

    .vcd-panel {
        padding: 24px 16px;
    }

    .vcd-tool-heading {
        display: block;
        margin-bottom: 19px;
    }

    .vcd-tool-note {
        margin-top: 8px;
        text-align: left;
    }

    .vcd-workspace,
    .vcd-output-panel {
        padding: 17px;
    }

    .vcd-main-textarea {
        min-height: 170px;
    }

    .vcd-output-box {
        min-height: 220px;
    }

    .vcd-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .vcd-stat:nth-child(2) {
        border-right: 0;
    }

    .vcd-stat:nth-child(-n+2) {
        border-bottom: 1px solid var(--vcd-border);
    }

    .vcd-analysis-controls {
        grid-template-columns: 1fr;
    }

    .vcd-analysis-btn {
        grid-column: auto;
    }

    .vcd-frequency-input > .vcd-btn {
        width: 100%;
    }

    .vcd-history-item {
        flex-wrap: wrap;
    }

    .vcd-hi-body {
        min-width: calc(100% - 45px);
    }

    .vcd-hi-actions {
        width: 100%;
    }

    .vcd-hi-actions .vcd-btn {
        width: 100%;
    }

    .vcd-reference p,
    .vcd-reference li {
        font-size: 13px;
    }

    .vcd-ref-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    #vcd-app *,
    #vcd-app *::before,
    #vcd-app *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}


/* =========================================================
   1.1 VISUAL CLEANUP / HOMEPAGE EMBED
   The plugin is the interface itself. No outer frame/header.
   ========================================================= */

#vcd-app {
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: var(--vcd-bg);
    overflow: visible;
}

/* Header removed from markup. Keep no visual reserve for it. */
#vcd-app .vcd-header {
    display: none !important;
}

/* Keep the tool navigation compact and intentional. */
#vcd-app .vcd-tabs {
    border-top: 1px solid var(--vcd-border);
}

/* Smaller editorial scale for the actual tool. */
#vcd-app .vcd-panel {
    padding: clamp(30px, 4vw, 46px) 0;
}

#vcd-app .vcd-tool-heading {
    margin-bottom: 25px;
}

#vcd-app .vcd-tool-heading h3 {
    font-size: clamp(22px, 2.35vw, 28px) !important;
    line-height: 1.18 !important;
    letter-spacing: -.025em;
}

#vcd-app .vcd-section-kicker {
    font-size: 10px;
    letter-spacing: .16em;
}

#vcd-app .vcd-tool-note {
    font-size: 12px;
    line-height: 1.5;
}

/* Input/output are one balanced workspace. */
#vcd-app .vcd-cipher-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
}

#vcd-app .vcd-workspace,
#vcd-app .vcd-output-panel {
    padding: clamp(20px, 2.5vw, 27px);
}

#vcd-app .vcd-workspace {
    display: flex;
    flex-direction: column;
}

#vcd-app .vcd-output-panel {
    display: flex;
    flex-direction: column;
}

#vcd-app .vcd-main-textarea {
    min-height: 178px;
    height: 178px;
}

#vcd-app .vcd-output-box {
    min-height: 178px;
    height: 178px;
    flex: 0 0 178px;
}

/* Keep controls from becoming oversized. */
#vcd-app .vcd-label {
    font-size: 10px !important;
    letter-spacing: .12em;
}

#vcd-app .vcd-field-meta,
#vcd-app .vcd-help {
    font-size: 10px;
}

#vcd-app .vcd-textarea,
#vcd-app .vcd-input,
#vcd-app .vcd-select {
    font-size: 13px !important;
}

#vcd-app .vcd-textarea {
    padding: 12px 13px !important;
}

#vcd-app .vcd-input,
#vcd-app .vcd-select,
#vcd-app .vcd-icon-btn {
    min-height: 42px;
    height: 42px;
}

#vcd-app .vcd-icon-btn {
    width: 42px;
    flex-basis: 42px;
}

/* Controls + shortcuts have deliberate breathing room. */
#vcd-app .vcd-ops {
    margin-top: 22px;
    gap: 8px;
}

#vcd-app .vcd-shortcut {
    margin: 16px 0 0;
    line-height: 1.7;
}

#vcd-app .vcd-shortcut kbd {
    margin: 0 2px;
}

/* Output heading and actions stay on one clean baseline. */
#vcd-app .vcd-output-head {
    min-height: 36px;
    margin-bottom: 9px;
}

#vcd-app .vcd-output-actions {
    flex-shrink: 0;
}

#vcd-app .vcd-output-actions .vcd-btn {
    min-height: 34px;
}

/* Tabula should not dominate the primary tool. */
#vcd-app .vcd-tabula-section {
    margin-top: 38px;
    padding-top: 24px;
}

#vcd-app .vcd-section-toggle h4 {
    font-size: 17px !important;
}


/* =========================================================
   MOBILE TOOL
   ========================================================= */

@media (max-width: 820px) {

    #vcd-app .vcd-panel {
        padding: 28px 0 34px;
    }

    #vcd-app .vcd-cipher-grid {
        grid-template-columns: 1fr;
    }

    #vcd-app .vcd-workspace {
        border-right: 0;
        border-bottom: 1px solid var(--vcd-border);
    }

    #vcd-app .vcd-output-panel {
        background: var(--vcd-surface);
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 170px;
        min-height: 170px;
        flex-basis: 170px;
    }

    #vcd-app .vcd-output-box {
        margin-bottom: 0;
    }

}


@media (max-width: 600px) {

    #vcd-app {
        margin: 0;
    }

    #vcd-app .vcd-tabs {
        width: 100%;
    }

    #vcd-app .vcd-tab {
        min-height: 47px;
        padding: 0 13px;
        gap: 7px;
        font-size: 11px !important;
    }

    #vcd-app .vcd-tab-index {
        font-size: 9px;
    }

    #vcd-app .vcd-panel {
        padding: 27px 0 34px;
    }

    #vcd-app .vcd-tool-heading {
        display: block;
        margin-bottom: 20px;
    }

    #vcd-app .vcd-tool-heading h3 {
        font-size: 22px !important;
    }

    #vcd-app .vcd-tool-note {
        margin-top: 8px;
        max-width: none;
        text-align: left;
        font-size: 11px;
    }

    #vcd-app .vcd-workspace,
    #vcd-app .vcd-output-panel {
        padding: 17px;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 160px;
        min-height: 160px;
        flex-basis: 160px;
    }

    #vcd-app .vcd-field + .vcd-field {
        margin-top: 15px;
    }

    #vcd-app .vcd-options-row {
        grid-template-columns: 1fr;
        margin-top: 17px;
    }

    #vcd-app .vcd-ops {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 21px;
        gap: 7px;
    }

    #vcd-app .vcd-ops .vcd-btn {
        width: 100%;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 12px !important;
    }

    #vcd-app .vcd-shortcut {
        margin-top: 15px;
        font-size: 9px;
        line-height: 1.85;
        text-align: center;
    }

    #vcd-app .vcd-output-head {
        min-height: 32px;
        align-items: center;
    }

    #vcd-app .vcd-output-head .vcd-section-kicker {
        margin-bottom: 2px;
    }

    #vcd-app .vcd-output-actions {
        gap: 5px;
    }

    #vcd-app .vcd-output-actions .vcd-btn {
        min-height: 32px;
        padding: 7px 9px;
        font-size: 10px !important;
    }

    #vcd-app .vcd-output-box {
        font-size: 12px;
        line-height: 1.55;
        padding: 13px;
    }

    #vcd-app .vcd-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    #vcd-app .vcd-tabula-section {
        margin-top: 28px;
        padding-top: 21px;
    }

    #vcd-app .vcd-section-toggle h4 {
        font-size: 16px !important;
    }

    #vcd-app .vcd-section-toggle {
        align-items: center;
        gap: 12px;
    }

    #vcd-app .vcd-section-toggle .vcd-btn {
        flex-shrink: 0;
    }

}


@media (max-width: 390px) {

    #vcd-app .vcd-tab {
        padding: 0 10px;
    }

    #vcd-app .vcd-workspace,
    #vcd-app .vcd-output-panel {
        padding: 14px;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 150px;
        min-height: 150px;
        flex-basis: 150px;
    }

    #vcd-app .vcd-ops .vcd-btn {
        font-size: 11px !important;
    }

    #vcd-app .vcd-shortcut {
        font-size: 8px;
    }

}


/* =========================================================
   1.2 FINAL TOOL LAYOUT CLEANUP
   ========================================================= */

#vcd-app {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

#vcd-app .vcd-tabs {
    margin: 0 !important;
}

/* Cipher workspace: equal columns and equal text-box heights. */
#vcd-app .vcd-cipher-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: stretch !important;
}

#vcd-app .vcd-workspace,
#vcd-app .vcd-output-panel {
    min-width: 0 !important;
}

#vcd-app .vcd-main-textarea,
#vcd-app .vcd-output-box {
    height: 300px !important;
    min-height: 300px !important;
}

/* The output panel should not create a different visual rhythm. */
#vcd-app .vcd-output-head {
    min-height: 42px !important;
    margin-bottom: 10px !important;
}

#vcd-app .vcd-output-head .vcd-section-kicker {
    display: none !important;
}

#vcd-app .vcd-output-head > div:first-child {
    display: flex !important;
    align-items: center !important;
}

#vcd-app .vcd-output-head .vcd-label {
    margin: 0 !important;
}

/* Buttons sit comfortably above the shortcut line. */
#vcd-app .vcd-ops {
    margin-top: 24px !important;
    gap: 9px !important;
}

#vcd-app .vcd-shortcut {
    margin-top: 15px !important;
    line-height: 1.7 !important;
}

/* Frequency action belongs at the top of the input, not at its bottom. */
#vcd-app .vcd-frequency-input {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 18px !important;
}

#vcd-app .vcd-frequency-input > .vcd-btn {
    margin: 30px 0 0 !important;
    align-self: start !important;
    white-space: nowrap !important;
}

/* Reference is no longer part of the navigation or interface. */
#vcd-app [data-tab="reference"],
#vcd-app #vcd-tab-reference {
    display: none !important;
}

@media (max-width: 800px) {
    #vcd-app .vcd-cipher-grid {
        grid-template-columns: 1fr !important;
    }

    #vcd-app .vcd-workspace {
        border-right: 0 !important;
        border-bottom: 1px solid var(--vcd-border) !important;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 240px !important;
        min-height: 240px !important;
    }

    #vcd-app .vcd-frequency-input {
        grid-template-columns: 1fr !important;
    }

    #vcd-app .vcd-frequency-input > .vcd-btn {
        width: 100% !important;
        margin: 2px 0 0 !important;
    }
}

@media (max-width: 600px) {
    #vcd-app .vcd-panel {
        padding: 25px 0 !important;
    }

    #vcd-app .vcd-workspace,
    #vcd-app .vcd-output-panel {
        padding: 16px !important;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 210px !important;
        min-height: 210px !important;
    }

    #vcd-app .vcd-ops {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        margin-top: 22px !important;
    }

    #vcd-app .vcd-ops .vcd-btn {
        width: 100% !important;
    }

    #vcd-app .vcd-shortcut {
        margin-top: 16px !important;
        text-align: center !important;
    }

    #vcd-app .vcd-output-head {
        align-items: center !important;
        min-height: 36px !important;
    }

    #vcd-app .vcd-output-actions {
        gap: 5px !important;
    }

    #vcd-app .vcd-output-actions .vcd-btn {
        min-height: 36px !important;
        padding: 7px 10px !important;
    }
}


/* =========================================================
   1.3 FINAL CIPHER PANEL ALIGNMENT
   ========================================================= */

/* Remove the empty band directly below the navigation. */
#vcd-app .vcd-panel {
    padding-top: 0 !important;
}

/* Keep the two working columns perfectly equal. */
#vcd-app .vcd-cipher-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: stretch !important;
}

/* Input and output text areas share the exact same geometry. */
#vcd-app .vcd-main-textarea,
#vcd-app .vcd-output-box {
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
}

/* Output controls sit on the same top line without pushing the box down. */
#vcd-app .vcd-output-head {
    position: relative !important;
    display: flex !important;
    align-items: flex-start !important;
    min-height: 22px !important;
    height: 22px !important;
    margin: 0 0 7px !important;
    padding: 0 !important;
}

#vcd-app .vcd-output-head > div:first-child {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

#vcd-app .vcd-output-head .vcd-label {
    margin: 0 !important;
    line-height: 1.35 !important;
}

#vcd-app .vcd-output-actions {
    position: absolute !important;
    top: -8px !important;
    right: 0 !important;
    display: flex !important;
    gap: 7px !important;
}

#vcd-app .vcd-output-actions .vcd-btn {
    min-height: 34px !important;
    height: 34px !important;
}

#vcd-app .vcd-output-box {
    margin-top: 0 !important;
}

@media (max-width: 800px) {
    #vcd-app .vcd-panel {
        padding-top: 0 !important;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 240px !important;
        min-height: 240px !important;
        max-height: 240px !important;
    }
}

@media (max-width: 600px) {
    #vcd-app .vcd-panel {
        padding-top: 0 !important;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 210px !important;
        min-height: 210px !important;
        max-height: 210px !important;
    }

    #vcd-app .vcd-output-head {
        height: 25px !important;
        min-height: 25px !important;
        margin-bottom: 7px !important;
    }

    #vcd-app .vcd-output-actions {
        top: -6px !important;
        gap: 5px !important;
    }

    #vcd-app .vcd-output-actions .vcd-btn {
        min-height: 32px !important;
        height: 32px !important;
    }
}

@media (max-width: 390px) {
    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 190px !important;
        min-height: 190px !important;
        max-height: 190px !important;
    }
}

/* =========================================================
   1.4 MOBILE-FIRST CIPHER EXPERIENCE
   Desktop layout remains unchanged above 800px.
   ========================================================= */

@media (max-width: 800px) {
    #vcd-app {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    #vcd-app .vcd-panel {
        width: 100% !important;
        padding: 0 !important;
    }

    /* Keep navigation usable without squeezing labels. */
    #vcd-app .vcd-tabs {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #vcd-app .vcd-tab {
        flex: 0 0 auto !important;
        min-height: 48px !important;
        padding: 0 15px !important;
        white-space: nowrap !important;
    }

    /* Mobile: input controls first, output directly underneath. */
    #vcd-app .vcd-cipher-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-radius: 0 !important;
    }

    #vcd-app .vcd-workspace,
    #vcd-app .vcd-output-panel {
        width: 100% !important;
        padding: 20px 16px !important;
    }

    #vcd-app .vcd-workspace {
        border-right: 0 !important;
        border-bottom: 1px solid var(--vcd-border) !important;
    }

    #vcd-app .vcd-output-panel {
        background: var(--vcd-surface) !important;
    }

    /* Comfortable mobile text areas. */
    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        width: 100% !important;
        height: 205px !important;
        min-height: 205px !important;
        max-height: 205px !important;
    }

    /* Key input always gets the full available width. */
    #vcd-app .vcd-key-row {
        width: 100% !important;
        gap: 7px !important;
    }

    #vcd-app .vcd-key-row .vcd-input {
        min-width: 0 !important;
        width: auto !important;
        flex: 1 1 auto !important;
    }

    #vcd-app .vcd-icon-btn {
        flex: 0 0 42px !important;
        width: 42px !important;
        height: 42px !important;
    }

    /* Alphabet mode spans the mobile workspace. */
    #vcd-app .vcd-options-row,
    #vcd-app .vcd-alpha-field,
    #vcd-app .vcd-alpha-field .vcd-select {
        width: 100% !important;
    }

    /* Two clean rows: Encode/Decode, then Swap/Clear. */
    #vcd-app .vcd-ops {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 8px !important;
        margin-top: 20px !important;
    }

    #vcd-app .vcd-ops .vcd-btn {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 43px !important;
        padding: 9px 10px !important;
    }

    /* Keyboard shortcuts have little value on touch devices. */
    #vcd-app .vcd-shortcut {
        display: none !important;
    }

    /* Output controls remain easy to tap. */
    #vcd-app .vcd-output-head {
        width: 100% !important;
        min-height: 34px !important;
        height: 34px !important;
        margin-bottom: 8px !important;
    }

    #vcd-app .vcd-output-actions {
        position: static !important;
        display: flex !important;
        gap: 6px !important;
        margin-left: auto !important;
    }

    #vcd-app .vcd-output-actions .vcd-btn {
        min-height: 32px !important;
        height: 32px !important;
        padding: 6px 9px !important;
        white-space: nowrap !important;
    }

    #vcd-app .vcd-output-box {
        flex: none !important;
        padding: 14px !important;
        font-size: 13px !important;
        line-height: 1.6 !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 390px) {
    #vcd-app .vcd-workspace,
    #vcd-app .vcd-output-panel {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    #vcd-app .vcd-main-textarea,
    #vcd-app .vcd-output-box {
        height: 190px !important;
        min-height: 190px !important;
        max-height: 190px !important;
    }

    #vcd-app .vcd-tab {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    #vcd-app .vcd-ops .vcd-btn {
        min-height: 42px !important;
        font-size: 12px !important;
    }
}


/* =========================================================
   FINAL MOBILE CLEANUP
   Hide keyboard shortcut helper on touch-sized layouts.
   ========================================================= */
@media (max-width: 800px) {
    #vcd-app p.vcd-shortcut,
    #vcd-app .vcd-shortcut {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
}
