:root {
    --bg: #0b0f14;
    --surface: #111720;
    --surface-2: #171e29;
    --surface-3: #1d2633;
    --border: #273241;
    --text: #f4f7fb;
    --muted: #8d99a8;
    --accent: #19c7d8;
    --accent-soft: rgba(25, 199, 216, 0.12);
    --success: #42d392;
    --danger: #ff6678;
    --sidebar-width: 245px;
    --topbar-height: 70px;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    min-height: 100vh;
}

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

button {
    border: 0;
}

.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 80% 10%, rgba(25, 199, 216, 0.06), transparent 28%),
        var(--bg);
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 15, 20, 0.94);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid rgba(25, 199, 216, 0.3);
    color: var(--accent);
    font-size: 20px;
    font-weight: 800;
}

.brand-name {
    font-size: 17px;
    font-weight: 750;
    line-height: 1.1;
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px rgba(66, 211, 146, 0.5);
}

.workspace {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--border);
    background: rgba(15, 20, 28, 0.92);
    padding: 20px 14px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
    width: 22px;
    text-align: center;
    color: var(--accent);
    font-size: 17px;
}

.sidebar-footer {
    padding: 13px 12px;
    border-top: 1px solid var(--border);
}

.version-label {
    color: var(--muted);
    font-size: 11px;
}

.version-number {
    color: var(--text);
    font-size: 12px;
    margin-top: 4px;
    font-weight: 650;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 38px;
    overflow-x: hidden;
}

.view {
    display: none;
    max-width: 1180px;
    margin: 0 auto;
}

.active-view {
    display: block;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.eyebrow {
    display: inline-block;
    color: var(--accent);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.14em;
    margin-bottom: 8px;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.page-heading p {
    max-width: 680px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.feature-card {
    min-height: 220px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.18s ease,
        transform 0.18s ease,
        background 0.18s ease;
}

.feature-card:hover {
    border-color: rgba(25, 199, 216, 0.45);
    background: linear-gradient(145deg, var(--surface-2), var(--surface-3));
    transform: translateY(-2px);
}

.feature-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 20px;
}

.feature-card h2 {
    margin: 0 0 9px;
    font-size: 19px;
}

.feature-card p {
    margin: 0;
    max-width: 460px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.feature-action {
    display: inline-block;
    margin-top: 20px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.dashboard-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 18px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.dashboard-panel h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.dashboard-panel p {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.architecture-badge {
    min-width: 150px;
    padding: 14px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    text-align: center;
}

.architecture-badge strong {
    display: block;
    color: var(--accent);
    font-size: 14px;
}

.architecture-badge span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 4px;
}

.workspace-placeholder {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(17, 23, 32, 0.65);
    text-align: center;
}

.placeholder-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 24px;
}

.workspace-placeholder h2 {
    margin: 0;
    font-size: 20px;
}

.workspace-placeholder p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 800px) {
    :root {
        --sidebar-width: 76px;
    }

    .topbar {
        padding: 0 18px;
    }

    .brand-subtitle,
    .sidebar-footer,
    .nav-item > span:last-child {
        display: none;
    }

    .brand-name {
        display: none;
    }

    .sidebar {
        padding: 16px 10px;
    }

    .nav-item {
        justify-content: center;
        padding: 12px 8px;
    }

    .nav-item.active {
        box-shadow: inset 0 0 0 1px var(--accent);
    }

    .main-content {
        padding: 28px 20px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .architecture-badge {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .topbar-status {
        display: none;
    }

    .main-content {
        padding: 24px 15px;
    }

    .page-heading {
        margin-bottom: 24px;
    }

    .feature-card {
        min-height: auto;
    }
}

/* ==================== BOOK STUDIO ==================== */

.book-studio-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 18px;
    align-items: start;
}

.book-panel {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.book-panel h2 {
    margin: 0;
    font-size: 18px;
}

.book-panel-description {
    margin: 8px 0 22px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.book-form {
    display: grid;
    gap: 18px;
}

.book-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-field {
    display: grid;
    gap: 7px;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.form-hint {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

/* Book Studio Urdu typography: use the locally installed Jameel Noori Nastaleeq font. */
#book-studio-root .form-control.book-urdu {
    font-family: "Jameel Noori Nastaleeq", "Nafees", serif;
    font-size: 18px;
    line-height: 1.8;
    text-align: right;
    direction: rtl;
}

.form-control:focus {
    border-color: rgba(25, 199, 216, 0.7);
    box-shadow: 0 0 0 3px rgba(25, 199, 216, 0.08);
}

.form-control::placeholder {
    color: var(--muted);
}

.form-section {
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.form-section-title {
    margin: 0 0 14px;
    font-size: 14px;
}

.option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.option-card {
    flex: 1 1 180px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
    cursor: pointer;
}

.option-card:hover {
    border-color: rgba(25, 199, 216, 0.4);
}

.option-card input {
    margin-top: 2px;
    accent-color: var(--accent);
}

.option-card strong {
    display: block;
    font-size: 13px;
}

.option-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.book-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 6px;
}

.book-form-note {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.primary-button {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid rgba(25, 199, 216, 0.55);
    border-radius: 9px;
    background: var(--accent);
    color: #061014;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        opacity 0.18s ease;
}

.primary-button:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.secondary-button:hover {
    border-color: rgba(25, 199, 216, 0.4);
}

/* ==================== AI ACCOUNTS ==================== */

.ai-account-panel {
    display: grid;
    gap: 18px;
    margin-top: 18px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.ai-account-panel-header {
    display: grid;
    gap: 5px;
}

.ai-account-panel-header h2 {
    margin: 0;
    font-size: 18px;
}

.ai-account-panel-header p,
.ai-account-form-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.ai-account-list {
    display: grid;
    gap: 12px;
}

.ai-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--bg);
}

.ai-account-card.active {
    border-color: rgba(25, 199, 216, 0.55);
    box-shadow: 0 0 0 1px rgba(25, 199, 216, 0.08);
}

.ai-account-card-main {
    min-width: 0;
}

.ai-account-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-account-card-title h3 {
    margin: 0;
    font-size: 14px;
}

.ai-account-provider {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-account-details {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 14px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.ai-account-card-actions {
    flex: 0 0 auto;
}

.ai-account-current,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid rgba(25, 199, 216, 0.35);
    border-radius: 999px;
    background: rgba(25, 199, 216, 0.08);
    color: var(--text);
    font-size: 10px;
    font-weight: 800;
}

.ai-account-form-card {
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.ai-account-form-header {
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .ai-account-panel {
        padding: 20px;
        border-radius: 15px;
    }

    .ai-account-card {
        align-items: stretch;
        flex-direction: column;
        gap: 13px;
    }

    .ai-account-card-actions {
        width: 100%;
    }

    .ai-account-card-actions .secondary-button {
        width: 100%;
    }

    .ai-account-current {
        width: 100%;
        justify-content: center;
    }

    .ai-account-details {
        display: grid;
        gap: 5px;
    }

    .ai-account-panel .book-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ai-account-panel .book-form-actions .primary-button {
        width: 100%;
    }
}

.book-side {
    display: grid;
    gap: 18px;
}

.book-info-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.book-info-card h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.book-info-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.book-status-card {
    display: none;
    padding: 20px;
    border: 1px solid rgba(25, 199, 216, 0.25);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(25, 199, 216, 0.07), var(--surface));
}

.book-status-card.visible {
    display: block;
}

.book-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.book-status-header h3 {
    margin: 0;
    font-size: 15px;
}

.status-badge {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-track {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-3);
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.35s ease;
}

.progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 9px;
}

.progress-stage {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.progress-percent {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.progress-message {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.book-results {
    display: none;
    margin-top: 18px;
}

.book-results.visible {
    display: block;
}

.book-results h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
}

.result-card strong {
    font-size: 12px;
}

.result-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.book-error {
    display: none;
    margin-top: 14px;
    padding: 12px;
    border: 1px solid rgba(255, 92, 92, 0.3);
    border-radius: 9px;
    background: rgba(255, 92, 92, 0.06);
    color: #ffb0b0;
    font-size: 12px;
    line-height: 1.5;
}

.book-error.visible {
    display: block;
}

@media (max-width: 900px) {
    .book-studio-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .book-form-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .form-field-full {
        grid-column: auto;
    }

    .book-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-button {
        width: 100%;
    }
}

/* =========================================================
   3D Book Reader
   ========================================================= */

.book-reader[hidden] {
    display: none !important;
}

.book-reader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: #0b1120;
    color: #f8fafc;
}

.book-reader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #111827;
}

.book-reader-title {
    min-width: 0;
}

.book-reader-title strong {
    display: block;
    font-size: 14px;
}

.book-reader-title span {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 11px;
}

.book-reader-controls {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.book-reader-controls .secondary-button {
    min-width: 38px;
}

.book-reader-body {
    min-height: 0;
    flex: 1;
    display: flex;
    overflow: hidden;
}

.book-reader-thumbnails {
    display: none;
}

.book-reader-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 1800px;
    background:
        radial-gradient(circle at center, rgba(25, 199, 216, 0.08), transparent 42%),
        #0b1120;
}

.book-reader-book {
    position: relative;
    width: min(86vw, 1180px);
    height: min(78vh, 720px);
    transform-style: preserve-3d;
    perspective: 1800px;
    isolation: isolate;
}

.book-reader-book::before {
    content: "";
    position: absolute;
    inset: 2px -10px 2px 2px;
    z-index: -2;
    border-radius: 3px 10px 10px 3px;
    background:
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(226, 232, 240, 0.92) 72%,
            rgba(148, 163, 184, 0.55) 100%
        );
    box-shadow:
        12px 24px 45px rgba(0, 0, 0, 0.35),
        inset -5px 0 8px rgba(15, 23, 42, 0.08);
}

.book-reader-book::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 1%;
    bottom: 1%;
    width: 2px;
    z-index: 10;
    pointer-events: none;
    transform: translateX(-50%);
    background: linear-gradient(
        180deg,
        transparent,
        rgba(15, 23, 42, 0.18) 15%,
        rgba(15, 23, 42, 0.28) 50%,
        rgba(15, 23, 42, 0.18) 85%,
        transparent
    );
}

.book-reader-closed-cover {
    position: absolute;
    top: 0;
    left: 25%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    background: #fff;
    border-radius: 3px 8px 8px 3px;
    transform-origin: right center;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow:
        12px 24px 45px rgba(0,0,0,0.42),
        4px 0 10px rgba(15,23,42,0.18),
        inset -5px 0 9px rgba(15,23,42,0.12);
    z-index: 30;
}

.book-reader-closed-cover canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.book-reader-closed-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(
            90deg,
            rgba(15,23,42,0.08),
            transparent 18%,
            transparent 82%,
            rgba(15,23,42,0.22)
        );
}


.book-reader-opening-sheet {
    transform-origin: right center;
    transform-style: preserve-3d;
    z-index: 31;
}

.book-reader-opening-sheet.is-opening {
    transform:
        perspective(1800px)
        rotateY(-180deg)
        rotateX(1deg)
        translateZ(14px);
    transition:
        transform 1.2s cubic-bezier(0.18, 0.78, 0.16, 1),
        box-shadow 1.2s ease;
    box-shadow:
        -18px 24px 48px rgba(0,0,0,0.16),
        inset 6px 0 12px rgba(15,23,42,0.08);
}

.book-reader-closed-cover.is-opening {
    transform:
        perspective(1800px)
        rotateY(-180deg)
        rotateX(1deg)
        translateZ(14px);
    transition:
        transform 1.2s cubic-bezier(0.18, 0.78, 0.16, 1),
        box-shadow 1.2s ease;
    box-shadow:
        -18px 24px 48px rgba(0,0,0,0.16),
        inset 6px 0 12px rgba(15,23,42,0.08);
}

.book-reader-spread.book-reader-closing {
    transform:
        perspective(1800px)
        rotateY(-5deg)
        rotateX(0.8deg)
        scaleX(0.985);
    transform-origin: right center;
    opacity: 0.88;
    filter: brightness(0.96);
    transition:
        transform 1.25s cubic-bezier(0.18, 0.78, 0.16, 1),
        opacity 1.25s ease,
        filter 1.25s ease;
}

.book-reader-closed-cover.is-closing-start {
    transform:
        perspective(1800px)
        rotateY(-168deg)
        rotateX(1deg)
        translateZ(20px);
    box-shadow:
        -16px 28px 52px rgba(0,0,0,0.20),
        inset 6px 0 12px rgba(15,23,42,0.08);
}

.book-reader-closed-cover.is-closing {
    transform:
        perspective(1800px)
        rotateY(0deg)
        rotateX(0deg)
        translateZ(0);
    box-shadow:
        12px 24px 45px rgba(0,0,0,0.42),
        4px 0 10px rgba(15,23,42,0.18),
        inset -5px 0 9px rgba(15,23,42,0.12);
    transition:
        transform 1.25s cubic-bezier(0.18, 0.78, 0.16, 1),
        box-shadow 1.25s ease;
}

.book-reader-closed-cover.is-closed {
    transform:
        perspective(1800px)
        rotateY(0deg)
        translateZ(0);
    box-shadow:
        12px 24px 45px rgba(0,0,0,0.42),
        4px 0 10px rgba(15,23,42,0.18),
        inset -5px 0 9px rgba(15,23,42,0.12);
    transition: none;
    z-index: 30;
}

.book-reader-closed-cover.is-opening {
    transform:
        perspective(1800px)
        rotateY(-168deg)
        rotateX(1deg)
        translateZ(12px);
    box-shadow:
        -14px 25px 48px rgba(0,0,0,0.20),
        inset 6px 0 12px rgba(15,23,42,0.08);
    transition:
        transform 1.2s cubic-bezier(0.18, 0.78, 0.16, 1),
        box-shadow 1.2s ease;
}

.book-reader-spread {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    transform-style: preserve-3d;
}

.book-reader-spread-page {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.32),
        0 4px 14px rgba(0, 0, 0, 0.2);
}

.book-reader-spread-left {
    border-radius: 7px 2px 2px 7px;
    transform-origin: right center;
}

.book-reader-spread-right {
    border-radius: 2px 7px 7px 2px;
    transform-origin: left center;
}

.book-reader-spread-page canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.book-reader-spread-left::after,
.book-reader-spread-right::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.book-reader-spread-left::after {
    background:
        linear-gradient(
            90deg,
            rgba(15, 23, 42, 0.12),
            transparent 18%,
            transparent 88%,
            rgba(15, 23, 42, 0.05)
        );
}

.book-reader-spread-right::after {
    background:
        linear-gradient(
            90deg,
            rgba(15, 23, 42, 0.05),
            transparent 12%,
            transparent 82%,
            rgba(15, 23, 42, 0.12)
        );
}

.book-reader-spread-blank {
    background: #f8fafc;
}

.book-reader-page {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border-radius: 2px 7px 7px 2px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.4),
        0 4px 14px rgba(0, 0, 0, 0.25);
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.book-reader-page::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(
            90deg,
            rgba(15, 23, 42, 0.08),
            transparent 12%,
            transparent 82%,
            rgba(15, 23, 42, 0.1)
        );
    opacity: 0.7;
}

.book-reader-page canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.book-reader-flip-sheet {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: 20;
    transform-style: preserve-3d;
    transform-origin: left center;
    transform: rotateY(0deg);
    will-change: transform;
    transition:
        transform 1.15s cubic-bezier(0.22, 0.72, 0.18, 1),
        box-shadow 1.15s ease;
    box-shadow:
        12px 18px 42px rgba(0, 0, 0, 0.32);
}

.book-reader-flip-sheet.is-turning.book-reader-flip-next {
    transform: rotateY(-180deg);
}

.book-reader-flip-sheet.book-reader-flip-prev {
    left: 0;
    transform-origin: right center;
}

.book-reader-flip-sheet.is-turning.book-reader-flip-prev {
    transform: rotateY(180deg);
}

.book-reader-flip-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 2px 7px 7px 2px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

.book-reader-flip-face canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.book-reader-flip-back {
    transform: rotateY(180deg);
}

.book-reader-flip-sheet.book-reader-flip-prev .book-reader-flip-back {
    transform: rotateY(-180deg);
}

.book-reader-flip-face::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(
            90deg,
            rgba(15, 23, 42, 0.12),
            transparent 14%,
            transparent 82%,
            rgba(15, 23, 42, 0.12)
        );
}

