@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

*, ::before, ::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-width: 0;
    border-style: solid;
    border-color: #27272a;
}

:root {
    --primary: #4edea3;
    --secondary: #ffb95f;
    --tertiary: #ffb3af;
    --background: #09090b;
    --surface: #09090b;
    --surface-elevated: #111317;
    --surface-subtle: #0d0d10;
    --surface-contrast: #0e1012;
    --on-surface: #dde4dd;
    --border-color: #27272a;
    --error: #ef4444;
}

html, body {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--background);
    color: var(--on-surface);
    overflow: hidden;
    height: 100%;
    font-size: 12px;
    line-height: 1.5;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: var(--background);
    border-left: 1px solid var(--border-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%),
                linear-gradient(90deg, rgba(239, 68, 68, 0.04), rgba(0, 0, 0, 0), rgba(239, 68, 68, 0.04));
    z-index: 20;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.top-header {
    background-color: var(--background);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 1rem;
    padding-right: 1rem;
    height: 2.5rem;
    width: 100%;
    position: fixed;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.125rem 0.625rem;
    font-size: 10px;
    letter-spacing: 0.05em;
    font-weight: 600;
    transition: all 0.15s ease;
    cursor: pointer;
    background: transparent;
    color: #71717a;
    border: 1px solid transparent;
}
.tab-btn:hover {
    color: #d4d4d8;
}
.tab-btn.tab-active {
    background-color: var(--primary);
    color: #000;
    border-color: var(--primary);
}

.nav-sidebar {
    position: fixed;
    left: 0;
    top: 2.5rem;
    bottom: 1.75rem;
    width: 12rem;
    display: flex;
    flex-direction: column;
    z-index: 40;
    background-color: var(--background);
    border-right: 1px solid var(--border-color);
}

.ns-item {
    padding: 0.375rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-left: 2px solid transparent;
    color: #a1a1aa;
    font-size: 11px;
}
.ns-item:hover {
    background-color: #141816;
    color: #ffffff;
}
.ns-item.ns-selected {
    background-color: #141816;
    border-left-color: var(--primary);
    color: #ffffff;
}

.sidebar-footer {
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 10px;
    color: #71717a;
    background-color: var(--surface-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-content {
    margin-left: 12rem;
    margin-top: 2.5rem;
    margin-bottom: 1.75rem;
    background-color: var(--background);
    height: calc(100vh - 4.25rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.hero-panel {
    flex-shrink: 0;
    height: 160px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.discord-card-faded {
    background: linear-gradient(90deg, #111317 0%, #0d0e11 50%, rgba(9, 9, 11, 0.4) 100%);
    border: 1px solid #27272a;
    backdrop-filter: blur(4px);
    width: 20rem;
    flex-shrink: 0;
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 10;
}

.btn-discord-join {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.375rem 0;
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--primary);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn-discord-join:hover {
    background-color: #10b981;
    border-color: #10b981;
    color: #000;
}

.workspace-grid {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;
}
@media (min-width: 1280px) {
    .workspace-grid {
        flex-direction: row;
    }
}

.table-panel {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: var(--background);
    height: 100%;
    overflow: hidden;
    width: 100%;
}
@media (min-width: 1280px) {
    .table-panel {
        width: 60%;
    }
}

.search-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.625rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background);
    align-items: center;
    flex-shrink: 0;
}

#search-input {
    width: 100%;
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.625rem;
    color: #f4f4f5;
    text-transform: uppercase;
    font-size: 0.75rem;
    line-height: 1rem;
    font-family: inherit;
    outline: none;
    border-radius: 0;
}
#search-input:focus {
    border-color: var(--primary);
}
#search-input::placeholder {
    color: #52525b;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    color: #e4e4e7;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.btn-action:hover {
    background-color: #1f2923;
    border-color: var(--primary);
}
.btn-action:active {
    background-color: var(--primary);
    color: var(--background);
}

.table-scroll {
    overflow-y: auto;
    flex-grow: 1;
}

.offset-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.75rem;
}
.offset-table thead {
    color: rgba(255, 185, 95, 0.9);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-contrast);
    position: sticky;
    top: 0;
    z-index: 20;
}
.offset-table th {
    padding: 0.5rem;
    border-right: 1px solid var(--border-color);
    font-weight: 400;
}
.offset-table td {
    padding: 0.5rem;
    border-right: 1px solid rgba(39, 39, 42, 0.4);
    border-bottom: 1px solid rgba(39, 39, 42, 0.4);
}

.offset-row {
    cursor: crosshair;
    transition: background-color 0.1s ease;
}
.offset-row:hover {
    background-color: #1f2923;
}
.table-row-highlight {
    background-color: #1f2923;
    outline: 1px solid var(--primary);
}
.table-row-highlight td {
    color: #ffffff;
}

.status-strip {
    padding: 0.375rem 0.75rem;
    background-color: var(--surface-contrast);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #a1a1aa;
    flex-shrink: 0;
}

.preview-panel {
    background-color: var(--background);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    width: 100%;
}
@media (min-width: 1280px) {
    .preview-panel {
        width: 40%;
    }
}

.preview-header {
    padding: 0.625rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--background);
    flex-shrink: 0;
}

.code-container {
    padding: 0.75rem;
    overflow-y: auto;
    flex-grow: 1;
    font-size: 11px;
    line-height: 1.25rem;
    user-select: all;
    color: #a1a1aa;
}

.code-line {
    padding-left: 2rem;
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
    transition: background-color 0.15s ease;
}
.code-line:hover {
    background-color: #1f2923;
}
.line-highlight {
    background-color: #1f2923;
    border: 1px solid var(--primary);
    color: #ffffff;
}

.footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 1.75rem;
    background-color: var(--background);
    border-top: 1px solid var(--border-color);
    font-size: 10px;
    color: #71717a;
}
.footer-bar a {
    color: inherit;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.15s ease;
}
.footer-bar a:hover {
    color: var(--primary);
}

.status-dot {
    width: 6px;
    height: 6px;
    display: inline-block;
}
.status-dot-active {
    background-color: var(--primary);
}
.status-dot-secondary {
    background-color: var(--secondary);
}

.btn-cell-copy {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
}
.btn-cell-copy:hover {
    color: var(--primary);
}

/* Structural & Typography Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-grow { flex-grow: 1; }
.shrink-0 { flex-shrink: 0; }
.gap-1-5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-3-5 { gap: 0.875rem; }
.gap-4 { gap: 1rem; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-white { color: #ffffff; }
.text-zinc-100 { color: #f4f4f5; }
.text-zinc-200 { color: #e4e4e7; }
.text-zinc-300 { color: #d4d4d8; }
.text-zinc-400 { color: #a1a1aa; }
.text-zinc-500 { color: #71717a; }
.text-zinc-600 { color: #52525b; }
.text-emerald-400 { color: #34d399; }
.text-rose-400 { color: #fb7185; }
.text-sky-400 { color: #38bdf8; }
.text-amber-400 { color: #fbbf24; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-y-auto { overflow-y: auto; min-height: 0; }
.hover\:text-primary:hover { color: var(--primary); }
button:focus-visible, a:focus-visible, .ns-item:focus-visible { outline: 1px solid var(--primary); outline-offset: -1px; }
.relative { position: relative; }
.z-10 { z-index: 10; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.uppercase { text-transform: uppercase; }
.text-xs { font-size: 0.75rem; }
