/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242734;
    --bg-hover: #2d3142;
    --text-primary: #e4e6f0;
    --text-secondary: #9ca0b0;
    --text-muted: #6b7084;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-light: rgba(14, 165, 233, 0.15);
    --success: #22c55e;
    --error: #ef4444;
    --warning: #eab308;
    --border: #2d3142;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --transition: 150ms ease;
}

/* === Light Mode === */
html.light {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --bg-hover: #dddde3;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #999;
    --border: #d2d2d7;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* === Layout === */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-wide {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page {
    padding: 2rem 0;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* === Nav === */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}
.nav-brand:hover {
    text-decoration: none;
}
.nav-logo {
    height: 32px;
    width: auto;
    display: block;
}
.nav-brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: transparent;
    color: var(--error);
    border-color: var(--error);
}
.btn-danger:hover {
    background: var(--error);
    color: #fff;
}
.btn-success {
    background: transparent;
    color: var(--success);
    border-color: var(--success);
}
.btn-success:hover {
    background: var(--success);
    color: #fff;
}
.btn-warning {
    background: transparent;
    color: #f59e0b;
    border-color: #f59e0b;
}
.btn-warning:hover {
    background: #f59e0b;
    color: #fff;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
}

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

.form-error {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--error);
}

.form-hint {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* === Cards === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* === Grid === */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

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

/* === App Card (launcher — redesigned) === */
.app-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    color: var(--text-primary);
}

.app-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.app-card-top {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.app-card-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.app-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.app-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.app-card-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.app-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.app-card-actions .btn {
    flex: 1;
    justify-content: center;
}

/* === App Projects Modal (large variant) === */
.modal.modal-lg {
    max-width: 680px;
}

.modal.modal-xl {
    max-width: 1100px;
}

#app-projects-modal > .modal,
#all-projects-modal > .modal {
    overflow-y: hidden;
}

.modal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.modal-header-row .modal-title {
    margin-bottom: 0;
}

.modal-header-row .btn {
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    color: var(--text-muted);
}

.modal-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    max-height: calc(90vh - 12rem);
    overflow-y: auto;
    padding-right: 0.25rem;
    scrollbar-width: thin;
}
.modal-project-grid::-webkit-scrollbar { width: 6px; }
.modal-project-grid::-webkit-scrollbar-track { background: transparent; }
.modal-project-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.modal-project-grid::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.modal-project-card {
    position: relative;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition);
}

.modal-project-card:hover {
    border-color: var(--accent);
}

.modal-project-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.modal-project-link:hover {
    text-decoration: none;
}

.modal-project-preview {
    width: 100%;
    height: 100px;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-project-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-project-icon {
    font-size: 2rem;
}

.modal-project-icon .app-icon-img {
    width: 48px;
    height: 48px;
}

.modal-project-info {
    padding: 0.625rem 0.75rem;
}

.modal-project-title {
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.modal-project-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-project-delete {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    color: var(--error) !important;
    font-size: 1rem;
    padding: 0.125rem 0.375rem !important;
    min-height: auto !important;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity var(--transition);
}

.modal-project-card:hover .modal-project-delete {
    opacity: 1;
}

/* Modal projects toolbar */
.modal-projects-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.modal-projects-search-wrap {
    flex: 1;
}

.modal-projects-search-wrap input {
    width: 100%;
}

.modal-projects-sort-wrap {
    flex-shrink: 0;
    min-width: 160px;
}

.modal-projects-sort-wrap select {
    width: 100%;
}

/* Larger preview thumbnails for All Projects modal */
.modal-project-preview-lg { height: 160px; }

/* App filter dropdown in toolbar */
.modal-projects-filter-wrap { flex-shrink: 0; min-width: 160px; }
.modal-projects-filter-wrap select { width: 100%; }

/* App label in project card metadata */
.modal-project-app-label { display: inline-flex; align-items: center; gap: 0.25rem; }
.modal-project-app-label .app-icon-img { width: 14px; height: 14px; }

/* Help modal */
.help-layout {
    display: flex;
    gap: 1rem;
    min-height: 350px;
    max-height: 60vh;
    overflow: hidden;
}

/* Prevent outer modal scrollbar when help layout is shown */
#help-modal > .modal {
    overflow-y: hidden;
}

.help-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
    width: 185px;
    border-right: 1px solid var(--border);
    padding-right: 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.help-nav::-webkit-scrollbar { width: 4px; }
.help-nav::-webkit-scrollbar-track { background: transparent; }
.help-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.help-nav::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.help-nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    padding: 0.4rem 0.625rem;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}

.help-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.help-nav-btn.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.help-nav-divider {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.5rem 0.625rem 0.2rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
}

.help-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-primary);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.help-content::-webkit-scrollbar { width: 6px; }
.help-content::-webkit-scrollbar-track { background: transparent; }
.help-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.help-content::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.help-content h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.help-content h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.375rem;
}

