/* 
 * Anansi Panel Utilities 
 * specialized layouts and utilities for panels
 */

/* === Grid Layouts === */
.panel-grid {
    display: grid;
    gap: var(--space-4);
}

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

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

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

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

/* === Layouts === */
.panel-sidebar-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width, 250px) 1fr;
    gap: var(--space-4);
    height: 100%;
    overflow: hidden;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .panel-sidebar-layout {
        grid-template-columns: 1fr;
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* === Flex Utilities === */
.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.flex-row {
    display: flex;
    flex-direction: row;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

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

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

.items-start {
    align-items: flex-start;
}

.items-stretch {
    align-items: stretch;
}

.min-w-0 {
    min-width: 0;
}

.min-h-0 {
    min-height: 0;
}

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

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.align-start {
    align-items: flex-start;
}

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

.gap-sm {
    gap: var(--space-2);
}

.gap-md {
    gap: var(--space-4);
}

.gap-lg {
    gap: var(--space-6);
}

/* === Typography Utilities === */
.text-xs {
    font-size: var(--text-xs);
}

.text-sm {
    font-size: var(--text-sm);
}

.text-base {
    font-size: var(--text-base);
}

.text-lg {
    font-size: var(--text-lg);
}

.text-xl {
    font-size: var(--text-xl);
}

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

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

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

.text-accent {
    color: var(--accent-primary);
}

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

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

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

.text-2xl {
    font-size: 24px;
}

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

.font-mono {
    font-family: var(--font-mono);
}

.font-bold {
    font-weight: 600;
}

.text-uppercase {
    text-transform: uppercase;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.w-full {
    width: 100%;
}

.flex-auto {
    flex: 1 1 auto;
    min-width: 0;
}

.flex-none {
    flex: none;
}

/* --- Flow Explorer --- */
.flow-entry {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
    font-size: 12px;
}

.flow-entry:hover {
    background: var(--bg-elevated);
}

.flow-pass {
    border-left: 3px solid var(--status-success);
}

.flow-fail {
    border-left: 3px solid var(--status-error);
}

.flow-icon {
    font-size: 14px;
    margin-right: 8px;
}

.flow-name {
    font-weight: bold;
    font-size: 12px;
}

.flow-type {
    font-size: 9px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-base);
    color: var(--text-muted);
    margin-left: 8px;
}

.flow-reason {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    padding-left: 22px;
}

.flow-group-summary {
    padding: 8px 12px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.flow-group-summary:hover {
    background: var(--bg-elevated);
}

/* --- Nabu (Temple) --- */
.nabu-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--space-4);
    height: 100%;
    padding: var(--space-4);
}

.nabu-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    overflow-y: auto;
}

.nabu-right {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 0;
}

.nabu-tablet {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(139, 90, 43, 0.08) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    position: relative;
}

.nabu-tablet-glow {
    position: absolute;
    width: 100px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(205, 133, 63, 0.25) 0%, transparent 70%);
    border-radius: 30%;
    top: 8px;
    animation: tablet-pulse 4s ease-in-out infinite;
}

.nabu-tablet-face {
    width: 80px;
    height: 100px;
    background: linear-gradient(145deg, #8B7355 0%, #6B5344 50%, #5a4636 100%);
    border-radius: 8px 8px 12px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

@keyframes tablet-pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.03);
    }
}

@keyframes inscribing {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

.aura-tag-btn {
    font-size: 9px;
    padding: 3px 7px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.aura-tag-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.aura-tag-btn.selected {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Utilities */
.font-light {
    font-weight: 300;
}

.tracking-tight {
    letter-spacing: -0.025em;
}

.tracking-wide {
    letter-spacing: 0.025em;
}

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

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

/* --- Guide Panel --- */
.guide-info-box {
    background: rgba(124, 108, 255, 0.1);
    border-left: 3px solid var(--accent-primary);
    padding: 12px;
    font-size: 13px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.guide-list {
    padding-left: 20px;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-main);
}

.guide-note {
    margin-top: 8px;
    font-style: italic;
}

/* --- World Weaver --- */
@keyframes ww-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
        border-color: var(--accent-primary);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 0 12px 2px rgba(99, 102, 241, 0.4);
        border-color: var(--accent-primary);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
        border-color: transparent;
    }
}

.ww-category-row {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    background: transparent;
}

.ww-category-row:hover {
    background: var(--bg-elevated);
}

.ww-category-row.active {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
}

.ww-pulse {
    animation: ww-pulse 1.2s ease-out;
    z-index: 10;
    position: relative;
}

.ww-progress-bg {
    height: 4px;
    width: 100%;
    background: var(--bg-base);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.ww-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease, background-color 0.5s ease;
}

.ww-chat-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ww-chat-user {
    align-self: flex-end;
    background: var(--accent-primary);
    color: white;
}

.ww-chat-model {
    align-self: flex-start;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.ww-suggestion-chip {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--accent-primary);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.9;
}

.ww-suggestion-chip:hover {
    background: var(--bg-elevated);
    transform: translateY(-1px);
}

.ww-gen-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: all 0.2s;
}