.book-reader-page-under,
.book-reader-page-under-prev {
    z-index: 1;
    transform: translateZ(0);
}

.book-reader-thumb {
    width: 84px;
    margin: 0 auto 10px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    background: #1e293b;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        transform 0.2s ease;
}

.book-reader-thumb:hover {
    transform: translateY(-1px);
}

.book-reader-thumb.active {
    border-color: var(--accent);
}

.book-reader-thumb canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #ffffff;
}

.book-reader-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 13px;
}

@media (max-width: 800px) {
    .book-reader-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .book-reader-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .book-reader-thumbnails {
        width: 72px;
        flex-basis: 72px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .book-reader-thumb {
        width: 58px;
    }

    .book-reader-book {
        width: min(82vw, 620px);
        height: min(72vh, 620px);
    }
}

@media (max-width: 520px) {
    .book-reader-thumbnails {
        display: none;
    }

    .book-reader-book {
        width: 92vw;
        height: 72vh;
    }

    .book-reader-controls .secondary-button {
        padding-left: 9px;
        padding-right: 9px;
    }
}

/* ==================== IMAGE GENERATOR ==================== */

.image-generator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 18px;
    align-items: start;
}

.image-generator-panel {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.image-generator-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.image-generator-panel-heading h2 {
    margin: 4px 0 0;
    font-size: 18px;
}

.image-generator-panel-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.eyebrow {
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.image-generator-model-badge {
    min-width: 180px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
}

.image-generator-model-badge span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.image-generator-model-badge strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.image-form {
    display: grid;
    gap: 18px;
}

.image-prompt-control {
    min-height: 180px;
}

.image-form-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.image-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.image-generator-side {
    display: grid;
    gap: 18px;
}

.image-status-card,
.image-info-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.image-status-card {
    background: linear-gradient(145deg, rgba(25, 199, 216, 0.07), var(--surface));
}

.image-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.image-status-header h3,
.image-info-card h3 {
    margin: 0;
    font-size: 15px;
}

.image-status-card p,
.image-info-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.image-info-card p + p {
    margin-top: 10px;
}

.status-badge.status-running {
    background: rgba(25, 199, 216, 0.14);
    color: var(--accent);
}

.status-badge.status-success {
    background: rgba(76, 220, 150, 0.12);
    color: #7ee2ad;
}

.status-badge.status-error {
    background: rgba(255, 92, 92, 0.12);
    color: #ff9c9c;
}

.image-result-card {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.image-result-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.image-result-heading h2 {
    margin: 4px 0 0;
    font-size: 18px;
}

.image-result-meta {
    max-width: 45%;
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
    text-align: right;
}

.image-preview-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}

.image-preview-frame img {
    display: block;
    width: min(100%, 1024px);
    height: auto;
    max-height: 720px;
    object-fit: contain;
}

.image-preview-frame video {
    display: block;
    width: min(100%, 1024px);
    height: auto;
    max-height: 720px;
    object-fit: contain;
}

.image-result-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 16px;
}

.image-result-details p {
    min-width: 0;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.image-result-actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

@media (max-width: 900px) {
    .image-generator-layout {
        grid-template-columns: 1fr;
    }

    .image-result-card {
        grid-column: auto;
    }
}

@media (max-width: 600px) {
    .image-generator-panel-heading,
    .image-result-heading,
    .image-result-details {
        align-items: stretch;
        flex-direction: column;
    }

    .image-generator-model-badge {
        width: 100%;
    }

    .image-form-options {
        grid-template-columns: 1fr;
    }

    .image-form-actions,
    .image-result-actions {
        width: 100%;
        flex-direction: column;
    }

    .image-form-actions .primary-button,
    .image-form-actions .secondary-button,
    .image-result-actions .primary-button,
    .image-result-actions .secondary-button {
        width: 100%;
    }

    .image-result-meta {
        max-width: none;
        text-align: left;
    }
}

/* ==================== IMAGE GENERATOR PROGRESS ==================== */

.image-progress {
    margin-top: 16px;
}

.image-progress[hidden] {
    display: none;
}

.image-progress-track {
    position: relative;
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.image-progress-bar {
    position: absolute;
    top: 0;
    left: -35%;
    width: 35%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    animation: image-progress-slide 1.4s ease-in-out infinite;
}

.image-progress-label {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

@keyframes image-progress-slide {
    0% {
        left: -35%;
    }

    50% {
        left: 65%;
    }

    100% {
        left: 100%;
    }
}

/* ==================== AI CHAT WORKSPACE ==================== */

.chat-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    margin-top: 18px;
}

.chat-main-panel,
.chat-settings-card,
.chat-info-card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.chat-main-panel {
    display: flex;
    min-height: 620px;
    flex-direction: column;
    overflow: hidden;
}

.chat-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.chat-panel-header h2 {
    margin: 5px 0 6px;
    font-size: 20px;
    line-height: 1.25;
}

.chat-panel-header p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.chat-model-badge {
    flex-shrink: 0;
    min-width: 190px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.chat-model-badge span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chat-model-badge strong {
    display: block;
    color: var(--text);
    font-size: 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
}

.chat-empty-state {
    display: flex;
    min-height: 420px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px 24px;
    text-align: center;
}

.chat-empty-icon {
    display: flex;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--accent);
    font-size: 24px;
}

.chat-empty-state h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.chat-empty-state p {
    max-width: 480px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.chat-message {
    display: flex;
    max-width: 82%;
    margin-bottom: 18px;
    flex-direction: column;
}

.chat-message-user {
    margin-left: auto;
    align-items: flex-end;
}

.chat-message-assistant {
    margin-right: auto;
    align-items: flex-start;
}

.chat-message-header {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.chat-message-content {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-2);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-message-user .chat-message-content {
    border-color: var(--accent);
}

.chat-message-assistant .chat-message-content {
    background: var(--surface);
}

.chat-composer {
    padding: 18px 20px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-input {
    display: block;
    width: 100%;
    min-height: 88px;
    max-height: 240px;
    resize: vertical;
}

.chat-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
}

.chat-input-hint {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.chat-actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

.chat-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.chat-side-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 18px;
}

.chat-settings-card,
.chat-info-card {
    padding: 18px;
}

.chat-side-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.chat-side-heading h3,
.chat-info-card h3 {
    margin: 0;
    font-size: 13px;
}

.chat-side-heading .status-badge {
    flex-shrink: 0;
}

.chat-status-message {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.chat-info-card {
    color: var(--muted);
}

.chat-info-card p {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.6;
}

@media (max-width: 1000px) {
    .chat-workspace {
        grid-template-columns: 1fr;
    }

    .chat-side-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .chat-panel-header,
    .chat-composer-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-model-badge {
        width: 100%;
    }

    .chat-message {
        max-width: 92%;
    }

    .chat-side-panel {
        display: flex;
    }

    .chat-actions {
        width: 100%;
    }

    .chat-actions button {
        flex: 1;
    }
}

/* ==================== AI CHAT GENERATION PROGRESS ==================== */

.chat-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface-muted, rgba(127, 127, 127, 0.06));
}

.chat-progress[hidden] {
    display: none;
}

.chat-progress-track {
    position: relative;
    flex: 1;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border-color);
}

.chat-progress-bar {
    position: absolute;
    top: 0;
    left: -35%;
    width: 35%;
    height: 100%;
    border-radius: inherit;
    background: currentColor;
    animation: chat-progress-slide 1.25s ease-in-out infinite;
}

.chat-progress-label {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
}

@keyframes chat-progress-slide {
    0% {
        left: -35%;
    }

    50% {
        left: 45%;
    }

    100% {
        left: 100%;
    }
}

/* ==================== IMAGE ANALYZER ==================== */

.analyzer-upload-preview {
    margin-top: 2px;
    min-height: 220px;
    max-height: 520px;
}

.analyzer-upload-preview img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.image-analyzer-result-content {
    display: grid;
    grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
    gap: 24px;
    align-items: start;
}

.image-analyzer-result-image {
    position: sticky;
    top: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
}

.image-analyzer-result-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 680px;
    object-fit: contain;
}

.image-analyzer-result-text {
    min-width: 0;
    padding: 4px 2px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.image-analyzer-result-text h1,
.image-analyzer-result-text h2,
.image-analyzer-result-text h3,
.image-analyzer-result-text h4 {
    margin: 0 0 10px;
    color: var(--text);
}

.image-analyzer-result-text h1 {
    font-size: 20px;
}

.image-analyzer-result-text h2 {
    margin-top: 20px;
    font-size: 17px;
}

.image-analyzer-result-text h3 {
    margin-top: 16px;
    font-size: 15px;
}

.image-analyzer-result-text p {
    margin: 0 0 12px;
}

.image-analyzer-result-text ul,
.image-analyzer-result-text ol {
    margin: 0 0 14px;
    padding-left: 22px;
}

.image-analyzer-result-text li + li {
    margin-top: 5px;
}

.image-analyzer-result-text strong {
    color: var(--text);
}

@media (max-width: 900px) {
    .image-analyzer-result-content {
        grid-template-columns: 1fr;
    }

    .image-analyzer-result-image {
        position: static;
    }
}


/* ============================================================
   WebDecky AI Studio — Premium Responsive UI Layer
   Scoped enhancements; existing feature-specific styles remain.
   ============================================================ */

:root {
    --wd-glass: rgba(17, 23, 32, 0.78);
    --wd-glass-strong: rgba(17, 23, 32, 0.92);
    --wd-border-soft: rgba(255, 255, 255, 0.07);
    --wd-border-accent: rgba(25, 199, 216, 0.24);
    --wd-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
    --wd-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.16);
}

/* ---------- App shell ---------- */

html {
    background: var(--bg);
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app-shell {
    min-height: 100dvh;
    isolation: isolate;
    background:
        radial-gradient(circle at 85% -10%, rgba(25, 199, 216, 0.10), transparent 32%),
        radial-gradient(circle at 5% 100%, rgba(25, 199, 216, 0.045), transparent 28%),
        var(--bg);
}

/* ---------- Topbar ---------- */

.topbar {
    height: calc(var(--topbar-height) + env(safe-area-inset-top));
    min-height: var(--topbar-height);
    padding-top: env(safe-area-inset-top);
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    background: rgba(8, 12, 17, 0.82);
    border-bottom-color: var(--wd-border-soft);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.brand {
    gap: 12px;
}

.brand-mark {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background:
        linear-gradient(145deg, rgba(25, 199, 216, 0.20), rgba(25, 199, 216, 0.05)),
        var(--surface);
    border-color: var(--wd-border-accent);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 24px rgba(25, 199, 216, 0.08);
}

.brand-name {
    letter-spacing: -0.02em;
}

.topbar-status {
    padding: 8px 12px;
    border: 1px solid var(--wd-border-soft);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
}

.status-dot {
    width: 7px;
    height: 7px;
}

/* ---------- WebDecky Header Navigation ---------- */

.brand {
    color: inherit;
    text-decoration: none;
    flex-shrink: 0;
}

.brand:hover {
    color: inherit;
}

.topbar-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
    margin-right: auto;
}

.topbar-link-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
}

.topbar-link-icon svg {
    width: 16px;
    height: 16px;
}

.topbar-links a,
.topbar-auth-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition:
        color 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.topbar-links a:hover,
.topbar-auth-link:hover {
    color: var(--text);
    background: rgba(25, 199, 216, 0.07);
    border-color: var(--wd-border-soft);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-auth {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-auth-link {
    color: var(--text);
    border-color: var(--wd-border-soft);
    background: rgba(255, 255, 255, 0.025);
}

/* ---------- Header Responsive Navigation ---------- */

@media (max-width: 1100px) {
    .topbar-links {
        gap: 2px;
        margin-right: 10px;
    }

    .topbar-links a {
        padding-left: 7px;
        padding-right: 7px;
    }
}

@media (max-width: 900px) {
    .topbar-links {
        display: none;
    }

    .topbar-actions {
        margin-left: auto;
    }
}

@media (max-width: 640px) {
    .topbar-actions {
        gap: 6px;
    }

    .topbar-auth {
        gap: 4px;
    }

    .topbar-auth-link {
        min-height: 34px;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 12px;
    }
}

/* ---------- Sidebar ---------- */

.sidebar {
    padding: 18px 12px;
    background:
        linear-gradient(180deg, rgba(17, 23, 32, 0.82), rgba(12, 17, 24, 0.92));
    border-right-color: var(--wd-border-soft);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.10);
}

.sidebar-nav {
    gap: 6px;
}

.nav-item {
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    gap: 12px;
    font-weight: 560;
    letter-spacing: -0.005em;
}

.nav-item:hover {
    transform: translateX(2px);
    background: rgba(255, 255, 255, 0.045);
    border-color: var(--wd-border-soft);
}

.nav-item.active {
    background:
        linear-gradient(90deg, rgba(25, 199, 216, 0.14), rgba(25, 199, 216, 0.045));
    border-color: rgba(25, 199, 216, 0.15);
    box-shadow:
        inset 3px 0 0 var(--accent),
        0 8px 24px rgba(0, 0, 0, 0.10);
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    color: var(--accent);
    font-size: 0;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    overflow: visible;
}

.sidebar-footer {
    margin: 10px 4px 0;
    padding: 15px 10px;
    border-top-color: var(--wd-border-soft);
}

/* ---------- Main workspace ---------- */

.main-content {
    padding: clamp(24px, 4vw, 48px);
    padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.view {
    width: 100%;
}

.page-heading {
    margin-bottom: 28px;
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 0.16em;
}

.page-heading h1 {
    font-weight: 760;
}

.page-heading p {
    max-width: 720px;
}

/* ---------- Dashboard ---------- */

.feature-grid {
    gap: 18px;
}

.feature-card {
    position: relative;
    min-height: 228px;
    overflow: hidden;
    padding: 25px;
    border-color: var(--wd-border-soft);
    border-radius: 17px;
    background:
        linear-gradient(145deg, rgba(19, 26, 36, 0.96), rgba(14, 20, 28, 0.90));
    box-shadow: var(--wd-shadow-soft);
}

.feature-card::before {
    content: "";
    position: absolute;
    width: 150px;
    height: 150px;
    top: -80px;
    right: -55px;
    border-radius: 50%;
    background: rgba(25, 199, 216, 0.07);
    filter: blur(2px);
    pointer-events: none;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--wd-border-accent);
    box-shadow: var(--wd-shadow);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
    border: 1px solid rgba(25, 199, 216, 0.14);
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(25, 199, 216, 0.15), rgba(25, 199, 216, 0.045));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

.feature-card h2 {
    position: relative;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.feature-card p {
    position: relative;
}

.feature-action {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 22px;
}

.dashboard-panel {
    margin-top: 20px;
    padding: 25px;
    border-color: var(--wd-border-soft);
    border-radius: 17px;
    background:
        linear-gradient(145deg, rgba(17, 23, 32, 0.90), rgba(14, 19, 27, 0.76));
    box-shadow: var(--wd-shadow-soft);
}

.architecture-badge {
    border-color: var(--wd-border-soft);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.025);
}

/* ---------- Generic controls ---------- */

.form-control,
select,
input,
textarea {
    border-radius: 11px;
}

button,
input,
textarea,
select {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid rgba(25, 199, 216, 0.65);
    outline-offset: 2px;
}

/* ---------- Touch targets ---------- */

@media (pointer: coarse) {
    .nav-item {
        min-height: 48px;
    }

    button {
        min-height: 44px;
    }

    .nav-item svg,
    .feature-icon svg {
        pointer-events: none;
    }
}

/* ---------- Tablet ---------- */

@media (max-width: 900px) {
    .topbar {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .sidebar {
        width: 82px;
        flex-basis: 82px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .nav-item {
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    .nav-item > span:not(.nav-icon),
    .sidebar-footer {
        display: none;
    }

    .nav-item:hover {
        transform: translateY(-1px);
    }

    .main-content {
        padding: 28px 22px;
    }

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

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
    .topbar {
        height: calc(60px + env(safe-area-inset-top));
        min-height: 60px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 18px;
    }

    .brand-name {
        font-size: 16px;
    }

    .brand-subtitle {
        display: none;
    }

    .topbar-status {
        display: none;
    }

    .workspace {
        min-height: calc(100dvh - 60px);
    }

    .sidebar {
        width: 64px;
        flex-basis: 64px;
        padding: 12px 7px;
    }

    .sidebar-nav {
        gap: 5px;
    }

    .nav-item {
        width: 50px;
        min-height: 48px;
        margin: 0 auto;
        border-radius: 13px;
    }

    .nav-icon {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
    }

    .nav-icon svg {
        width: 21px;
        height: 21px;
    }

    .main-content {
        min-width: 0;
        padding: 24px 14px;
        padding-bottom: max(30px, env(safe-area-inset-bottom));
    }

    .page-heading {
        margin-bottom: 22px;
    }

    .page-heading h1 {
        font-size: clamp(29px, 9vw, 38px);
    }

    .page-heading p {
        margin-top: 10px;
        font-size: 14px;
        line-height: 1.6;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .feature-card {
        min-height: 0;
        padding: 20px;
        border-radius: 15px;
    }

    .feature-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 17px;
    }

    .feature-card h2 {
        font-size: 18px;
    }

    .dashboard-panel {
        align-items: stretch;
        margin-top: 14px;
        padding: 20px;
        border-radius: 15px;
    }

    .architecture-badge {
        min-width: 0;
        margin-top: 16px;
    }
}

/* ---------- Very small phones ---------- */

@media (max-width: 390px) {
    .sidebar {
        width: 58px;
        flex-basis: 58px;
    }

    .nav-item {
        width: 46px;
    }

    .main-content {
        padding-left: 11px;
        padding-right: 11px;
    }

    .brand-name {
        font-size: 15px;
    }
}

/* ---------- PWA standalone mode ---------- */

@media (display-mode: standalone) {
    .topbar {
        box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
    }

    .main-content {
        padding-bottom: max(36px, env(safe-area-inset-bottom));
    }
}

/* ---------- Accessibility / low-motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ---------- Narrow landscape phones ---------- */

@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
    .topbar {
        height: calc(54px + env(safe-area-inset-top));
        min-height: 54px;
    }

    .sidebar {
        padding-top: 7px;
        padding-bottom: 7px;
    }

    .nav-item {
        min-height: 42px;
    }

    .main-content {
        padding-top: 18px;
    }
}


/* =========================================================
   WEBDECKY AI STUDIO — PREMIUM DASHBOARD
   Dashboard-scoped only. Existing AI tools remain untouched.
   ========================================================= */

#dashboard-view {
    position: relative;
    max-width: 1500px;
    margin: 0 auto;
    padding-bottom: 10px;
}

/* ---------- HERO ---------- */

#dashboard-view .studio-hero {
    position: relative;
    min-height: 500px;
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
    align-items: center;
    gap: 24px;
    overflow: hidden;
    margin: -4px 0 34px;
    padding: 54px 52px;
    border: 1px solid rgba(92, 111, 145, 0.28);
    border-radius: 28px;
    background:
        radial-gradient(circle at 76% 28%, rgba(96, 72, 255, 0.24), transparent 31%),
        radial-gradient(circle at 90% 78%, rgba(25, 199, 216, 0.14), transparent 28%),
        linear-gradient(135deg, #101827 0%, #0e1522 52%, #111a2d 100%);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

#dashboard-view .studio-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(11, 15, 20, 0.72), transparent 58%),
        linear-gradient(180deg, transparent 70%, rgba(11, 15, 20, 0.18));
}

#dashboard-view .studio-hero-content {
    position: relative;
    z-index: 3;
    max-width: 620px;
}

#dashboard-view .studio-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6fe7f1;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

#dashboard-view .studio-hero h1 {
    margin: 16px 0 22px;
    max-width: 650px;
    font-size: clamp(48px, 5.5vw, 78px);
    line-height: 0.98;
    letter-spacing: -0.055em;
    font-weight: 850;
}

#dashboard-view .studio-hero h1 span {
    display: block;
    background: linear-gradient(100deg, #f5f8ff 0%, #b6b8ff 42%, #7a6cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#dashboard-view .studio-hero h1 strong {
    display: block;
    background: linear-gradient(100deg, #72edf2 0%, #4e9dff 48%, #9177ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 850;
}

#dashboard-view .studio-hero-copy {
    max-width: 570px;
    margin: 0;
    color: #aeb9c9;
    font-size: 16px;
    line-height: 1.75;
}

#dashboard-view .studio-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

#dashboard-view .studio-primary-action,
#dashboard-view .studio-secondary-action {
    min-height: 48px;
    padding: 0 19px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

#dashboard-view .studio-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #061015;
    background: linear-gradient(135deg, #6de9ee, #43cbd9);
    box-shadow: 0 10px 30px rgba(25, 199, 216, 0.2);
}

#dashboard-view .studio-primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(25, 199, 216, 0.3);
}

#dashboard-view .studio-secondary-action {
    color: #e7edf7;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(151, 169, 198, 0.25);
}