.help-content p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.help-content ul {
    margin: 0 0 0.625rem 1.25rem;
    color: var(--text-secondary);
}

.help-content li {
    margin-bottom: 0.2rem;
}

.help-content code,
.help-content kbd {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8em;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.help-table th,
.help-table td {
    text-align: left;
    padding: 0.35rem 0.625rem;
    border-bottom: 1px solid var(--border);
}

.help-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.help-table td {
    color: var(--text-secondary);
}

/* Visibility badges */
.modal-project-badges {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.vis-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    line-height: 1.4;
}

.vis-badge-private {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.vis-badge-unlisted {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.vis-badge-public {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.vis-badge-class {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Project stats (views/likes) */
.modal-project-stats {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Modal pagination */
.modal-projects-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 0.75rem;
}

.modal-projects-pagination:empty {
    display: none;
}

.modal-pagination-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* === Recent Projects Grid === */
.recent-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.recent-project-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.recent-project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.recent-project-preview {
    width: 100%;
    height: 90px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.recent-project-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-project-icon {
    font-size: 2rem;
}

.recent-project-icon .app-icon-img {
    width: 48px;
    height: 48px;
}

.recent-project-info {
    padding: 0.5rem 0.75rem;
}

.recent-project-title {
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.recent-project-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Project Card === */
.project-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.project-card:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.project-card-info {
    flex: 1;
    min-width: 0;
}

.project-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-card-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.project-card-actions {
    display: flex;
    gap: 0.5rem;
}

/* === Auth Layout === */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* OAuth Buttons */
.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--transition), box-shadow var(--transition);
}

.btn-google {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-google:hover {
    background: var(--bg-hover);
    text-decoration: none;
    box-shadow: var(--shadow);
}

.oauth-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    gap: 1rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* === Alert === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

/* === Toolbar (create page) === */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: 48px;
}

.toolbar-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar-title-editing {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.125rem 0.5rem;
    outline: none;
    overflow: visible;
    text-overflow: clip;
}

.toolbar-status {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.toolbar-status.saved {
    color: var(--success);
}

.toolbar-status.saving {
    color: var(--text-muted);
}

.toolbar-status.local {
    color: var(--warning);
}

.toolbar-status.syncing {
    color: var(--text-muted);
}

.toolbar-status.offline {
    color: var(--warning);
}

.toolbar-status.error {
    color: var(--error);
}

.toolbar-status.conflict {
    color: var(--error);
}

/* Colored dot before status text */
.toolbar-status[data-dot]::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.toolbar-status[data-dot="warning"]::before { background: var(--warning); }
.toolbar-status[data-dot="error"]::before   { background: var(--error); }
.toolbar-status[data-dot="success"]::before { background: var(--success); }

/* === Sync Conflict Banner === */
.sync-conflict-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.8125rem;
    color: var(--text-primary);
}
.sync-conflict-banner.hidden { display: none; }
.sync-conflict-banner .btn { flex-shrink: 0; }

/* === Offline Opt-In Prompt === */
.offline-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.offline-prompt-overlay.hidden { display: none; }
.offline-prompt {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow);
}
.offline-prompt h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}
.offline-prompt p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}
.offline-prompt .offline-prompt-warning {
    font-size: 0.8125rem;
    color: var(--warning);
    margin-bottom: 1rem;
}
.offline-prompt-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* === Restore Modal === */
.restore-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.restore-modal-overlay.hidden { display: none; }
.restore-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow);
}
.restore-modal h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}
.restore-modal p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.restore-modal .restore-timestamps {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.restore-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* === Toolbar Nav Buttons === */
.toolbar-nav {
    display: flex;
    gap: 0.25rem;
    margin: 0 0.5rem;
}

.toolbar-nav-btn {
    font-size: 0.8125rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius);
    min-height: auto;
}

#preview-btn {
    padding: 0.25rem 0.5rem;
    min-height: auto;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
#preview-btn svg { display: block; }

.toolbar-collapse-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-height: auto;
    line-height: 1;
}

/* === Collapsed Toolbar === */
.toolbar.collapsed {
    display: none;
}

.toolbar-expand-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    gap: 2px;
}

.toolbar-expand-bar.active {
    display: flex;
}

.toolbar-expand-bar .expand-btn,
.toolbar-expand-bar .expand-quick-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0.375rem;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background var(--transition), color var(--transition);
}

.toolbar-expand-bar .expand-btn:hover,
.toolbar-expand-bar .expand-quick-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-expand-bar .expand-action-save:hover {
    color: var(--accent);
}

.expand-bar-sep {
    width: 1px;
    height: 12px;
    background: var(--border);
    flex-shrink: 0;
}

/* === Fullscreen Modal (for Assets, Terminal, Lessons) === */
.fullscreen-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.fullscreen-backdrop.active {
    display: block;
}