.ww-gen-option:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* --- Hina's Guide --- */
.hina-cabinet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.hina-wizard-step {
    display: none;
}

.hina-wizard-step.active {
    display: block;
}

/* === Spacing === */
.m-0 {
    margin: 0;
}

.mt-sm {
    margin-top: var(--space-2);
}

.mt-md {
    margin-top: var(--space-4);
}

.mb-sm {
    margin-bottom: var(--space-2);
}

.mb-md {
    margin-bottom: var(--space-4);
}

.mb-xs {
    margin-bottom: var(--space-1);
}

.mt-xl {
    margin-top: var(--space-10);
}

.pt-lg {
    padding-top: var(--space-6);
}

.px-sm {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.mr-md {
    margin-right: var(--space-4);
}

.mr-sm {
    margin-right: var(--space-2);
}

.ml-sm {
    margin-left: var(--space-2);
}

.px-lg {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.h-5 {
    height: 20px;
}

.p-0 {
    padding: 0;
}

.p-sm {
    padding: var(--space-2);
}

.p-md {
    padding: var(--space-4);
}

.py-xs {
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
}

.py-sm {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

.px-md {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

/* New Spacing Utilities */
.p-xs {
    padding: var(--space-1);
}

.p-lg {
    padding: var(--space-6);
}

.px-xs {
    padding-left: var(--space-1);
    padding-right: var(--space-1);
}

.py-md {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.m-xs {
    margin: var(--space-1);
}

.m-sm {
    margin: var(--space-2);
}

.m-md {
    margin: var(--space-4);
}

.m-lg {
    margin: var(--space-6);
}

.mb-lg {
    margin-bottom: var(--space-6);
}

.mr-xs {
    margin-right: var(--space-1);
}

/* === Panel Specific Components === */


/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-dot.active {
    background-color: var(--status-success);
}

.status-dot.busy {
    background-color: var(--status-warning);
}

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

/* Scrollable List container */
.scroll-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* === Layout Utilities === */
.h-full {
    height: 100%;
}

.w-full {
    width: 100%;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.inset-0 {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.overflow-hidden {
    overflow: hidden;
}

.scroll-y {
    overflow-y: auto;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* === Split View (Vault) === */
.split-view {
    display: flex;
    gap: var(--space-4);
    height: 100%;
    overflow: hidden;
}

.split-col {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.2s ease-in-out;
}

/* === Tabs === */
.tab-header {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
}

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

/* === List Items === */
.list-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    /* Ensure no border interferes with box-model width/padding */
    border-left: 0 solid transparent;
    border-right: 0 solid transparent;
}

.list-item:hover {
    background: var(--bg-surface);
}

.list-item.active {
    background: var(--bg-surface);
    /* Use box-shadow to prevent layout shifts (border adds width/reduces content) */
    box-shadow: inset 3px 0 0 0 var(--accent-primary);
    border-left: 0;
    padding-left: 10px;
}

.list-item.selected {
    background: var(--accent-soft);
    box-shadow: inset -3px 0 0 0 var(--accent-primary);
    border-right: 0;
}





/* === More Utilities === */
.w-8 {
    width: 32px;
}

.h-8 {
    height: 32px;
}

.p-lg {
    padding: var(--space-6);
}

.mb-lg {
    margin-bottom: var(--space-6);
}

.pb-md {
    padding-bottom: var(--space-4);
}

.border-b {
    border-bottom: 1px solid var(--border-subtle);
}

.rounded-sm {
    border-radius: 4px;
}

.rounded-md {
    border-radius: 8px;
}

.rounded-full {
    border-radius: 9999px;
}

.w-300 {
    width: 300px;
}

.h-1 {
    height: 4px;
}

.bg-base {
    background-color: var(--bg-base);
}

.bg-panel {
    background-color: var(--bg-panel);
}

.bg-surface {
    background-color: var(--bg-surface);
}

.bg-elevated {
    background-color: var(--bg-elevated);
}

.bg-accent {
    background-color: var(--accent-primary);
}

.bg-inset {
    background-color: var(--bg-base);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.opacity-60 {
    opacity: 0.6;
}

.opacity-90 {
    opacity: 0.9;
}

.font-serif {
    font-family: var(--font-serif);
}

.center-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Chat Components (Writer's Block / Simulator) === */
.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--bg-base);
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    max-width: 85%;
    position: relative;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-bubble.user {
    background: var(--accent-soft);
    align-self: flex-end;
    border: 1px solid var(--border-subtle);
}

.chat-bubble.model {
    background: var(--bg-elevated);
    align-self: flex-start;
    border: 1px solid var(--border-subtle);
}

.chat-bubble.pinned {
    border-color: var(--accent-primary);
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 9px;
    color: var(--text-muted);
}

/* === Chips (Writer's Block) === */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chip {
    border-radius: var(--radius-sm);
    font-size: 10px;
    padding: 4px 8px;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.chip.active {
    background: var(--accent-primary);
    color: var(--bg-base);
    border-color: var(--accent-primary);
}

/* === Editor Layouts === */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.monaco-wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.gap-0 {
    gap: 0;
}

/* === Modals === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
}

.modal-body {
    padding: var(--space-4);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    background: var(--bg-surface);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.animate-fade-in {
    animation: fadeIn 0.5s ease;
}

.animate-slide-up {
    animation: modalSlideUp 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Panel Specific: Voices === */
.v-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.v-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.v-lab {
    font-size: 10px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
}

.v-sec {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

.text-tiny {
    font-size: 10px;
}

.opacity-20 {
    opacity: 0.2;
}


.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 9px;
    color: var(--text-muted);
}

/* === Chips (Writer's Block) === */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chip {
    border-radius: var(--radius-sm);
    font-size: 10px;
    padding: 4px 8px;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.chip.active {
    background: var(--accent-primary);
    color: var(--bg-base);
    border-color: var(--accent-primary);
}

/* === Editor Layouts === */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.monaco-wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.gap-0 {
    gap: 0;
}

/* === Modals === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
}

.modal-body {
    padding: var(--space-4);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    background: var(--bg-surface);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.animate-fade-in {
    animation: fadeIn 0.5s ease;
}

.animate-slide-up {
    animation: modalSlideUp 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Panel Specific: Voices === */
.v-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.v-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.v-lab {
    font-size: 10px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
}

.v-sec {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

.text-tiny {
    font-size: 10px;
}

.opacity-20 {
    opacity: 0.2;
}

.opacity-70 {
    opacity: 0.7;
}

.scroll-y {
    overflow-y: auto;
    overflow-x: hidden;
}

.parlor-visual {
    display: block;
    /* Legacy support */
}

/* === Character Panel Utilities === */
.portrait-preview {
    width: 150px;
    height: 200px;
    background-color: var(--bg-inset);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.field-editor {
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 13px;
    width: 100%;
}

.field-editor-sm {
    height: 120px;
}

.field-editor-md {
    height: 150px;
}

.field-editor-lg {
    height: 200px;
}

.field-editor-xl {
    height: 250px;
}

/* === Voices Panel Utilities === */
.voice-subtone-row {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    align-items: center;
}

.voice-weight-input {
    width: 60px;
}

.voice-list-arrows {
    display: flex;
    flex-direction: column;
    margin-right: var(--space-2);
    align-items: center;
}

/* === Positioning === */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.z-1 {
    z-index: 1;
}

.z-10 {
    z-index: 10;
}

/* === Border Utilities === */
.border {
    border: 1px solid var(--border-default);
}

.border-b {
    border-bottom: 1px solid var(--border-default);
}

.border-t {
    border-top: 1px solid var(--border-default);
}

.border-subtle {
    border-color: var(--border-subtle);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: 9999px;
}

/* === Layout Extras === */
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.overflow-hidden {
    overflow: hidden;
}

.h-full {
    height: 100%;
}

.w-full {
    width: 100%;
}

/* === Backgrounds === */
.bg-surface {
    background-color: var(--bg-surface);
}

.bg-base {
    background-color: var(--bg-base);
}

.bg-elevated {
    background-color: var(--bg-elevated);
}

.bg-inset {
    background-color: var(--bg-inset);
}

.bg-accent-subtle {
    background-color: var(--accent-muted);
}

/* === Spacing === */
.m-xs {
    margin: var(--space-1);
}

.m-sm {
    margin: var(--space-2);
}

.m-md {
    margin: var(--space-4);
}

.mt-xxs {
    margin-top: 2px;
}

.mt-xs {
    margin-top: var(--space-1);
}

.mt-sm {
    margin-top: var(--space-2);
}

.mt-md {
    margin-top: var(--space-4);
}

.mb-xxs {
    margin-bottom: 2px;
}

.mb-xs {
    margin-bottom: var(--space-1);
}

.mb-sm {
    margin-bottom: var(--space-2);
}

.mb-md {
    margin-bottom: var(--space-4);
}

.mb-lg {
    margin-bottom: var(--space-6);
}

.ml-sm {
    margin-left: var(--space-2);
}

.ml-md {
    margin-left: var(--space-4);
}

.ml-lg {
    margin-left: var(--space-6);
}

.p-xs {
    padding: var(--space-1);
}

.p-sm {
    padding: var(--space-2);
}

.p-md {
    padding: var(--space-4);
}

.p-lg {
    padding: var(--space-6);
}

.px-xs {
    padding-left: var(--space-1);
    padding-right: var(--space-1);
}

.px-sm {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.px-md {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.py-xxs {
    padding-top: 2px;
    padding-bottom: 2px;
}

.py-xs {
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
}

.py-sm {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

/* === Position === */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.top-0 {
    top: 0;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

/* === Sizing === */
.w-screen {
    width: 100vw;
}

.h-screen {
    height: 100vh;
}

.max-w-xs {
    max-width: 200px;
}

/* === Typography === */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whitespace-nowrap {
    white-space: nowrap;
}

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

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

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

.font-medium {
    font-weight: 500;
}

.italic {
    font-style: italic;
}

/* === Borders === */
.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-xl {
    border-radius: 12px;
}

/* === Opacity & Interaction === */
.opacity-50 {
    opacity: 0.5;
}

.opacity-60 {
    opacity: 0.6;
}

.opacity-70 {
    opacity: 0.7;
}

.opacity-80 {
    opacity: 0.8;
}

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

.cursor-pointer {
    cursor: pointer;
}

/* === Extra Gaps === */
.gap-xs {
    gap: var(--space-1);
}

.gap-xxs {
    gap: 2px;
}

/* === Extra Typography === */
.text-xxs {
    font-size: 10px;
}

/* === Structural Utilities === */
.split-view {
    display: flex;
    flex-direction: row;
    height: 100%;
    gap: var(--space-4);
    overflow: hidden;
}

.split-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    flex: 1;
}



/* === Form Layouts === */
.form-row {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
    align-items: flex-start;
}

.form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-4);
    margin-top: var(--space-4);
}

/* === Temple of Delphi === */
.delphi-depth-selector {
    display: flex;
    gap: 2px;
    background: var(--bg-deep);
    border-radius: var(--radius-md);
    padding: 2px;
    border: 1px solid var(--border-subtle);
}

.delphi-depth-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.delphi-depth-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.delphi-depth-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.delphi-empty-state {
    text-align: center;
    padding: 48px 24px;
    opacity: 0.8;
}

.delphi-section {
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
}

.delphi-section-header {
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
}

.delphi-section-header:hover {
    background: var(--bg-deep);
}

.delphi-section-body {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.delphi-section-h3 {
    font-size: 16px;
    margin: 16px 0 8px;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 6px;
}

.delphi-section-h4 {
    font-size: 13px;
    margin: 12px 0 6px;
    color: var(--text-primary);
    font-weight: 700;
}

.delphi-list {
    padding-left: 18px;
    margin: 6px 0;
    line-height: 1.7;
}

.delphi-list li {
    margin-bottom: 3px;
}

.delphi-code {
    background: var(--bg-deep);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--accent-secondary);
}

.delphi-score-high {
    color: var(--status-success);
    font-weight: 700;
}

.delphi-score-mid {
    color: var(--status-warning);
    font-weight: 700;
}

.delphi-score-low {
    color: var(--status-error);
    font-weight: 700;
}

.delphi-trigger-warning {
    background: rgba(255, 100, 50, 0.08);
    border: 1px solid rgba(255, 100, 50, 0.25);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

.delphi-history-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.delphi-history-item:hover {
    background: var(--bg-elevated);
}

.delphi-compare-grid {
    display: grid;
    gap: 12px;
}

.delphi-compare-col {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
}

.delphi-compare-header {
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.delphi-compare-body {
    padding: 12px;
    font-size: 12px;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
}

.delphi-formatted p {
    margin: 6px 0;
}

.delphi-loading-dots::after {
    content: '';
    animation: delphiDots 1.4s infinite;
}

@keyframes delphiDots {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }
}

.delphi-oracle-pulse {
    animation: delphiPulse 2s ease-in-out infinite;
}

@keyframes delphiPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }

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

.delphi-report-content strong {
    color: var(--text-primary);
}

/* === Delphi: Oracle Consultation Drawer === */
.delphi-consult-drawer {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--accent-primary);
    background: var(--bg-deep);
    min-height: 200px;
    max-height: 45%;
    flex-shrink: 0;
}

.delphi-consult-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delphi-consult-msg {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.delphi-consult-role {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.delphi-consult-oracle .delphi-consult-role {
    color: var(--accent-primary);
}

.delphi-consult-user .delphi-consult-role {
    color: var(--text-muted);
}

.delphi-consult-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
}

.delphi-consult-oracle .delphi-consult-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.delphi-consult-user .delphi-consult-bubble {
    background: var(--accent-muted);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
}

.delphi-consult-input {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}