#dashboard-view .studio-secondary-action:hover {
    transform: translateY(-2px);
    border-color: rgba(111, 231, 241, 0.45);
    background: rgba(111, 231, 241, 0.08);
}

#dashboard-view .studio-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 28px;
    color: #7f8ca0;
    font-size: 11px;
    font-weight: 650;
}

#dashboard-view .studio-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

#dashboard-view .studio-hero-meta i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #42d392;
    box-shadow: 0 0 10px rgba(66, 211, 146, 0.65);
}

/* ---------- CSS ART HERO VISUAL ---------- */

#dashboard-view .studio-hero-visual {
    position: relative;
    min-height: 430px;
    z-index: 2;
}

#dashboard-view .studio-scene {
    position: absolute;
    inset: 12px 0 0;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(130, 150, 190, 0.16);
    background:
        radial-gradient(circle at 52% 34%, rgba(122, 108, 255, 0.24), transparent 22%),
        linear-gradient(145deg, #151e34, #0b1220 68%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.045),
        0 20px 60px rgba(0, 0, 0, 0.3);
}

#dashboard-view .studio-scene-sky {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 25% 20%, rgba(89, 115, 255, 0.15), transparent 20%),
        radial-gradient(circle at 72% 25%, rgba(48, 218, 229, 0.13), transparent 20%);
}