.fullscreen-modal {
    display: none;
    position: fixed;
    top: 5vh;
    left: 5vw;
    width: 90vw;
    height: 90vh;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    z-index: 10000;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.2s ease-out;
}

.fullscreen-modal.active {
    display: flex;
}

.fullscreen-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.fullscreen-modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.fullscreen-modal-header.terminal-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.fullscreen-modal-header.lessons-header {
    background: linear-gradient(135deg, var(--bg-secondary), rgba(124, 58, 237, 0.1));
}

.fullscreen-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 50%;
    transition: all var(--transition);
}

.fullscreen-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.fullscreen-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.fullscreen-modal-body.no-pad {
    padding: 0;
}

.terminal-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === App Frame === */
.app-frame {
    position: fixed;
    top: 48px;
    left: 0;
    width: 100%;
    height: calc(100vh - 48px);
    border: none;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* === Loading === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* === Hidden honeypot === */
.ohnohoney {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* === Section === */
.section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* === Utilities === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* === Gallery === */
.gallery-page {
    padding: 0.75rem 1.5rem 2rem;
}
.gallery-title {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    margin: 0;
}
.gallery-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-select {
    min-width: 160px;
}

.gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.gallery-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.gallery-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.gallery-card-icon {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    overflow: hidden;
    position: relative;
}

.app-icon-svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity var(--transition);
}

.gallery-card:hover .app-icon-svg {
    opacity: 1;
    color: var(--accent);
}

.project-modal-preview-icon .app-icon-svg {
    width: 80px;
    height: 80px;
}

.gallery-card-body {
    padding: 1rem;
}

.gallery-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.gallery-card-creator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.gallery-card-creator-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.625rem;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
}
.gallery-card-creator-avatar.avatar-svg svg {
    width: 12px;
    height: 12px;
}

/* Project preview metadata (Phase C) */
.gallery-card-meta-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.gallery-card-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Featured filter toggle button */
.filter-toggle-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.filter-toggle-btn.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}
.filter-toggle-btn:hover:not(.active) {
    border-color: #f59e0b;
    color: #f59e0b;
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 0;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* === Project Preview === */
.preview-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.preview-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.preview-icon svg {
    width: 56px;
    height: 56px;
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.preview-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.preview-meta-detail {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.preview-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9375rem;
}

.preview-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
}

.preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* === Like Button === */
.like-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}

.like-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

.like-btn.liked {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--error);
    color: var(--error);
}

/* === Comments === */
.comment {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-body {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.comment-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-muted);
}

.comment-actions .btn:hover {
    color: var(--text-primary);
}

.comment-replies {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.comment-form {
    margin-top: 1rem;
}

.comment-form textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.comment-login-prompt {
    text-align: center;
    padding: 1.5rem;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.reply-form-container {
    margin-top: 0.5rem;
}

/* === Preview CTA === */
.preview-cta {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

.preview-cta h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.preview-cta p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

/* Lock body scroll when any modal overlay is visible */
body:has(.modal-overlay:not(.hidden)) {
    overflow: hidden;
}

.modal {
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.modal::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* === Share Link === */
.share-link-row {
    display: flex;
    gap: 0.5rem;
}

.share-link-row .form-input {
    flex: 1;
    font-size: 0.8125rem;
}

/* === Moderation Queue === */
.mod-item {
    margin-bottom: 1rem;
}

.mod-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mod-item-preview {
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.mod-item-details {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.mod-item-reporter {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.mod-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.mod-item-actions {
    display: flex;
    gap: 0.75rem;
}

/* === Badge === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-transform: capitalize;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.badge-mod {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-admin {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent);
}

.badge-role {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* Mod tools panel on project preview */
.mod-tools {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.mod-tools-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--error);
    margin-bottom: 0.75rem;
}

.mod-tools-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mod-locked-notice {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--warning);
}

/* === Nav active link === */
.nav-link-active {
    color: var(--accent) !important;
}

/* === Disabled button === */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Alert info (verification banners) === */
.alert-info {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--text-primary);
}

.alert-info strong {
    color: var(--accent);
}

/* === Verification banner === */
.verification-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.verification-banner .btn {
    margin-left: 0.25rem;
}

/* === Muted link === */
.link-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}
.link-muted:hover {
    color: var(--text-secondary);
}

/* === Verification/reset pages === */
.auth-card .loading {
    padding: 2rem 0;
}

.auth-card .alert {
    margin-bottom: 0;
}

.auth-card .alert + .alert {
    margin-top: 0.75rem;
}

/* === Classroom / Teacher === */

/* Tab navigation */
.leaderboard-page {
    padding: 0.75rem 1.5rem 2rem;
}
.leaderboard-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}
.leaderboard-title {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    margin: 0;
}
.leaderboard-header .tab-nav {
    margin-bottom: 0;
}
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    display: block;
}

.tab-panel.hidden {
    display: none !important;
}

/* Join code display */
.join-code-display {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
}

.join-code-inline {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--accent);
}