#dashboard-view .studio-scene-horizon {
    position: absolute;
    left: 0;
    right: 0;
    top: 53%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(116, 140, 180, 0.22), transparent);
}

#dashboard-view .studio-scene-floor {
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: -30%;
    height: 65%;
    transform: perspective(400px) rotateX(63deg);
    transform-origin: center top;
    background:
        linear-gradient(rgba(84, 109, 150, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(84, 109, 150, 0.09) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

#dashboard-view .studio-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(35px);
    pointer-events: none;
}

#dashboard-view .studio-glow-one {
    width: 190px;
    height: 190px;
    right: 5%;
    top: 5%;
    background: rgba(113, 85, 255, 0.22);
}

#dashboard-view .studio-glow-two {
    width: 160px;
    height: 160px;
    left: 10%;
    bottom: 5%;
    background: rgba(25, 199, 216, 0.12);
}

#dashboard-view .studio-floating-card {
    position: absolute;
    z-index: 5;
    min-width: 135px;
    padding: 12px 14px;
    border: 1px solid rgba(151, 169, 198, 0.2);
    border-radius: 13px;
    background: rgba(17, 25, 41, 0.78);
    backdrop-filter: blur(14px);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.25);
}

#dashboard-view .studio-floating-card strong {
    display: block;
    margin-top: 3px;
    color: #eef3fb;
    font-size: 12px;
}

#dashboard-view .studio-floating-card small {
    display: block;
    margin-top: 2px;
    color: #7f8da4;
    font-size: 9px;
}

#dashboard-view .studio-mini-icon {
    color: #73e8ef;
    font-size: 16px;
}

#dashboard-view .studio-card-books {
    left: 7%;
    top: 13%;
    transform: rotate(-4deg);
}

#dashboard-view .studio-card-chat {
    right: 7%;
    top: 16%;
    transform: rotate(4deg);
}

#dashboard-view .studio-card-images {
    right: 9%;
    bottom: 10%;
    transform: rotate(3deg);
}

#dashboard-view .studio-chat-lines {
    display: flex;
    gap: 4px;
    margin-top: 7px;
}

#dashboard-view .studio-chat-lines i {
    display: block;
    width: 24px;
    height: 3px;
    border-radius: 4px;
    background: #54647e;
}

#dashboard-view .studio-chat-lines i:first-child {
    width: 40px;
    background: #667cff;
}

#dashboard-view .studio-image-preview {
    width: 82px;
    height: 30px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 7px;
    background:
        radial-gradient(circle at 25% 35%, #72e7ef 0 10%, transparent 11%),
        linear-gradient(135deg, #4c51a7, #1c9aa9);
}

#dashboard-view .studio-image-preview span {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, transparent 35%, rgba(255,255,255,0.18));
}

#dashboard-view .studio-book {
    position: absolute;
    z-index: 4;
    left: 50%;
    top: 57%;
    width: 280px;
    height: 165px;
    transform: translate(-50%, -50%) perspective(700px) rotateX(58deg) rotateZ(-7deg);
    filter: drop-shadow(0 28px 28px rgba(0,0,0,0.42));
}

#dashboard-view .studio-book-page {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    border: 1px solid rgba(140, 154, 190, 0.22);
    background:
        linear-gradient(90deg, rgba(255,255,255,0.025), rgba(255,255,255,0.1)),
        #182338;
}

#dashboard-view .studio-book-page-left {
    left: 0;
    border-radius: 13px 3px 3px 12px;
    transform: skewY(4deg);
}

#dashboard-view .studio-book-page-right {
    right: 0;
    border-radius: 3px 13px 12px 3px;
    transform: skewY(-4deg);
}

#dashboard-view .studio-book-page span {
    display: block;
    width: 60%;
    height: 3px;
    margin: 28px auto 0;
    border-radius: 4px;
    background: rgba(150, 170, 204, 0.2);
}

#dashboard-view .studio-book-page span + span {
    margin-top: 13px;
    width: 48%;
}

#dashboard-view .studio-book-spine {
    position: absolute;
    left: 50%;
    top: 3px;
    width: 10px;
    height: calc(100% - 6px);
    transform: translateX(-50%);
    background: linear-gradient(90deg, #101827, #6473a8, #101827);
    opacity: 0.8;
}

#dashboard-view .studio-orbit {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 54%;
    border: 1px solid rgba(94, 152, 255, 0.22);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
}

#dashboard-view .studio-orbit-one {
    width: 410px;
    height: 145px;
}

#dashboard-view .studio-orbit-two {
    width: 345px;
    height: 115px;
    transform: translate(-50%, -50%) rotate(25deg);
    border-color: rgba(78, 222, 230, 0.16);
}

/* ---------- TOOLS ---------- */

#dashboard-view .studio-tools-section {
    margin-top: 20px;
}

#dashboard-view .studio-section-heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

#dashboard-view .studio-section-heading h2 {
    margin: 9px 0 7px;
    font-size: clamp(25px, 3vw, 34px);
    letter-spacing: -0.035em;
}

#dashboard-view .studio-section-heading p {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
    font-size: 14px;
}

#dashboard-view .studio-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

#dashboard-view .studio-feature-card {
    position: relative;
    min-height: 172px;
    display: flex;
    align-items: flex-start;
    gap: 17px;
    padding: 24px;
    overflow: hidden;
    text-align: left;
    color: var(--text);
    border: 1px solid rgba(92, 111, 145, 0.24);
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(22, 31, 46, 0.98), rgba(15, 22, 34, 0.98));
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#dashboard-view .studio-feature-card::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -75px;
    bottom: -95px;
    border-radius: 50%;
    background: rgba(73, 102, 255, 0.1);
    filter: blur(25px);
    pointer-events: none;
}

#dashboard-view .studio-feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(93, 208, 225, 0.38);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

#dashboard-view .studio-feature-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #78e9ef;
    font-size: 21px;
    background: linear-gradient(145deg, rgba(25, 199, 216, 0.14), rgba(102, 87, 255, 0.12));
    border: 1px solid rgba(100, 160, 220, 0.17);
}

#dashboard-view .studio-feature-content {
    position: relative;
    z-index: 2;
}

#dashboard-view .studio-feature-content h3 {
    margin: 1px 0 7px;
    font-size: 18px;
    letter-spacing: -0.015em;
}

#dashboard-view .studio-feature-content p {
    max-width: 510px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

#dashboard-view .studio-feature-content span {
    display: inline-flex;
    gap: 8px;
    margin-top: 14px;
    color: #65dfe9;
    font-size: 11px;
    font-weight: 750;
}

#dashboard-view .studio-feature-content span b {
    font-size: 14px;
}

/* ---------- ARCHITECTURE ---------- */

#dashboard-view .studio-architecture {
    position: relative;
    min-height: 260px;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(430px, 1.15fr);
    align-items: center;
    gap: 35px;
    margin-top: 30px;
    padding: 38px 42px;
    overflow: hidden;
    border: 1px solid rgba(92, 111, 145, 0.24);
    border-radius: 22px;
    background:
        radial-gradient(circle at 80% 50%, rgba(78, 99, 255, 0.11), transparent 35%),
        #111925;
}

#dashboard-view .studio-architecture-copy h2 {
    margin: 10px 0 10px;
    font-size: clamp(25px, 3vw, 34px);
    letter-spacing: -0.035em;
}

#dashboard-view .studio-architecture-copy p {
    max-width: 590px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

#dashboard-view .studio-architecture-points {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 20px;
}

#dashboard-view .studio-architecture-points span {
    padding: 8px 10px;
    border: 1px solid rgba(100, 120, 150, 0.2);
    border-radius: 8px;
    color: #aeb9c9;
    background: rgba(255,255,255,0.025);
    font-size: 10px;
    font-weight: 700;
}

#dashboard-view .studio-architecture-points b {
    color: #6fe7f1;
    margin-right: 5px;
}

#dashboard-view .studio-architecture-visual {
    position: relative;
    min-height: 175px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dashboard-view .studio-arch-node {
    position: absolute;
    z-index: 3;
    width: 126px;
    padding: 14px 10px;
    text-align: center;
    border: 1px solid rgba(106, 130, 168, 0.25);
    border-radius: 12px;
    background: rgba(18, 27, 43, 0.92);
    box-shadow: 0 15px 30px rgba(0,0,0,0.22);
}

#dashboard-view .studio-arch-node strong {
    display: block;
    color: #edf3fc;
    font-size: 12px;
}

#dashboard-view .studio-arch-node small {
    display: block;
    margin-top: 4px;
    color: #75849b;
    font-size: 9px;
}

#dashboard-view .studio-arch-fastapi {
    left: 0;
}

#dashboard-view .studio-arch-api {
    right: 0;
}

#dashboard-view .studio-arch-device {
    position: relative;
    z-index: 3;
    width: 180px;
    height: 118px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(131, 150, 190, 0.25);
    background: #0a101b;
    box-shadow: 0 20px 45px rgba(0,0,0,0.3);
}

#dashboard-view .studio-device-screen {
    height: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background:
        radial-gradient(circle at 50% 35%, rgba(93, 109, 255, 0.22), transparent 35%),
        #121d31;
    border: 1px solid rgba(109, 130, 175, 0.15);
}

#dashboard-view .studio-device-screen span {
    color: #71e6ef;
    font-size: 27px;
    font-weight: 900;
}

#dashboard-view .studio-device-screen small {
    margin-top: 1px;
    color: #dbe3f1;
    font-size: 10px;
    font-weight: 750;
}