/* Roster table */
.roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.roster-table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.roster-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.roster-table tr:hover td {
    background: var(--bg-tertiary);
}

.roster-table code {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Classroom card (teacher dashboard) */
.classroom-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* CSV dropzone */
.csv-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    transition: border-color var(--transition);
}

.csv-dropzone:hover,
.csv-dropzone.drag-over {
    border-color: var(--accent);
}

/* Credential card */
.credential-card {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.credential-card code {
    color: var(--accent);
    font-weight: 600;
}

/* Scope badges */
.scope-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
}

.scope-private {
    background: rgba(107, 112, 132, 0.15);
    color: var(--text-muted);
}

.scope-class {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.scope-public {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

/* Join code input */
.join-code-input {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
}

/* Print styles for credentials */
@media print {
    body * {
        visibility: hidden;
    }
    #credentials-modal,
    #credentials-modal * {
        visibility: visible;
    }
    #credentials-modal {
        position: absolute;
        left: 0;
        top: 0;
        background: white;
        width: 100%;
    }
    #credentials-modal .modal {
        max-width: 100%;
        border: none;
        box-shadow: none;
        background: white;
        color: black;
    }
    .credential-card {
        background: white;
        border: 1px solid #ccc;
        color: black;
        break-inside: avoid;
    }
    .credential-card code {
        color: black;
    }
    .modal-actions {
        display: none;
    }
}

/* ================================================================
   Pricing, Billing, Storage & Tier System
   ================================================================ */

/* Pricing cards */
.pricing-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: relative;
}
.pricing-card-featured {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.pricing-card-badge {
    position: absolute;
    top: -0.75rem;
    right: 1rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.75rem;
    border-radius: 999px;
}
.pricing-card-header {
    margin-bottom: 1.25rem;
}
.pricing-tier-name {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}
.pricing-price {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}
.pricing-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.pricing-interval {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}
.pricing-features li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border);
}
.pricing-features li:last-child {
    border-bottom: none;
}
.pricing-action {
    margin-top: auto;
}
.pricing-action .btn {
    width: 100%;
}

/* Billing toggle */
.billing-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

/* Tier badges */
.tier-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    text-transform: capitalize;
}
.tier-badge-free {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.tier-badge-creator {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}
.tier-badge-pro {
    background: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
}
.tier-badge-save {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    margin-left: 0.25rem;
}
.tier-badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}
.tier-badge-warn {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

/* Storage bar */
.storage-section {
    margin-top: 1rem;
}
.storage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.storage-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}
.storage-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}

/* Billing layout */
.billing-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Invoice rows */
.invoice-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.invoice-row:last-child {
    border-bottom: none;
}

/* Pay page plan box */
.pay-plan-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}
.pay-plan-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.pay-plan-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}
.pay-plan-interval {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive pricing grid */
@media (max-width: 768px) {
    .pricing-card {
        padding: 1.25rem;
    }
    .pricing-amount {
        font-size: 1.5rem;
    }
}

/* ============================
   Gamification Card
   ============================ */
.gamification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.gamification-level {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.gamification-level-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.gamification-level-name {
    font-weight: 600;
    font-size: 1rem;
}
.gamification-score {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.gamification-stats {
    display: flex;
    gap: 1.5rem;
}
.gamification-stat {
    text-align: center;
}
.gamification-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}
.gamification-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gamification-progress {
    margin-bottom: 0.75rem;
}
.gamification-progress-bar {
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.375rem;
}
.gamification-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.gamification-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}
.gamification-actions {
    display: flex;
    gap: 0.5rem;
}
@media (max-width: 600px) {
    .gamification-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .gamification-stats {
        gap: 1rem;
    }
}

/* ============================
   Settings Page
   ============================ */

/* Avatar picker */
/* === Avatar Builder (Settings Page) === */
.avatar-builder {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.avatar-builder-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.avatar-preview-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar-preview-circle.avatar-svg svg {
    width: 40px;
    height: 40px;
}
.avatar-preview-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}
.avatar-category-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.avatar-category-tab {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition);
}
.avatar-category-tab:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.avatar-category-tab.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}
.avatar-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.avatar-icon-option {
    width: 52px;
    height: 52px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.avatar-icon-option svg {
    width: 32px;
    height: 32px;
}
.avatar-icon-option img.badge-svg {
    width: 36px;
    height: 36px;
}
.avatar-icon-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--text-primary);
}
.avatar-icon-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}
.avatar-color-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.avatar-color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.avatar-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    outline-offset: 2px;
}
.avatar-color-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.3);
}
.avatar-color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent);
    transform: scale(1.15);
}
.avatar-custom-color-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.avatar-native-picker {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background: none;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar-native-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.avatar-native-picker::-webkit-color-swatch {
    border: 2px solid var(--border);
    border-radius: 50%;
}
.avatar-native-picker::-moz-color-swatch {
    border: 2px solid var(--border);
    border-radius: 50%;
}
.avatar-hex-input {
    width: 90px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.8125rem;
}

/* Legacy avatar picker (keep for backward compat) */
.avatar-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.avatar-option {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.avatar-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 2px var(--accent);
}

/* Toggle row (checkbox) */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
}
.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* Theme toggle buttons */
.theme-toggle,
.font-size-toggle,
.taskbar-pos-toggle,
.dock-magnify-toggle {
    display: flex;
    gap: 0.5rem;
}
.theme-option,
.font-size-option,
.taskbar-pos-option,
.dock-magnify-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition);
}
.theme-option:hover,
.font-size-option:hover,
.taskbar-pos-option:hover,
.dock-magnify-option:hover {
    border-color: var(--accent);
}
.theme-option.selected,
.font-size-option.selected,
.taskbar-pos-option.selected,
.dock-magnify-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}
.theme-option-icon {
    font-size: 1.25rem;
}

/* Settings range slider */
.settings-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    cursor: pointer;
}
.settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}
.settings-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* Accent color picker */
.accent-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.accent-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}
.accent-swatch:hover {
    transform: scale(1.15);
}
.accent-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-primary);
}

/* ============================
   Profile Page (Public)
   ============================ */
.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
    color: #fff;
    overflow: hidden;
}
.profile-avatar.avatar-svg svg {
    width: 44px;
    height: 44px;
}
.profile-info {
    flex: 1;
    min-width: 0;
}
.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.profile-bio {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.profile-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--text-primary);
}
.profile-badge-icon {
    font-size: 1rem;
}
.profile-badge-svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.profile-badge-name {
    white-space: nowrap;
}

/* Profile username */
.profile-username {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* Profile Stats Grid */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.profile-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.profile-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Profile Top Apps */
.profile-top-apps {
    margin-bottom: 2rem;
}
.profile-top-apps-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.profile-top-apps-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.profile-top-app {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--text-primary);
}
.profile-top-app-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}
.profile-top-app-icon-fallback {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--border);
    flex-shrink: 0;
}
.profile-top-app-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================
   Onboarding Page
   ============================ */
.onboarding-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.onboarding-card {
    width: 100%;
    max-width: 560px;
}
.onboarding-step {
    display: none;
}
.onboarding-step.active {
    display: block;
}
.onboarding-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}
.onboarding-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9375rem;
}
.onboarding-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.onboarding-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}
.onboarding-choice:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    text-decoration: none;
}
.onboarding-choice.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}
.onboarding-choice-icon {
    font-size: 2rem;
}
.onboarding-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ============================
   Toast Notifications
   ============================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 0.9375rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toast-slide-in 0.3s ease;
    max-width: 360px;
}
.toast-success {
    border-color: var(--success);
}
.toast-level-up {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-secondary), var(--accent-light));
}
.toast-badge {
    border-color: #eab308;
}
.toast-xp {
    border-color: var(--accent);
}
@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-slide-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Level-up celebration */
@keyframes level-up-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.level-up-icon {
    animation: level-up-pulse 0.5s ease 3;
    font-size: 1.5rem;
}

/* XP bar animated fill */
@keyframes xp-fill {
    from { width: 0%; }
}
.gamification-progress-fill.animate {
    animation: xp-fill 1s ease-out;
}

/* ================================================================
   Responsive Design — Tablet (768px) & Phone (480px)
   ================================================================ */

/* --- Hamburger menu toggle --- */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