#dashboard-view .studio-device-screen em {
    margin-top: 3px;
    color: #6d7d96;
    font-size: 8px;
    font-style: normal;
}

#dashboard-view .studio-device-base {
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 120px;
    height: 7px;
    transform: translateX(-50%);
    border-radius: 0 0 8px 8px;
    background: #27334a;
}

#dashboard-view .studio-arch-connector {
    position: absolute;
    z-index: 1;
    top: 50%;
    width: 130px;
    height: 1px;
    background: linear-gradient(90deg, rgba(83, 216, 226, 0.1), rgba(83, 216, 226, 0.45), rgba(83, 216, 226, 0.1));
}

#dashboard-view .studio-connector-left {
    left: 84px;
}

#dashboard-view .studio-connector-right {
    right: 84px;
}

/* ---------- SHARED SITE FOOTER ---------- */

.site-footer {
    width: 100%;
    max-width: 1500px;
    margin: 18px auto 0;
    padding: 30px 0 0;
    border-top: 1px solid var(--wd-border-soft);
}

.site-footer-inner {
    display: grid;
    grid-template-columns: minmax(250px, 1.7fr) repeat(4, minmax(130px, 1fr));
    gap: 34px;
}

.site-footer-brand {
    min-width: 0;
}

.site-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
}

.site-footer-logo-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    background:
        linear-gradient(145deg, rgba(25, 199, 216, 0.18), rgba(25, 199, 216, 0.04)),
        var(--surface);
    border: 1px solid var(--wd-border-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.site-footer-logo-mark img {
    width: 30px;
    height: 30px;
    display: block;
    object-fit: contain;
}

.site-footer-logo strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.site-footer-logo small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.site-footer-brand > p {
    max-width: 330px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.site-footer-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
}

.site-footer-column h3 {
    margin: 3px 0 7px;
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.site-footer-column a {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    text-decoration: none;
    transition:
        color 0.18s ease,
        transform 0.18s ease;
}

.site-footer-column a:hover {
    color: var(--accent);
    transform: translateX(2px);
}

.site-footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 30px;
    padding: 18px 0 max(18px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--wd-border-soft);
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

@media (max-width: 1050px) {
    .site-footer-inner {
        grid-template-columns: minmax(230px, 1.6fr) repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 700px) {
    .site-footer {
        margin-top: 38px;
        padding-top: 26px;
    }

    .site-footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 24px;
    }

    .site-footer-brand {
        grid-column: 1 / -1;
    }

    .site-footer-brand > p {
        max-width: 520px;
    }

    .site-footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .site-footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .site-footer-brand {
        grid-column: auto;
    }

    .site-footer-column {
        gap: 8px;
    }
}

/* ---------- RESPONSIVE ---------- */


@media (max-width: 1050px) {
    #dashboard-view .studio-hero {
        grid-template-columns: 1fr;
        padding: 44px;
    }

    #dashboard-view .studio-hero-content {
        max-width: 720px;
    }

    #dashboard-view .studio-hero-visual {
        min-height: 370px;
    }

    #dashboard-view .studio-architecture {
        grid-template-columns: 1fr;
    }

    #dashboard-view .studio-architecture-visual {
        min-height: 190px;
    }
}

@media (max-width: 700px) {
    #dashboard-view .studio-hero {
        min-height: 0;
        margin-top: 0;
        padding: 32px 24px;
        border-radius: 20px;
    }

    #dashboard-view .studio-hero h1 {
        font-size: clamp(42px, 13vw, 62px);
    }

    #dashboard-view .studio-hero-copy {
        font-size: 14px;
    }

    #dashboard-view .studio-hero-visual {
        min-height: 320px;
    }

    #dashboard-view .studio-scene {
        border-radius: 18px;
    }

    #dashboard-view .studio-book {
        width: 220px;
        height: 132px;
    }

    #dashboard-view .studio-orbit-one {
        width: 310px;
        height: 115px;
    }

    #dashboard-view .studio-orbit-two {
        width: 265px;
        height: 90px;
    }

    #dashboard-view .studio-floating-card {
        min-width: 110px;
        padding: 9px 10px;
    }

    #dashboard-view .studio-feature-grid {
        grid-template-columns: 1fr;
    }

    #dashboard-view .studio-feature-card {
        min-height: 145px;
    }

    #dashboard-view .studio-architecture {
        padding: 28px 22px;
        border-radius: 18px;
    }

    #dashboard-view .studio-architecture-visual {
        transform: scale(0.82);
        transform-origin: center;
        margin: -15px -35px;
    }

    #dashboard-view .studio-footer {
        grid-template-columns: 1fr;
        gap: 14px;
        padding-top: 20px;
    }

    #dashboard-view .studio-footer-divider {
        display: none;
    }

    #dashboard-view .studio-footer-links {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    #dashboard-view .studio-hero {
        padding: 28px 18px;
    }

    #dashboard-view .studio-hero-actions {
        flex-direction: column;
    }

    #dashboard-view .studio-primary-action,
    #dashboard-view .studio-secondary-action {
        width: 100%;
        justify-content: center;
    }

    #dashboard-view .studio-hero-meta {
        gap: 10px 14px;
    }

    #dashboard-view .studio-hero-visual {
        min-height: 270px;
    }

    #dashboard-view .studio-card-books {
        left: 3%;
    }

    #dashboard-view .studio-card-chat {
        right: 3%;
    }

    #dashboard-view .studio-card-images {
        right: 3%;
        bottom: 4%;
    }

    #dashboard-view .studio-book {
        width: 185px;
        height: 110px;
    }

    #dashboard-view .studio-orbit-one {
        width: 255px;
        height: 90px;
    }

    #dashboard-view .studio-orbit-two {
        width: 220px;
        height: 72px;
    }

    #dashboard-view .studio-architecture-visual {
        transform: scale(0.65);
        margin: -28px -70px;
    }

    #dashboard-view .studio-footer-links span:nth-last-child(-n+2) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    #dashboard-view .studio-primary-action,
    #dashboard-view .studio-secondary-action,
    #dashboard-view .studio-feature-card {
        transition: none;
    }
}

/* ---------- WebDecky Header Login Dropdown ---------- */

.topbar-login-menu {
    position: relative;
}

.topbar-login-toggle {
    cursor: pointer;
    gap: 6px;
}

.topbar-login-chevron {
    font-size: 11px;
    line-height: 1;
    opacity: 0.75;
    transition: transform 0.18s ease;
}

.topbar-login-toggle[aria-expanded="true"] .topbar-login-chevron {
    transform: rotate(180deg);
}

.topbar-login-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    min-width: 170px;
    padding: 6px;
    border: 1px solid var(--wd-border-soft);
    border-radius: 10px;
    background: var(--panel, #111820);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
}

.topbar-login-dropdown[hidden] {
    display: none;
}

.topbar-login-option {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 7px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition:
        color 0.18s ease,
        background 0.18s ease;
}

.topbar-login-option:hover {
    color: var(--text);
    background: rgba(25, 199, 216, 0.08);
}

/* ---------- WebDecky Header User Avatar ---------- */

.topbar-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: block;
    border-radius: 9999px;
    object-fit: cover;
    overflow: hidden;
}

.topbar-user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- WebDecky AI Login Required Popup ---------- */

.login-required-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.login-required-overlay.is-visible {
    display: flex;
}

.login-required-card {
    position: relative;
    width: min(420px, 100%);
    padding: 32px 28px 26px;
    border: 1px solid var(--wd-border-soft);
    border-radius: 16px;
    background: var(--panel, #111820);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.login-required-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.login-required-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.login-required-icon {
    margin-bottom: 12px;
    font-size: 34px;
    line-height: 1;
}

.login-required-card h2 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 22px;
}