@media (max-width: 768px) {
    /* Nav: hamburger */
    .nav-hamburger {
        display: block;
    }
    .nav-actions {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1.5rem;
        gap: 0.5rem;
        z-index: 100;
    }
    .nav-actions.open {
        display: flex;
    }
    .nav {
        position: relative;
    }
    .nav-actions .btn {
        justify-content: flex-start;
        width: 100%;
    }

    /* Fullscreen modal: full viewport on mobile */
    .fullscreen-modal {
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .fullscreen-modal-body {
        padding: 1rem;
    }

    /* Container */
    .container,
    .container-wide {
        padding: 0 1rem;
    }

    /* Dashboard cards: stack */
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Modal-lg/xl: wider on tablet */
    .modal-lg {
        max-width: 90%;
    }

    .modal-xl {
        max-width: 90%;
    }

    .modal-project-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .recent-projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* Gallery grid: 2 columns on tablet */
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    /* Gallery filters: wrap */
    .gallery-filters {
        flex-wrap: wrap;
    }

    .filter-group-search {
        max-width: none;
        flex-basis: 100%;
    }

    /* Project modal: wider on tablet */
    .project-modal-card {
        max-width: 90%;
    }

    /* Forms: larger touch targets */
    .form-input, .btn {
        min-height: 44px;
    }
    .form-input {
        font-size: 1rem;
    }

    /* Settings tabs: scroll horizontally */
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Profile header: stack on narrow */
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-meta {
        justify-content: center;
    }
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Preview header */
    .preview-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .preview-meta {
        justify-content: center;
    }
    .preview-toolbar {
        flex-direction: column;
        align-items: center;
    }
    .preview-stats {
        justify-content: center;
    }
    .preview-actions {
        justify-content: center;
    }

    /* Modal: wider */
    .modal {
        max-width: 95%;
    }

    /* Billing plan header */
    .billing-plan-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Onboarding choices */
    .onboarding-choices {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Theme / font / taskbar toggles: wrap */
    .theme-toggle,
    .font-size-toggle,
    .taskbar-pos-toggle,
    .dock-magnify-toggle {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    /* Nav: scale down logo on small screens */
    .nav-logo {
        height: 24px;
    }

    /* Page header */
    .page-header h1 {
        font-size: 1.35rem;
    }

    /* Grid: single column */
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Gallery grid: single column on phone */
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    /* App cards: compact on phone */
    .app-card {
        padding: 1rem;
    }
    .app-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
    .app-card-actions {
        flex-direction: column;
    }

    /* Modal: full width on phone */
    .modal-lg,
    .modal-xl {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    .modal-projects-toolbar {
        flex-direction: column;
    }

    .modal-projects-sort-wrap,
    .modal-projects-filter-wrap {
        min-width: 0;
        width: 100%;
    }

    .help-layout {
        flex-direction: column;
        min-height: auto;
        max-height: 65vh;
    }
    .help-nav {
        flex-direction: row;
        width: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .help-nav::-webkit-scrollbar { display: none; }
    .help-nav-btn { white-space: nowrap; flex-shrink: 0; }
    .help-nav-divider { border-top: none; border-left: 1px solid var(--border); margin-top: 0; margin-left: 0.25rem; padding: 0.4rem 0.5rem; white-space: nowrap; flex-shrink: 0; }

    .project-modal-card {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    .project-modal-preview {
        height: 150px;
    }

    .project-modal-app-frame {
        height: 240px;
    }

    .leaderboard-item-stats {
        flex-direction: column;
        gap: 0.25rem;
        text-align: right;
    }

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

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

    /* Forms: full width */
    .form-input {
        width: 100%;
    }

    /* Modal: full width */
    .modal {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    /* Onboarding: single column */
    .onboarding-choices {
        grid-template-columns: 1fr;
    }
    .onboarding-page {
        padding: 1rem;
    }

    /* Auth card: reduce padding */
    .auth-card {
        padding: 1.25rem;
    }

    /* Pricing */
    .pricing-amount {
        font-size: 1.5rem;
    }

    /* Project card: tighter */
    .project-card {
        padding: 0.75rem 1rem;
    }

    /* Settings accent picker */
    .accent-swatch {
        width: 32px;
        height: 32px;
    }

    /* Avatar picker */
    .avatar-option {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    /* Avatar builder responsive */
    .avatar-icon-grid {
        gap: 0.375rem;
    }
    .avatar-icon-option {
        width: 44px;
        height: 44px;
    }
    .avatar-icon-option svg {
        width: 26px;
        height: 26px;
    }
    .avatar-icon-option img.badge-svg {
        width: 30px;
        height: 30px;
    }
    .avatar-color-swatch {
        width: 28px;
        height: 28px;
    }
}

/* ================================================================
   App Preview Iframe (project-preview.php)
   ================================================================ */

.preview-app-frame {
    position: relative;
    width: 100%;
    height: 500px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.preview-app-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.9375rem;
    z-index: 1;
}

.preview-app-loading.hidden {
    display: none;
}

/* ================================================================
   License Badges & Fork Attribution
   ================================================================ */

.license-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.license-badge:hover {
    background: rgba(124, 58, 237, 0.25);
    text-decoration: none;
}

.license-badge-muted {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.license-badge-sm {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.35rem;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.12);
    color: var(--accent);
    white-space: nowrap;
    margin-left: auto;
}

.license-whats-this {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.license-whats-this:hover {
    color: var(--primary);
    text-decoration: underline;
}

.preview-fork-attribution {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
}

.preview-fork-attribution a {
    color: var(--accent);
}

@media (max-width: 768px) {
    .preview-app-frame {
        height: 350px;
    }
}

@media (max-width: 480px) {
    .preview-app-frame {
        height: 280px;
    }
}

/* CircuitSim inline preview stats */
.preview-circuit-stats {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.circuit-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.circuit-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
}
.circuit-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.circuit-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}
.circuit-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}
.circuit-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.circuit-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}
.circuit-badge.circuit-complete {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
}
.circuit-badge.circuit-incomplete {
    background: color-mix(in srgb, var(--danger) 15%, transparent);
    color: var(--danger);
}
@media (max-width: 480px) {
    .circuit-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Gallery Search Input === */
.filter-group-search {
    flex: 1;
    min-width: 140px;
    max-width: 240px;
}

/* === Gallery Active User Filter Bar === */
.gallery-active-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* === Gallery Card Creator Link === */
.gallery-card-creator-link {
    cursor: pointer;
    color: var(--accent);
    transition: color var(--transition);
}

.gallery-card-creator-link:hover {
    text-decoration: underline;
}

/* === Project Quick-View Modal === */
.project-modal-card {
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.project-modal-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all var(--transition);
}

.project-modal-close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.project-modal-preview {
    width: 100%;
    height: 200px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    width: calc(100% + 3rem);
}

.project-modal-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-modal-preview-icon {
    font-size: 3rem;
}

.project-modal-app-frame {
    height: 320px;
}

.project-modal-header {
    margin-bottom: 0.75rem;
}

.project-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.project-modal-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.project-modal-fork {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.project-modal-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.project-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.project-modal-comments {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.project-modal-comments-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.project-modal-no-comments {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Project modal interactive app preview */
.project-modal-app-frame {
    position: relative;
}

.project-modal-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.project-modal-app-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.875rem;
    z-index: 1;
}

.project-modal-app-loading.hidden {
    display: none;
}

.project-modal-circuit-stats {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    width: calc(100% + 3rem);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.circuit-stat-row {
    padding: 0.25rem 0;
}

/* FontMaker specimen preview in gallery modal */
.project-modal-fontmaker-frame {
    background: #0f0f1e;
    height: auto;
    min-height: 200px;
    max-height: 360px;
    overflow: hidden;
}

.project-modal-fontmaker-frame canvas {
    display: block;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* === Leaderboard === */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
}

.leaderboard-item:hover {
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.leaderboard-position {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.leaderboard-position-1 {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.leaderboard-position-2 {
    background: rgba(192, 192, 192, 0.2);
    color: #c0c0c0;
}

.leaderboard-position-3 {
    background: rgba(205, 127, 50, 0.2);
    color: #cd7f32;
}

.leaderboard-item-preview {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.leaderboard-item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.leaderboard-item-icon .app-icon-svg {
    width: 36px;
    height: 36px;
}

.leaderboard-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    color: #fff;
    overflow: hidden;
}
.leaderboard-item-avatar.avatar-svg svg {
    width: 28px;
    height: 28px;
}

.leaderboard-item-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-item-title {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.leaderboard-item-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* === Gallery Card Embedded Preview (Phase D — removed: cards now use icon, modal has interactive preview) === */

/* === Project Preview Images (Phase B) === */
.gallery-card-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.project-card-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Pixel art previews — small sprites need nearest-neighbor scaling,
   and a checkerboard background so transparent sprites stay visible
   against the dark site theme */
img[data-app="pixelart"],
.modal-project-preview img[data-app="pixelart"],
.dash-recent-preview img[data-app="pixelart"] {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    object-fit: contain;
    background-color: #d0d0d0;
    background-image:
        linear-gradient(45deg, #b0b0b0 25%, transparent 25%),
        linear-gradient(-45deg, #b0b0b0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #b0b0b0 75%),
        linear-gradient(-45deg, transparent 75%, #b0b0b0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* FontMaker previews — pixel fonts need nearest-neighbor scaling
   to stay crisp at small sizes (solid dark background, no checkerboard needed) */
img[data-app="fontmaker"],
.modal-project-preview img[data-app="fontmaker"],
.dash-recent-preview img[data-app="fontmaker"],
.project-modal-preview img[data-app="fontmaker"] {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    object-fit: contain;
    background: #0f0f1e;
}

/* ================================================================
   Accessibility — Focus, Skip Link, ARIA
   ================================================================ */

/* Skip-to-content link */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--accent);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 3000;
    font-size: 0.875rem;
    border-radius: 0 0 var(--radius) 0;
    transition: top 0.2s ease;
}
.skip-to-content:focus {
    top: 0;
}

/* Focus-visible ring using accent color */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ================================================================
   mytekOS Status Bar — fixed bottom footer
   ================================================================ */

.mytekos-status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 28px;
    padding: 0 1rem;
    z-index: 100;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.mytekos-status-bar:hover {
    opacity: 1;
}

#status-bar-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.mytekos-status-terminal {
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    padding-left: 1rem;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.mytekos-status-terminal:hover {
    color: var(--text-primary);
}

/* Ensure page content doesn't hide behind status bar */
body:has(.mytekos-status-bar) .container.page,
body:has(.mytekos-status-bar) .container-wide.page {
    padding-bottom: 3rem;
}

/* Mobile: slightly smaller text */
@media (max-width: 768px) {
    .mytekos-status-bar {
        font-size: 0.6875rem;
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .mytekos-status-bar {
        font-size: 0.625rem;
    }
}

/* ================================================================
   mytekOS Boot Sequence Overlay
   ================================================================ */

.mytekos-boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0a0a0a;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
    cursor: pointer;
}

.mytekos-boot-screen {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    color: #22c55e;
    font-size: 0.875rem;
    line-height: 1.6;
    max-width: 500px;
    width: 90%;
}

.mytekos-boot-line {
    animation: boot-fade-in 0.15s ease forwards;
    opacity: 0;
}

@keyframes boot-fade-in {
    to { opacity: 1; }
}

@media (max-width: 480px) {
    .mytekos-boot-screen {
        font-size: 0.75rem;
    }
}

/* ================================================================
   Embedded Terminal Panel (dashboard)
   ================================================================ */

.terminal-panel {
    position: fixed;
    bottom: 28px;
    left: 0;
    right: 0;
    height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    z-index: 99;
    background: #0a0a0a;
    border-top: 1px solid var(--border);
    transition: height 0.25s ease;
}

.terminal-panel-handle {
    height: 6px;
    cursor: ns-resize;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    position: relative;
}

.terminal-panel-handle::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 22px;
    cursor: ns-resize;
}

.terminal-panel-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
}

.terminal-panel-iframe {
    flex: 1;
    width: 100%;
    border: none;
    min-height: 0;
}

.terminal-panel.resizing {
    transition: none;
}

.terminal-panel.resizing .terminal-panel-iframe {
    pointer-events: none;
}

/* Terminal toggle button in status bar */
.mytekos-status-terminal {
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.mytekos-status-terminal.active {
    color: var(--text-primary);
    text-shadow: 0 0 6px var(--accent);
}

/* Keep status bar fully opaque when terminal is open */
.mytekos-status-terminal.active ~ #status-bar-content,
body:has(.mytekos-status-terminal.active) .mytekos-status-bar {
    opacity: 1;
}

/* Mobile: larger touch target on handle */
@media (max-width: 768px) {
    .terminal-panel-handle {
        height: 10px;
    }
}

/* === App Info Modal === */
.app-info-overview {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-info-icon {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    overflow: hidden;
}

.app-info-details h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.app-info-details p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.app-info-section {
    margin-bottom: 1.25rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.app-info-section h5 {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.app-info-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.app-info-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

.app-info-stat {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
}

.app-info-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.app-info-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* === Role Selector (signup / become-teacher) === */
.role-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.role-option {
    position: relative;
}

.role-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-card {
    display: block;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.role-card:hover {
    border-color: var(--text-muted);
}

.role-option input[type="radio"]:checked + .role-card {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.role-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.role-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.role-disclaimer {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    line-height: 1.5;
}

/* === Creator's Notes (project preview page) === */

.creator-notes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.creator-note {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.creator-note-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.creator-note-body {
    white-space: pre-line;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

/* ── Remix/Lineage System ────────────────────────────────── */

/* Lineage breadcrumb */
.preview-lineage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}
.preview-lineage-link {
    color: var(--primary);
    text-decoration: none;
}
.preview-lineage-link:hover { text-decoration: underline; }
.preview-lineage-by { color: var(--text-muted); }
.preview-lineage-arrow { color: var(--text-muted); margin: 0 0.125rem; }

/* Remix strip */
.remix-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
}
.remix-card {
    flex: 0 0 140px;
    scroll-snap-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.15s, transform 0.15s;
}
.remix-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.remix-card-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
.remix-card-icon {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-muted);
    padding: 1rem;
}
.remix-card-icon svg, .remix-card-icon img { width: 40px; height: 40px; }
.remix-card-title {
    padding: 0.375rem 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.remix-card-creator {
    padding: 0.125rem 0.5rem 0.375rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Prominent Remix CTA */
.preview-remix-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: 10px;
}
.preview-remix-cta-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.preview-remix-cta-text strong { font-size: 0.9375rem; }
.preview-remix-cta-text span { font-size: 0.8125rem; color: var(--text-muted); }

@media (max-width: 480px) {
    .preview-remix-cta {
        flex-direction: column;
        text-align: center;
    }
}

/* Remix note banner (create page) */
.remix-note-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 8px;
    font-size: 0.875rem;
}
.remix-note-banner-text { color: var(--text-secondary); }
.remix-note-banner .btn { white-space: nowrap; }
.remix-note-banner-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0 0.25rem;
}

/* Watermark overlay for free-tier interactive previews */
.preview-frame-watermark {
    position: relative;
}
.preview-frame-watermark .watermark-link {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    text-decoration: none;
    z-index: 10;
    pointer-events: auto;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.15);
    transition: color 0.15s;
}
.preview-frame-watermark .watermark-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Degraded preview (daily view limit reached) */
.preview-degraded {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--bg-tertiary);
}
.preview-degraded-screenshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(12px) brightness(0.5);
    transform: scale(1.05);
}
.preview-degraded-placeholder {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}
.preview-degraded-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}
.preview-degraded-message {
    text-align: center;
    max-width: 420px;
    padding: 2rem;
}
.preview-degraded-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}
.preview-degraded-message h3 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}
.preview-degraded-message p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* Gallery card remix count */
.gallery-card-remix-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}