.login-required-card p {
    margin: 0 auto 22px;
    max-width: 330px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.login-required-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(50% - 7px);
    min-height: 42px;
    margin: 0 5px 14px;
    padding: 0 16px;
    border: 1px solid var(--wd-border-soft);
    border-radius: 9px;
    background: var(--primary, #19c7d8);
    color: #071014;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    box-sizing: border-box;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.login-required-button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

@media (max-width: 520px) {
    .login-required-button {
        width: calc(100% - 10px);
        margin-bottom: 12px;
    }
}

.login-required-cancel {
    display: block;
    margin: 12px auto 0;
    padding: 6px 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}

.login-required-cancel:hover {
    color: var(--text);
}


/* Website settings */
.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.settings-form {
    max-width: 980px;
}

.settings-upload-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.settings-upload-card {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    background: var(--surface-color, rgba(255, 255, 255, 0.025));
}

.settings-preview {
    width: 86px;
    height: 86px;
    flex: 0 0 86px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-preview img {
    display: block;
    max-width: 78px;
    max-height: 78px;
    object-fit: contain;
}

.settings-favicon-preview img {
    width: 52px;
    height: 52px;
}

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

.settings-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.settings-save-status {
    min-height: 20px;
    font-size: 0.9rem;
}

.settings-save-status.success {
    color: #69d391;
}

.settings-save-status.error {
    color: #ff7b7b;
}

@media (max-width: 760px) {
    .settings-upload-row {
        grid-template-columns: 1fr;
    }

    .settings-upload-card {
        align-items: flex-start;
    }
}

/* Footer navigation editor */
.footer-settings-logo-card {
    margin-bottom: 20px;
}

.footer-links-editor {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    background: var(--surface-color, rgba(255, 255, 255, 0.025));
}

.footer-links-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.footer-links-editor-header h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.footer-links-editor-header .form-hint {
    margin: 0;
}

.footer-link-column {
    padding: 18px;
    margin-top: 16px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.footer-link-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.footer-link-column-header h5 {
    margin: 0;
    font-size: 0.95rem;
}

.footer-link-column-actions,
.footer-link-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-top: 10px;
}

.footer-link-row .form-field {
    margin: 0;
}

.footer-link-row .form-label {
    font-size: 0.8rem;
}

.footer-link-row .form-control {
    width: 100%;
}

.footer-links-empty {
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 10px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.75;
}

.footer-link-add {
    margin-top: 12px;
}

.footer-link-remove,
.footer-column-remove {
    min-height: 40px;
    padding: 8px 12px;
}

@media (max-width: 760px) {
    .footer-links-editor-header {
        flex-direction: column;
    }

    .footer-link-column-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer-link-row {
        grid-template-columns: 1fr;
    }

    .footer-link-row .footer-link-actions {
        justify-content: flex-end;
    }
}

/* ================================================================
   AI GRAPHIC DESIGN WORKSPACE
================================================================ */

.graphic-design-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 280px;
    min-height: 850px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.graphic-design-tools-panel,
.graphic-design-properties-panel {
    background: var(--surface-2);
    min-width: 0;
}

.graphic-design-tools-panel {
    border-right: 1px solid var(--border);
    padding: 22px;
}

.graphic-design-properties-panel {
    border-left: 1px solid var(--border);
}

.graphic-design-panel-heading {
    margin-bottom: 16px;
}

.graphic-design-panel-heading .eyebrow {
    display: inline;
    margin-bottom: 0;
    margin-right: 6px;
}

.graphic-design-panel-heading h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 750;
}

.graphic-design-tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.graphic-design-tool {
    min-height: 84px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.graphic-design-tool:hover,
.graphic-design-tool.active {
    border-color: rgba(25, 199, 216, .45);
    background: var(--accent-soft);
    color: var(--text);
}

.graphic-design-tool-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 700;
}

.graphic-design-tool-actions,
.graphic-design-ai-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.graphic-design-upload-button {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.graphic-design-panel-divider {
    height: 1px;
    margin: 20px 0;
    background: var(--border);
}

.graphic-design-editor-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #080c11;
}

.graphic-design-toolbar {
    min-height: 76px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.graphic-design-toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.graphic-design-toolbar-group strong {
    font-size: 14px;
    white-space: nowrap;
}

.graphic-design-toolbar-group span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.graphic-design-toolbar-actions {
    flex-shrink: 0;
}

.graphic-design-toolbar-actions .primary-button,
.graphic-design-toolbar-actions .secondary-button {
    min-height: 38px;
}

.graphic-design-canvas-stage {
    flex: 1;
    min-height: 700px;
    padding: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background:
        linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,.025) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,.025) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.025) 75%),
        #080c11;
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

/* Checkerboard is editor-only; it is not part of canvas exports. */
.graphic-design-canvas-wrapper {
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #d7dce3 25%, transparent 25%),
        linear-gradient(-45deg, #d7dce3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d7dce3 75%),
        linear-gradient(-45deg, transparent 75%, #d7dce3 75%);
    background-size: 20px 20px;
    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;
}

.graphic-design-canvas-wrapper {
    position: relative;
    width: min(
        1400px,
        calc(100% - 20px),
        calc((100vh - 240px) * 1.7777778)
    );
    height: auto;
    aspect-ratio: 1200 / 675;
    flex-shrink: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    background-color: #ffffff;
    overflow: hidden;
}

#graphic-design-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: default;
}

.graphic-design-statusbar {
    min-height: 38px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
}

.graphic-design-properties-section {
    padding: 18px;
    border-bottom: 1px solid var(--border);
}

.graphic-design-empty-state {
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .015);
    color: var(--muted);
}

.graphic-design-empty-state strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
    font-size: 13px;
}

.graphic-design-empty-state p {
    margin: 0;
    line-height: 1.55;
    font-size: 12px;
}

.graphic-design-color-input {
    width: 100%;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.graphic-design-delete-button {
    width: 100%;
    margin-top: 4px;
}

.graphic-design-layers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.graphic-design-layer {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
    color: var(--muted);
    text-align: left;
    cursor: pointer;
}

.graphic-design-layer:hover,
.graphic-design-layer.active {
    border-color: rgba(25, 199, 216, .35);
    background: var(--accent-soft);
    color: var(--text);
}

.graphic-design-layer-icon {
    width: 24px;
    flex: 0 0 24px;
    text-align: center;
}

.graphic-design-layer-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.graphic-design-layer-type {
    margin-left: auto;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
}

.graphic-design-properties-panel .form-field {
    margin-bottom: 14px;
}

.graphic-design-properties-panel .form-field[hidden] {
    display: none !important;
}

.graphic-design-properties-panel .form-label {
    font-size: 12px;
}

@media (max-width: 1180px) {
    .graphic-design-workspace {
        grid-template-columns: 190px minmax(0, 1fr) 230px;
    }

    .graphic-design-tools-panel {
        padding: 14px;
    }

    .graphic-design-properties-section {
        padding: 14px;
    }
}

@media (max-width: 900px) {
    .graphic-design-workspace {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .graphic-design-properties-panel {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .graphic-design-properties-section {
        border-bottom: 0;
    }

    .graphic-design-properties-section + .graphic-design-properties-section {
        border-left: 1px solid var(--border);
    }
}

@media (max-width: 680px) {
    .graphic-design-workspace {
        display: flex;
        flex-direction: column;
    }

    .graphic-design-tools-panel {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .graphic-design-tool-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .graphic-design-tool {
        min-height: 58px;
    }

    .graphic-design-tool-actions,
    .graphic-design-ai-tools {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .graphic-design-canvas-stage {
        min-height: 400px;
        padding: 16px;
    }

    .graphic-design-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .graphic-design-toolbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .graphic-design-properties-panel {
        display: flex;
        flex-direction: column;
    }

    .graphic-design-properties-section + .graphic-design-properties-section {
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

.graphic-design-shadow-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #cbd5e1;
}

.graphic-design-shadow-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.graphic-design-shadow-section {
    margin-top: 14px;
}


/* Graphic Design canvas interaction stability */
.graphic-design-canvas-stage {
    overscroll-behavior: contain;
    overflow-anchor: none;
}

.graphic-design-canvas-wrapper {
    overflow-anchor: none;
}

#graphic-design-canvas {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

/* Graphic Design: full-width workspace */
#graphic-design-view {
    max-width: none;
    width: 100%;
    margin: 0;
}


/* Graphic Design context menu */
.graphic-design-context-menu {
    position: fixed;
    z-index: 10000;
    display: none;
    min-width: 150px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}

.graphic-design-context-menu.visible {
    display: block;
}

.graphic-design-context-menu button {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.graphic-design-context-menu button:hover {
    background: var(--accent-soft);
}

/* Graphic Design text editing overlay */
.graphic-design-text-editor {
    position: absolute;
    z-index: 20;
    margin: 0;
    padding: 0;
    border: 1px dashed #2563eb;
    outline: none;
    resize: none;
    overflow: hidden;
    background: rgba(255, 255, 255, .04);
    font-family: inherit;
    font-weight: 400;
    font-style: normal;
    text-decoration: none;
    text-transform: none;
    white-space: pre;
    box-sizing: border-box;
    cursor: text;
}


/* Graphic Design Create Design modal */

.graphic-design-create-overlay {
    position: fixed;
    inset: 0;
    z-index: 5200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 8, 15, 0.72);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

.graphic-design-create-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.graphic-design-create-card {
    width: min(650px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    overflow: auto;
    border: 1px solid var(--wd-border-soft);
    border-radius: 20px;
    background: var(--panel, #111820);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .5);
    transform: translateY(12px) scale(.985);
    transition: transform .18s ease;
}

.graphic-design-create-overlay.is-visible .graphic-design-create-card {
    transform: translateY(0) scale(1);
}

.graphic-design-create-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 24px 18px;
    border-bottom: 1px solid var(--wd-border-soft);
}

.graphic-design-create-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.graphic-design-create-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 13px;
    background: var(--accent-soft, rgba(37, 99, 235, .12));
    color: var(--accent, #60a5fa);
    font-size: 21px;
}

.graphic-design-create-heading h2 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 21px;
    font-weight: 700;
}

.graphic-design-create-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.graphic-design-create-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.graphic-design-create-close:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--text);
}

.graphic-design-create-body {
    padding: 22px 24px 8px;
}

.graphic-design-create-label {
    display: block;
    margin: 0 0 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
}

.graphic-design-create-select-wrap {
    position: relative;
}

.graphic-design-create-size {
    width: 100%;
    min-height: 44px;
}

.graphic-design-create-dimensions {
    margin: 8px 2px 20px;
    color: var(--muted);
    font-size: 12px;
}

.graphic-design-create-custom-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: -8px 0 20px;
}

.graphic-design-create-custom-fields input {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--wd-border-soft);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font: inherit;
}

.graphic-design-create-textarea-wrap {
    position: relative;
}

.graphic-design-create-prompt {
    display: block;
    width: 100%;
    min-height: 165px;
    box-sizing: border-box;
    padding: 13px 14px 13px 40px;
    border: 1px solid var(--wd-border-soft);
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    line-height: 1.55;
    resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.graphic-design-create-prompt:focus {
    border-color: var(--accent, #60a5fa);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.graphic-design-create-prompt::placeholder {
    color: var(--muted);
    opacity: .75;
}

.graphic-design-create-textarea-icon {
    position: absolute;
    top: 13px;
    left: 14px;
    color: var(--accent, #60a5fa);
    font-size: 15px;
    pointer-events: none;
}

.graphic-design-create-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .12) !important;
}

.graphic-design-create-hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.graphic-design-create-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 24px 24px;
}

.graphic-design-create-cancel,
.graphic-design-create-submit {
    min-height: 42px;
    padding: 9px 16px;
    border-radius: 9px;
}

@media (max-width: 640px) {
    .graphic-design-create-overlay {
        padding: 12px;
    }

    .graphic-design-create-card {
        max-height: calc(100vh - 24px);
        border-radius: 16px;
    }

    .graphic-design-create-header,
    .graphic-design-create-body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .graphic-design-create-footer {
        padding: 16px 18px 18px;
    }
}

.graphic-design-size-control label {
    white-space: nowrap;
}

.graphic-design-background-mode {
    margin-top: 12px;
}

.graphic-design-gradient-controls {
    margin-top: 12px;
}

.graphic-design-gradient-colors,
.graphic-design-gradient-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.graphic-design-gradient-color,
.graphic-design-gradient-options > div {
    min-width: 0;
}

.graphic-design-gradient-presets {
    margin-top: 12px;
}

.graphic-design-gradient-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.graphic-design-gradient-preset {
    min-height: 34px;
    padding: 7px 8px;
    font-size: 11px;
}

@media (max-width: 1100px) {
    .graphic-design-gradient-colors,
    .graphic-design-gradient-options {
        grid-template-columns: 1fr;
    }
}

/* ---------- Refined Premium AI Header Navigation ---------- */

.topbar-links {
    gap: 8px;
    margin-left: auto;
    margin-right: auto;
}

.topbar-links a {
    position: relative;
    min-height: 44px;
    padding: 0 14px;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #c4ccd7;
    font-size: 15.5px;
    font-weight: 750;
    letter-spacing: -0.05px;
    line-height: 1;
    background: transparent;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.topbar-link-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    line-height: 1;
    filter: saturate(1.12);
    transform-origin: center;
    transition:
        transform 0.2s ease,
        filter 0.2s ease;
}

.topbar-link-icon svg {
    width: 24px;
    height: 24px;
}

.topbar-links a:hover {
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            rgba(25, 199, 216, 0.11),
            rgba(255, 255, 255, 0.035)
        );
    border-color: rgba(25, 199, 216, 0.24);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.18),
        0 0 18px rgba(25, 199, 216, 0.055);
    transform: translateY(-1px);
}

.topbar-links a:hover .topbar-link-icon {
    transform: scale(1.12);
    filter: saturate(1.3) drop-shadow(0 0 5px rgba(255, 255, 255, 0.12));
}

/* Individual tool identity */

.topbar-icon-video {
    filter: saturate(1.2) drop-shadow(0 0 5px rgba(255, 80, 80, 0.12));
}

.topbar-icon-graphic {
    filter: saturate(1.2) drop-shadow(0 0 5px rgba(255, 190, 70, 0.12));
}

.topbar-icon-image {
    filter: saturate(1.2) drop-shadow(0 0 5px rgba(80, 170, 255, 0.12));
}

.topbar-icon-books {
    filter: saturate(1.2) drop-shadow(0 0 5px rgba(190, 120, 255, 0.12));
}

.topbar-icon-webdecky {
    filter: saturate(1.25) drop-shadow(0 0 6px rgba(139, 92, 246, 0.18));
}

.topbar-icon-webdecky svg {
    width: 25px;
    height: 25px;
}

.topbar-links a:hover .topbar-icon-webdecky {
    filter: saturate(1.45) drop-shadow(0 0 9px rgba(139, 92, 246, 0.32));
}

.topbar-links a:hover .topbar-icon-video {
    filter: saturate(1.4) drop-shadow(0 0 8px rgba(255, 80, 80, 0.25));
}

.topbar-links a:hover .topbar-icon-graphic {
    filter: saturate(1.4) drop-shadow(0 0 8px rgba(255, 190, 70, 0.25));
}

.topbar-links a:hover .topbar-icon-image {
    filter: saturate(1.4) drop-shadow(0 0 8px rgba(80, 170, 255, 0.25));
}

.topbar-links a:hover .topbar-icon-books {
    filter: saturate(1.4) drop-shadow(0 0 8px rgba(190, 120, 255, 0.25));
}

/* Subtle active-page treatment */

.topbar-links a[aria-current="page"] {
    color: #ffffff;
    background: rgba(25, 199, 216, 0.10);
    border-color: rgba(25, 199, 216, 0.26);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 4px 16px rgba(0, 0, 0, 0.14);
}

.topbar-links a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 3px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(25, 199, 216, 0.45);
}

/* Compact desktop width */

@media (max-width: 1100px) {
    .topbar-links {
        gap: 4px;
        margin-right: 8px;
    }

    .topbar-links a {
        min-height: 42px;
        padding-left: 9px;
        padding-right: 9px;
        gap: 7px;
        font-size: 14px;
    }

    .topbar-link-icon {
        width: 23px;
        height: 23px;
        flex-basis: 23px;
        font-size: 21px;
    }
}


/* ---------- Colorful Premium Sidebar Icons ---------- */

.nav-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    color: #19c7d8;
    font-size: 0;
    transition:
        color 0.2s ease,
        transform 0.2s ease,
        filter 0.2s ease;
}

.nav-icon svg {
    width: 21px;
    height: 21px;
    display: block;
    overflow: visible;
    stroke: currentColor;
    transition:
        transform 0.2s ease,
        filter 0.2s ease;
}

/* Individual sidebar tool colors */

.nav-item[data-view="books"] .nav-icon {
    color: #b78cff;
}

.nav-item[data-view="chat"] .nav-icon {
    color: #58a6ff;
}

.nav-item[data-view="graphic-design"] .nav-icon {
    color: #ffb454;
}

.nav-item[data-view="images"] .nav-icon {
    color: #55c7ff;
}

.nav-item[data-view="gif"] .nav-icon {
    color: #ff72b6;
}

.nav-item[data-view="video"] .nav-icon {
    color: #ff6678;
}

.nav-item[data-view="analyzer"] .nav-icon {
    color: #19c7d8;
}

.nav-item[data-view="upscaler"] .nav-icon {
    color: #42d392;
}

.nav-item[data-view="background-changer"] .nav-icon {
    color: #a78bfa;
}

.nav-item[data-view="status"] .nav-icon {
    color: #4ade80;
}

.nav-item[data-view="settings"] .nav-icon {
    color: #f6c85f;
}

/* Subtle matching glow */

.nav-item[data-view="books"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(183, 140, 255, 0.22));
}

.nav-item[data-view="chat"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(88, 166, 255, 0.22));
}

.nav-item[data-view="graphic-design"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(255, 180, 84, 0.22));
}

.nav-item[data-view="images"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(85, 199, 255, 0.22));
}

.nav-item[data-view="gif"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(255, 114, 182, 0.22));
}

.nav-item[data-view="video"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(255, 102, 120, 0.22));
}

.nav-item[data-view="analyzer"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(25, 199, 216, 0.22));
}

.nav-item[data-view="upscaler"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(66, 211, 146, 0.22));
}

.nav-item[data-view="background-changer"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(167, 139, 250, 0.22));
}

.nav-item[data-view="status"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.22));
}

.nav-item[data-view="settings"] .nav-icon svg {
    filter: drop-shadow(0 0 5px rgba(246, 200, 95, 0.22));
}

/* Beautiful hover interaction */

.nav-item:hover .nav-icon {
    transform: translateX(1px) scale(1.08);
}

.nav-item:hover .nav-icon svg {
    filter: drop-shadow(0 0 8px currentColor);
    transform: scale(1.05);
}

/* Active item keeps its own color while gaining a soft glow */

.nav-item.active .nav-icon {
    filter: saturate(1.15);
}

.nav-item.active .nav-icon svg {
    filter: drop-shadow(0 0 9px currentColor);
    transform: scale(1.06);
}

/* Keep sidebar text clean and professional */

.nav-item > span:last-child {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}


/* ---------- Refined Footer Typography & Links ---------- */

.site-footer-brand strong {
    font-size: 18px;
    font-weight: 750;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.site-footer-brand p {
    font-size: 14px;
    line-height: 1.7;
    margin-top: 12px;
    max-width: 430px;
}

.site-footer-column h3 {
    font-size: 14px;
    font-weight: 750;
    letter-spacing: 0.01em;
    margin-bottom: 13px;
}

.site-footer-column a {
    font-size: 14px;
    line-height: 1.5;
    font-weight: 550;
    transition:
        color 0.18s ease,
        transform 0.18s ease;
}

.site-footer-column a:hover {
    color: var(--text);
    transform: translateX(3px);
}

.site-footer-logo {
    gap: 11px;
}

.site-footer-logo-mark {
    width: 38px;
    height: 38px;
}

.site-footer-logo-mark img {
    width: 27px;
    height: 27px;
}

.site-footer-bottom {
    font-size: 13px;
    line-height: 1.5;
}

.site-footer-bottom span:last-child {
    font-weight: 600;
}

/* Book Studio is hidden from the AI Studio interface; backend and data remain intact. */
a[data-topbar-view="books"],
button[data-view="books"],
button[data-open-view="books"],
#books-view {
    display: none !important;
}


/* Path-mounted iframe mode: keep the Studio chrome hidden only when requested. */
body[data-embed-mode="true"] .topbar,
body[data-embed-mode="true"] .site-footer {
    display: none !important;
}

body[data-embed-mode="true"] .app-shell {
    min-height: 0;
}


/* Graphic Design: prevent properties panel from shifting canvas */
#graphic-design-view .graphic-design-workspace > .graphic-design-editor-panel {
    align-self: start;
}

@media (max-width: 680px) {
    #graphic-design-view .graphic-design-workspace > .graphic-design-editor-panel {
        align-self: stretch;
    }
}
