:root {
    --bg-dark: #1a1a2e;
    --bg-panel: #16213e;
    --bg-input: #0f3460;
    --accent: #e94560;
    --accent-glow: rgba(233, 69, 96, 0.3);
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #f87171;
    --border: #2d3748;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.fixed-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-panel);
    border-bottom: 2px solid var(--accent);
    overflow: visible;
}

header {
    background: transparent;
    padding: 0.4rem 1rem;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

header h1 {
    font-size: 1.1rem;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
    white-space: nowrap;
}

.subtitle {
    display: none;
}

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

.header-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.btn-back {
    padding: 0.35rem 0.7rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.btn-back:hover:not(:disabled) {
    background: var(--bg-panel);
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-back:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.view-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.view-selector select {
    padding: 0.4rem 0.8rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.view-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 1;
    min-width: 0;
}

.view-buttons::-webkit-scrollbar {
    display: none;
}

.btn-view {
    padding: 0.35rem 0.7rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-view:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-view.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-view.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-swap-sim {
    padding: 0.35rem 0.8rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a2e;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-swap-sim:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.action-buttons {
    display: flex;
    gap: 0.4rem;
}

.btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset {
    background: var(--error);
    color: white;
}

.btn-step {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-run {
    background: var(--success);
    color: #1a1a2e;
}

.btn-execute {
    background: var(--accent);
    color: white;
    width: 100%;
    margin-top: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

main {
    padding: 0.8rem;
    margin-top: 60px;
    flex: 1;
    overflow-y: auto;
    height: calc(100vh - 60px);
}

.view {
    display: none;
    height: 100%;
}

.view.active {
    display: flex;
    flex-direction: column;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.8rem;
    flex: 1;
    overflow-y: auto;
}

.panel {
    background: var(--bg-panel);
    border-radius: 6px;
    padding: 0.8rem;
    border: 1px solid var(--border);
}

.panel h2 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.panel-header-with-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.panel-header-with-nav h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.register-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.register-nav .nav-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.register-nav .nav-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
}

.register-nav .nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.register-nav span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: center;
}

.register-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.register-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0.5rem;
    background: var(--bg-input);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}

.register-row .name {
    color: var(--warning);
    min-width: 50px;
}

.register-row .value {
    color: var(--success);
}

.register-row .perms {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.register-row.null .value {
    color: var(--text-secondary);
}

.register-row.has-clist {
    cursor: pointer;
    border-left: 2px solid var(--accent);
}

.register-row.has-clist:hover {
    background: var(--bg-tertiary);
}

.state-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.state-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    background: var(--bg-input);
    border-radius: 4px;
    font-size: 0.85rem;
}

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

.state-row .value {
    color: var(--success);
    font-family: 'Consolas', monospace;
}

.state-row.clickable {
    cursor: pointer;
    transition: background 0.2s ease, border-left 0.2s ease;
    border-left: 3px solid transparent;
}

.state-row.clickable:hover {
    background: var(--bg-panel);
    border-left: 3px solid var(--accent);
}

.state-row.clickable:hover .value {
    color: var(--accent);
}

.boot-sequence {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.boot-sequence h3 {
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.boot-steps {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.boot-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-input);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--border);
    transition: all 0.3s;
}

.boot-step span {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
}

.boot-step.active {
    color: var(--text-primary);
    border-left-color: var(--accent);
    background: rgba(168, 85, 247, 0.15);
}

.boot-step.active span {
    background: var(--accent);
    color: #1a1a2e;
}

.boot-step.done {
    color: var(--success);
    border-left-color: var(--success);
}

.boot-step.done span {
    background: var(--success);
    color: #1a1a2e;
}

.boot-status {
    margin-top: 0.8rem;
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.boot-sequence-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-panel);
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
    overflow: visible;
}

.boot-steps-horizontal {
    display: flex;
    gap: 0.4rem;
    flex: 1;
    overflow: visible;
}

.boot-label {
    color: var(--warning);
    font-weight: 600;
    font-size: 0.8rem;
}

.boot-step-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.boot-step-btn span {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.boot-step-btn:hover:not(.done):not(:disabled) {
    background: var(--bg-panel);
    border-color: var(--accent);
    color: var(--text-primary);
}

.boot-step-btn.active {
    background: rgba(233, 69, 96, 0.2);
    border-color: var(--accent);
    color: var(--text-primary);
}

.boot-step-btn.active span {
    background: var(--accent);
    color: white;
}

.boot-step-btn.done {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.boot-step-btn.done span {
    background: var(--success);
    color: #1a1a2e;
}

.boot-step-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.boot-run-btn {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.boot-sequence-banner .boot-step {
    flex: 1;
    justify-content: center;
    border-left: none;
    border-bottom: 2px solid var(--border);
    font-size: 0.7rem;
    padding: 0.3rem 0.4rem;
}

.boot-sequence-banner .boot-step.active {
    border-bottom-color: var(--accent);
    border-left: none;
}

.boot-sequence-banner .boot-step.done {
    border-bottom-color: var(--success);
    border-left: none;
}

.boot-sequence-banner .boot-status {
    margin-top: 0;
    padding: 0.3rem 0.6rem;
    min-width: 100px;
    font-size: 0.75rem;
}

.flag-display-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.flag-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.flag-row-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    min-width: 45px;
    font-weight: 500;
}

.flag-display {
    display: flex;
    justify-content: space-around;
    gap: 0.6rem;
}

.flag {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem;
    background: var(--bg-input);
    border-radius: 4px;
    min-width: 55px;
    transition: all 0.3s;
}

.flag.active {
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.flag-letter {
    font-size: 1.2rem;
    font-weight: bold;
}

.flag-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.flag.active .flag-name {
    color: white;
}


.coming-soon {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-style: italic;
}

.tutorial-content, .visualizer-content, .capabilities-content, .editor-content {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border);
}

/* ==================== CAPABILITY EXPLORER ==================== */

.capabilities-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    gap: 0;
}

.cap-nav-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
    border-radius: 6px;
    margin-bottom: 0.8rem;
    flex-shrink: 0;
}

.cap-nav-bar select {
    padding: 0.4rem 0.8rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}

.cap-content-area {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}

.cap-sidebar {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 0.8rem;
    border: 1px solid var(--border);
    overflow-y: auto;
    max-height: 100%;
}

.cap-sidebar h2 {
    display: none;
}

.cap-intro {
    display: none;
}

.cap-section {
    margin-bottom: 1rem;
}

.cap-section h3 {
    font-size: 0.8rem;
    color: var(--warning);
    margin-bottom: 0.4rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
}

.token-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Context Register Button Grid */
.cr-button-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    padding: 0.3rem 0;
}

.cr-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.6rem;
    font-weight: bold;
    cursor: default;
    transition: all 0.2s;
    padding: 1px;
}

.cr-btn .cr-num {
    font-size: 0.65rem;
    line-height: 1;
}

.cr-btn .cr-label {
    font-size: 0.55rem;
    opacity: 0.7;
    margin-top: 1px;
}

.cr-btn.cr-loaded {
    background: linear-gradient(135deg, #2d4a3e 0%, #1a3a2e 100%);
    border-color: var(--success);
    color: var(--success);
    cursor: pointer;
}

.cr-btn.cr-loaded:hover {
    background: linear-gradient(135deg, #3d5a4e 0%, #2a4a3e 100%);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
    transform: scale(1.05);
}

.cr-btn.cr-namespace {
    background: linear-gradient(135deg, #3d2a1a 0%, #2a1a0a 100%);
    border-color: #cd853f;
    color: #cd853f;
    cursor: pointer;
}

.cr-btn.cr-namespace:hover {
    background: linear-gradient(135deg, #4d3a2a 0%, #3a2a1a 100%);
    box-shadow: 0 0 8px rgba(205, 133, 63, 0.3);
    transform: scale(1.05);
}

.cr-btn.cr-thread {
    background: linear-gradient(135deg, #2a1a3d 0%, #1a0a2a 100%);
    border-color: #9370db;
    color: #9370db;
    cursor: pointer;
}

.cr-btn.cr-thread:hover {
    background: linear-gradient(135deg, #3a2a4d 0%, #2a1a3a 100%);
    box-shadow: 0 0 8px rgba(147, 112, 219, 0.3);
    transform: scale(1.05);
}

.cr-btn.cr-clist {
    background: linear-gradient(135deg, #1a2a4d 0%, #0a1a3a 100%);
    border-color: #5dade2;
    color: #5dade2;
    cursor: pointer;
}

.cr-btn.cr-clist:hover {
    background: linear-gradient(135deg, #2a3a5d 0%, #1a2a4a 100%);
    box-shadow: 0 0 8px rgba(93, 173, 226, 0.3);
    transform: scale(1.05);
}

.cr-btn.cr-code {
    background: linear-gradient(135deg, #4d3a1a 0%, #3a2a0a 100%);
    border-color: #f39c12;
    color: #f39c12;
    cursor: pointer;
}

.cr-btn.cr-code:hover {
    background: linear-gradient(135deg, #5d4a2a 0%, #4a3a1a 100%);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
    transform: scale(1.05);
}

.cr-btn.cr-abstraction {
    background: linear-gradient(135deg, #1a4d2a 0%, #0a3a1a 100%);
    border-color: #58d68d;
    color: #58d68d;
    cursor: pointer;
}

.cr-btn.cr-abstraction:hover {
    background: linear-gradient(135deg, #2a5d3a 0%, #1a4a2a 100%);
    box-shadow: 0 0 8px rgba(88, 214, 141, 0.3);
    transform: scale(1.05);
}

.cr-btn.cr-empty {
    opacity: 0.5;
}

.cr-btn.cr-empty:hover {
    opacity: 0.7;
}

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

.clist-header h3 {
    margin: 0;
}

.btn-add-cap {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    background: var(--bg-dark);
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-add-cap:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.token-card {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.token-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #e74c3c;
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.token-card:hover .token-delete-btn {
    opacity: 1;
}

.token-delete-btn:hover {
    background: #e74c3c;
    color: white;
}

.token-card:hover {
    border-color: var(--accent);
    transform: translateX(5px);
}

.token-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.token-card.null-cap {
    opacity: 0.5;
}

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

.token-name {
    font-weight: bold;
    color: var(--text-primary);
}

.token-reg {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-dark);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.token-perms {
    display: flex;
    gap: 0.2rem;
}

.perm-badge {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
}

.perm-badge.inactive {
    background: var(--bg-dark);
    color: var(--text-secondary);
}

.perm-r { background: #3b82f6; }
.perm-w { background: #f59e0b; }
.perm-x { background: #ef4444; }
.perm-l { background: #8b5cf6; }
.perm-s { background: #10b981; }
.perm-e { background: #ec4899; }
.perm-b { background: #14b8a6; }
.perm-m { background: #7c3aed; }
.perm-f { background: #06b6d4; }
.perm-g { background: #84cc16; }

.cap-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    max-height: 100%;
}

.cap-detail-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    width: 100%;
    overflow: visible;
}

.cap-detail-panel h2 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.cap-hint {
    color: var(--text-secondary);
    font-style: italic;
}

.cap-detail-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.cap-detail-tab {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    border-radius: 4px 4px 0 0;
    transition: all 0.15s ease;
    position: relative;
    bottom: -1px;
}

.cap-detail-tab:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.cap-detail-tab.active {
    color: var(--accent);
    background: var(--bg-input);
    border-color: var(--border);
    border-bottom: 1px solid var(--bg-input);
}

.clist-tab-content {
    width: 100%;
}

.clist-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.clist-tab-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.clist-tab-entries {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 320px;
    overflow-y: auto;
}

.clist-tab-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    background: var(--bg-input);
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    cursor: default;
    transition: border-color 0.15s;
}

.clist-tab-entry:hover {
    border-color: var(--accent);
}

.clist-tab-entry.clist-tab-executable {
    cursor: pointer;
    border-left: 2px solid var(--accent);
}

.clist-tab-entry.clist-tab-executable:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.clist-tab-entry.clist-tab-executable .clist-tab-name::after {
    content: ' ▶';
    color: var(--accent);
    font-size: 0.7rem;
}

.clist-tab-idx {
    color: var(--text-secondary);
    min-width: 2rem;
}

.clist-tab-name {
    color: var(--text-primary);
    flex: 1;
    font-weight: 500;
}

.clist-tab-perms {
    display: flex;
    gap: 2px;
}

.clist-tab-perms .perm-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.25rem;
}

.clist-tab-offset {
    color: var(--text-secondary);
    font-size: 0.75rem;
    min-width: 3.5rem;
    text-align: right;
}

.clist-tab-entry-wrap {
    display: flex;
    flex-direction: column;
}

.clist-tab-expand {
    color: var(--text-secondary);
    font-size: 0.7rem;
    transition: transform 0.15s;
    margin-left: auto;
    min-width: 1rem;
    text-align: center;
}

.clist-tab-entry-wrap.expanded .clist-tab-expand {
    transform: rotate(90deg);
}

.clist-tab-words {
    display: none;
    padding: 0.25rem 0.4rem 0.35rem 2.2rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    gap: 0.2rem;
    flex-direction: column;
}

.clist-tab-entry-wrap.expanded .clist-tab-words {
    display: flex;
}

.clist-tab-entry-wrap.expanded .clist-tab-entry {
    border-radius: 4px 4px 0 0;
}

.clist-word {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
}

.clist-word-label {
    color: var(--accent);
    font-weight: 600;
    min-width: 1.5rem;
}

.clist-word-desc {
    color: var(--text-secondary);
    min-width: 4rem;
}

.clist-word-val {
    color: var(--text-primary);
    font-weight: 500;
}

.content-tab-section {
    padding: 0.5rem;
}

.content-tab-heading {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
}

.content-tab-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.content-tab-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem;
    background: var(--bg-input);
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.content-tab-key {
    color: var(--text-secondary);
    font-size: 0.7rem;
    min-width: 2.5rem;
}

.content-tab-val {
    color: var(--text-primary);
    font-weight: 500;
}

.content-tab-desc {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 0.4rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-top: 0.4rem;
    border-left: 2px solid var(--accent);
}

.cap-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.cap-detail-item {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: 6px;
}

.cap-detail-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.cap-detail-item .value {
    color: var(--success);
    font-family: 'Consolas', monospace;
    font-size: 1rem;
}

.golden-key-display {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.golden-key-display label {
    color: #1a1a2e;
    font-weight: bold;
}

.golden-key-display .value {
    color: #1a1a2e;
    font-size: 0.9rem;
    word-break: break-all;
    background: rgba(255,255,255,0.3);
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.perm-display {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.perm-display .perm-badge {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.reg-badge {
    font-size: 0.75rem;
    background: var(--bg-input);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
    font-weight: normal;
}

.gt-section, .ns-entry-section {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border);
}

.word-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.word-row {
    display: grid;
    grid-template-columns: 80px 55px 1fr;
    gap: 0.8rem;
    align-items: start;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
}

.hex-btns {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hex-btn, .le-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-align: center;
    min-width: 32px;
}

.hex-btn {
    color: var(--warning);
}

.le-btn {
    color: var(--accent);
}

.hex-btn:hover {
    background: var(--warning);
    color: var(--bg-dark);
    border-color: var(--warning);
}

.le-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

.hex-btn-disabled {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    color: var(--text-muted);
    text-align: center;
    min-width: 32px;
    opacity: 0.5;
}

.word-row.gt-row {
    background: var(--bg-dark);
    border-color: var(--warning);
}

.word-key {
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--warning);
    padding: 0.3rem 0;
}


.word-fields {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-start;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.field-group .field-input {
    width: 100%;
}

.field-left {
    align-items: flex-start;
    flex: 2;
}

.field-center {
    align-items: center;
    flex: 1;
}

.field-right {
    align-items: flex-start;
    flex: 3;
}

.field-right-full {
    flex: 1;
    align-items: flex-start;
    width: 100%;
}

.field-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.field-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Capability Title Bar */
.cap-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.cap-hierarchy-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.hier-item {
    padding: 0.2rem 0.5rem;
    background: var(--bg-light);
    border-radius: 3px;
    color: var(--text-secondary);
}

.hier-item.hier-current {
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.hier-arrow {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.cap-lock-status {
    display: flex;
    align-items: center;
}

.lock-status {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.lock-status.locked {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border: 1px solid var(--error);
}

.lock-status.unlocked {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.reg-badge-small {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: var(--accent-blue);
    color: white;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.3rem;
}

.field-input {
    padding: 0.25rem 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--success);
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    width: 12ch;
    text-align: left;
}

.field-input.field-wide {
    width: 100%;
    text-align: left;
}

.field-input:focus {
    outline: none;
    border-color: var(--accent);
}

.field-select {
    padding: 0.25rem 0.3rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.7rem;
    min-width: 80px;
}

.mac-field {
    position: relative;
    cursor: help;
}

.mac-field.mac-valid .mac-value {
    color: var(--success);
}

.mac-field.mac-invalid .mac-value {
    color: var(--error);
}

.mac-value {
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 8ch;
}

.mac-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.url-field {
    text-align: left;
    font-family: inherit;
}

.btn-recalc-mini {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.8rem;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-recalc-mini:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.perm-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.perm-hex {
    font-family: 'Consolas', monospace;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.section-title {
    color: var(--warning);
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gt-hex-display {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gt-label {
    color: #1a1a2e;
    font-weight: bold;
    font-size: 0.8rem;
}

.gt-hex-display code {
    color: #1a1a2e;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    background: rgba(255,255,255,0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    flex: 1;
    text-align: center;
}

.gt-bit-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 0.8rem;
}

.bit-field {
    background: var(--bg-panel);
    border-radius: 6px;
    padding: 0.6rem;
    border: 1px solid var(--border);
}

.bit-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.bit-range {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--accent);
}

.bit-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: bold;
}

.bit-input {
    width: 100%;
    padding: 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--success);
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
}

.bit-input:focus {
    outline: none;
    border-color: var(--accent);
}

.perm-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.gt-perm-check {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.gt-perm-check input {
    display: none;
}

.gt-perm-check .perm-badge {
    opacity: 0.4;
    transition: opacity 0.2s;
}

.gt-perm-check input:checked + .perm-badge {
    opacity: 1;
}

.perm-hex {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: right;
}

.gt-security-note {
    margin-top: 0.8rem;
    padding: 0.6rem;
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid var(--warning);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.gt-security-note strong {
    color: var(--warning);
}

.ns-intro-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.ns-word-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 0.8rem;
}

.ns-word {
    background: var(--bg-panel);
    border-radius: 6px;
    padding: 0.6rem;
    border: 1px solid var(--border);
}

.word-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.word-num {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--accent);
}

.word-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: bold;
}

.word-input {
    width: 100%;
    padding: 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--success);
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
}

.word-input:focus {
    outline: none;
    border-color: var(--accent);
}

.word-decimal {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    text-align: right;
}

.seals-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.seal-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.seal-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    min-width: 65px;
}

.seal-input {
    flex: 1;
    padding: 0.3rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--success);
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
}

.seal-input:focus {
    outline: none;
    border-color: var(--accent);
}

.seal-select {
    flex: 1;
    padding: 0.3rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.7rem;
}

.seal-value {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--warning);
    background: var(--bg-input);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
}

.mac-validation {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 6px;
    border: 2px solid;
}

.mac-valid {
    background: rgba(74, 222, 128, 0.1);
    border-color: var(--success);
}

.mac-invalid {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--error);
}

.mac-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mac-icon {
    font-size: 1.2rem;
}

.mac-valid .mac-icon {
    color: var(--success);
}

.mac-invalid .mac-icon {
    color: var(--error);
}

.mac-text {
    font-weight: bold;
    font-size: 0.85rem;
}

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

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

.mac-details {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.mac-formula {
    font-family: 'Consolas', monospace;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.mac-values {
    display: flex;
    gap: 1rem;
}

.mac-values span {
    font-family: 'Consolas', monospace;
}

.btn-recalc {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.btn-recalc:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.permission-legend {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.2rem;
    border: 1px solid var(--border);
}

.permission-legend h3 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--bg-input);
    padding: 0.8rem;
    border-radius: 6px;
}

.perm-item .perm-badge {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    flex-shrink: 0;
}

.perm-info {
    display: flex;
    flex-direction: column;
}

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

.perm-info span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.btn-create {
    width: 100%;
    margin-top: 1rem;
    background: var(--success);
    color: #1a1a2e;
}

.lock-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--warning);
}

/* ==================== CAPABILITY DNS EDITOR ==================== */

.dns-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 1.5rem;
    min-height: calc(100vh - 200px);
}

.dns-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.dns-panel h2 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.dns-panel h3 {
    color: var(--warning);
    margin-bottom: 0.8rem;
}

.dns-intro {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.dns-log {
    grid-column: 1 / -1;
}


.preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
    border: 2px dashed var(--border);
    border-radius: 8px;
}

.preview-token {
    background: linear-gradient(135deg, #d4af37, #aa8c2c);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.preview-token-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.preview-token-icon {
    font-size: 1.5rem;
}

.preview-token-name {
    color: #1a1a2e;
    font-weight: bold;
    font-size: 1.2rem;
}

.preview-token-key {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: #1a1a2e;
    opacity: 0.8;
    word-break: break-all;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.preview-token-perms {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.preview-perm {
    padding: 0.3rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: #1a1a2e;
    font-weight: bold;
    font-size: 0.85rem;
}

.preview-token-target {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    color: #1a1a2e;
    font-size: 0.85rem;
}

.dns-registry {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.registry-list {
    max-height: 200px;
    overflow-y: auto;
}

.registry-empty {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
    text-align: center;
}

.registry-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--warning);
}

.registry-item-name {
    font-weight: bold;
    color: var(--text-primary);
}

.registry-item-perms {
    display: flex;
    gap: 0.2rem;
}

.registry-item-perm {
    padding: 0.15rem 0.4rem;
    background: var(--bg-panel);
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
}

.dns-log-output {
    max-height: 150px;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    background: var(--bg-dark);
    border-radius: 4px;
    padding: 0.8rem;
}

.dns-log-output .log-entry {
    margin-bottom: 0.3rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
}

.dns-log-output .log-entry:last-child {
    border-bottom: none;
}

/* ==================== INTERACTIVE TUTORIAL ==================== */

.tutorial-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.tutorial-nav-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
    border-radius: 6px;
    margin-bottom: 0.8rem;
    flex-shrink: 0;
}

.tutorial-nav-bar select {
    padding: 0.4rem 0.8rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}

.progress-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.progress-bar-mini {
    width: 80px;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-mini .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transition: width 0.3s ease;
}

.progress-mini span {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.tutorial-sidebar {
    display: none;
}

.lesson-list {
    display: none;
}

.lesson-btn {
    display: none;
}

.tutorial-progress {
    display: none;
}

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.tutorial-main {
    background: var(--bg-panel);
    border-radius: 8px;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.lesson-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    flex-wrap: nowrap;
}

.btn-back-to-landing {
    background: var(--bg-panel);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-back-to-landing:hover {
    background: var(--accent);
    color: white;
}

.lesson-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}

.lesson-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.lesson-dropdown-trigger:hover {
    background: var(--bg-tertiary);
}

#lessonDropdownLabel {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-dropdown-arrow {
    font-size: 0.65rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.lesson-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    min-width: 220px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.3rem 0;
}

.lesson-dropdown.open .lesson-dropdown-menu {
    display: block;
}

.lesson-dropdown-group-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--accent);
    padding: 0.5rem 0.8rem 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}


.lesson-dropdown-items {
    display: none;
}

.lesson-dropdown-group:hover .lesson-dropdown-items,
.lesson-dropdown-group.expanded .lesson-dropdown-items {
    display: block;
}

.lesson-dropdown-item {
    font-size: 0.75rem;
    padding: 0.35rem 0.8rem 0.35rem 1.4rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.lesson-dropdown-item.active {
    color: var(--accent);
    font-weight: bold;
}

.lesson-step-nav-bottom {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.lesson-content {
    flex: 1;
    overflow-y: auto;
}

.lesson-text {
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.lesson-text h3 {
    color: var(--warning);
    margin-bottom: 0.8rem;
}

.lesson-text p {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.lesson-text ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.lesson-text li {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.lesson-text code {
    background: var(--bg-input);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    color: var(--success);
}

.lesson-text .highlight {
    background: rgba(233, 69, 96, 0.2);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
}

.lesson-text .key-concept {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid var(--success);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.lesson-demo {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.demo-title {
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.demo-visual {
    flex: 1;
}

.demo-explanation {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.golden-token-demo {
    background: linear-gradient(135deg, #d4af37, #aa8c2c);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.token-label {
    color: #1a1a2e;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.token-key {
    font-family: 'Consolas', monospace;
    font-size: 0.65rem;
    color: #1a1a2e;
    word-break: break-all;
    opacity: 0.8;
}

.permission-demo {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.perm-demo-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
}

.lesson-interactive {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.interactive-title {
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.quiz-question {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option {
    padding: 0.8rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    text-align: left;
    transition: all 0.2s;
}

.quiz-option:hover {
    border-color: var(--accent);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.quiz-feedback.correct {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.quiz-feedback.incorrect {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
}

.lesson-step-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 0;
    margin-left: auto;
}

.lesson-step-nav .btn-step {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.lesson-step-nav .btn-step:hover:not(:disabled) {
    background: var(--accent);
    color: #1a1a2e;
    border-color: var(--accent);
}

.lesson-step-nav .btn-step:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.step-indicator {
    color: var(--text-muted);
    font-size: 0.9rem;
    min-width: 100px;
    text-align: center;
}

.lesson-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.tutorial-edit-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-try {
    padding: 0.6rem 1.2rem;
    background: var(--bg-input);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-try:hover {
    background: var(--accent);
    color: white;
}

.btn-complete {
    padding: 0.6rem 1.2rem;
    background: var(--success);
    border: none;
    border-radius: 4px;
    color: var(--bg-dark);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-complete:hover {
    opacity: 0.9;
}

.register-demo {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.reg-demo-item {
    background: var(--bg-panel);
    padding: 0.6rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}

.reg-demo-name {
    color: var(--success);
}

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

/* ==================== INSTRUCTION VISUALIZER ==================== */

.visualizer-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 200px);
}

.viz-controls {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.viz-controls h2 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.viz-intro {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.viz-instruction-select {
    margin-bottom: 1rem;
}

.viz-instruction-select label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.viz-instruction-select select {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.viz-operands {
    margin-bottom: 1rem;
}

.viz-operand-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.viz-operand-row label {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.viz-operand-row input {
    width: 80px;
    padding: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    text-align: center;
}

.viz-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.viz-buttons .btn {
    flex: 1;
    min-width: 80px;
}

.btn-setup { background: var(--accent); color: #1a1a2e; }
.btn-run { background: var(--success); color: #1a1a2e; }
.btn-run:disabled { background: #555; color: #999; cursor: not-allowed; }
.btn-reset { background: var(--warning); color: #1a1a2e; }

.viz-stage {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.viz-registers {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border);
    min-height: 250px;
}

.viz-reg-column h3 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 1rem;
}

.viz-reg-box {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    text-align: center;
    margin-bottom: 0.8rem;
    transition: all 0.3s ease;
}

.viz-reg-box.active {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.viz-reg-box.highlight {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.viz-reg-box.viz-dest {
    border-color: var(--warning);
}

.viz-reg-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.viz-reg-value {
    font-family: 'Consolas', monospace;
    font-size: 1.1rem;
    color: var(--success);
}

.viz-alu {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.viz-alu-box {
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    text-align: center;
    min-width: 120px;
}

.viz-alu-op {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 0.5rem;
}

.viz-alu-result {
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
}

.viz-data-flow {
    margin-top: 1rem;
    font-size: 2rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
}

.viz-data-flow.show {
    opacity: 1;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.viz-flags-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.viz-flags-panel h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.viz-flags {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.viz-flag {
    text-align: center;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 2px solid var(--border);
    min-width: 80px;
    transition: all 0.3s;
}

.viz-flag span {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.viz-flag.active span {
    color: var(--success);
}

.viz-flag.active {
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.viz-flag.changed {
    animation: flagPulse 0.5s ease-in-out;
}

@keyframes flagPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); background: var(--success); }
}

.viz-flag-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.viz-explanation {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.viz-explanation h3 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.viz-steps {
    font-size: 0.95rem;
    line-height: 1.8;
}

.viz-step {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: var(--bg-input);
    border-radius: 6px;
    border-left: 3px solid var(--border);
    opacity: 0.5;
    transition: all 0.3s;
}

.viz-step.active {
    opacity: 1;
    border-left-color: var(--accent);
}

.viz-step.done {
    opacity: 1;
    border-left-color: var(--success);
}

.viz-step-num {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--border);
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.viz-step.active .viz-step-num {
    background: var(--accent);
    color: #1a1a2e;
}

.viz-step.done .viz-step-num {
    background: var(--success);
    color: #1a1a2e;
}

.viz-hint {
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 900px) {
    .visualizer-layout {
        grid-template-columns: 1fr;
    }
    
    .viz-registers {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 900px) {
    .capabilities-layout {
        grid-template-columns: 1fr;
    }
    
    .cap-sidebar {
        max-height: none;
    }
}

/* Mobile header - horizontal scroll for view buttons */
@media (max-width: 600px) {
    header {
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.4rem 0.5rem;
    }
    
    header h1 {
        font-size: 0.9rem;
    }
    
    .header-left {
        flex: 0 0 auto;
    }
    
    .header-right {
        display: none;
    }
    
    nav.controls {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .view-buttons {
        justify-content: flex-start;
        padding: 0.25rem 0;
    }
    
    .btn-view {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .btn-back {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ==================== ASSEMBLY EDITOR ==================== */

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toolbar-group label {
    color: var(--accent);
    font-weight: bold;
    font-size: 0.85rem;
}

.toolbar-input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    width: 15ch;
}

.toolbar-input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    background: var(--accent);
    color: var(--bg-dark);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
}

.btn-sm:hover {
    opacity: 0.85;
}

.btn-sm.btn-green {
    background: var(--success);
}

.namespace-path {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    padding: 0.2rem 0.5rem;
    background: var(--bg-dark);
    border-radius: 3px;
}

.editor-file-path {
    color: var(--accent);
    font-size: 0.9rem;
    font-family: 'Fira Code', monospace;
    font-weight: 500;
}

.editor-file-dropdown {
    background: var(--bg-dark);
    color: var(--accent);
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
    cursor: pointer;
    min-width: 160px;
}

.editor-file-dropdown:hover {
    color: #fff;
}

.editor-file-dropdown:focus {
    outline: none;
}

.editor-file-dropdown option {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 0.4rem 0.6rem;
}

.editor-file-dropdown optgroup {
    background: #0f0f1a;
    color: #888;
    font-weight: 600;
    font-style: normal;
    padding: 0.3rem 0;
}

.perm-badge-green {
    display: inline-block;
    background: var(--success);
    color: var(--bg-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.75rem;
}

.toolbar-status {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
}

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

#editor.view.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
}

.editor-content {
    display: grid;
    grid-template-columns: 120px 1fr 180px 280px;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    padding: 1rem;
}

/* Panel toggle states */
.editor-content.hide-examples {
    grid-template-columns: 0 1fr 180px 280px;
}

.editor-content.hide-examples .editor-examples-panel {
    display: none;
}

.editor-content.hide-registers {
    grid-template-columns: 120px 1fr 0 280px;
}

.editor-content.hide-registers .editor-registers-panel {
    display: none;
}

.editor-content.hide-examples.hide-registers {
    grid-template-columns: 0 1fr 0 280px;
}

.editor-content.hide-output .editor-output-panel {
    display: none;
}

.editor-content.hide-examples.hide-output {
    grid-template-columns: 0 1fr 180px 0;
}

.editor-content.hide-registers.hide-output {
    grid-template-columns: 120px 1fr 0 0;
}

.editor-content.hide-examples.hide-registers.hide-output {
    grid-template-columns: 1fr;
}

/* Full code expansion - hide all side panels */
.editor-content.full-code {
    grid-template-columns: 1fr;
}

.editor-content.full-code .editor-examples-panel,
.editor-content.full-code .editor-registers-panel,
.editor-content.full-code .editor-output-panel {
    display: none;
}

.editor-content.full-code .code-editor-panel {
    grid-column: 1;
    width: 100%;
}

/* Toggle button styles */
.toolbar-toggles {
    margin-left: auto;
}

.btn-toggle {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    font-size: 0.7rem !important;
    padding: 0.3rem 0.5rem !important;
}

.btn-toggle:hover {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
}

.btn-toggle.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

.btn-expand {
    background: var(--accent-dark) !important;
    border-color: var(--accent-dark) !important;
}

.btn-expand.active {
    background: var(--success) !important;
    border-color: var(--success) !important;
}

.editor-examples-panel {
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
    padding: 0.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.editor-examples-panel .paradigm-tabs {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin-bottom: 0.5rem;
}

.editor-examples-panel .paradigm-tab {
    flex: 1;
    padding: 0.5rem 0.3rem;
    font-size: 0.7rem;
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

.editor-examples-panel .paradigm-tab:first-child {
    border-radius: 4px 0 0 4px;
}

.editor-examples-panel .paradigm-tab:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.example-btn {
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.example-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.reg-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}


.reg-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: var(--bg-dark);
    border-radius: 4px;
    font-size: 0.8rem;
}

.reg-item .reg-name {
    color: var(--accent);
    font-weight: bold;
}

.reg-item .reg-value {
    color: var(--text-primary);
    font-family: monospace;
}

.reg-item.spare {
    opacity: 0.4;
}

.reg-item.spare .reg-name {
    color: var(--text-muted);
}

.code-editor-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.code-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#codeEditor {
    flex: 1;
    resize: none;
}

.editor-intro {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.cr7-panel {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.cr7-panel h3 {
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.cr7-field {
    margin-bottom: 0.8rem;
}

.cr7-field label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.cr7-field input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}

.cr7-field input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

.perm-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.perm-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
}

.perm-checkboxes input[type="checkbox"] {
    accent-color: var(--accent);
}

.golden-key-display {
    display: block;
    font-family: 'Consolas', monospace;
    font-size: 0.65rem;
    color: var(--warning);
    word-break: break-all;
    background: var(--bg-dark);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.2rem;
}

.cr7-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.perm-badge-fixed {
    display: inline-block;
    background: var(--accent);
    color: var(--bg-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.75rem;
    margin-right: 0.3rem;
}

.perm-note {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.cr7-error {
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid var(--error);
    border-radius: 4px;
    color: var(--error);
    font-size: 0.75rem;
}

.cr7-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-load {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-load:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-clear {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
    opacity: 0.7;
}

.btn-clear:hover {
    background: var(--error);
    color: white;
    opacity: 1;
    border-color: var(--error);
}

.btn-save-tutorial {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-save-tutorial.has-changes {
    background: var(--success);
    color: white;
    opacity: 1;
    border-color: var(--success);
}

.btn-save-tutorial:hover {
    opacity: 1;
}

.btn-reset-tutorial {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-reset-tutorial:hover {
    background: var(--warning);
    color: var(--bg-dark);
    opacity: 1;
    border-color: var(--warning);
}

.btn-export-tutorial,
.btn-import-tutorial {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    opacity: 0.7;
}

.btn-export-tutorial:hover {
    background: var(--accent);
    color: var(--bg-dark);
    opacity: 1;
    border-color: var(--accent);
}

.btn-import-tutorial:hover {
    background: var(--info);
    color: white;
    opacity: 1;
    border-color: var(--info);
}

.lesson-text[contenteditable="true"],
.lesson-demo[contenteditable="true"] {
    outline: none;
    border: 1px dashed transparent;
    transition: border-color 0.2s;
}

.lesson-text[contenteditable="true"]:focus,
.lesson-demo[contenteditable="true"]:focus {
    border-color: var(--accent);
}

.lesson-text[contenteditable="true"]:hover,
.lesson-demo[contenteditable="true"]:hover {
    border-color: var(--border);
}

.btn-save {
    flex: 1;
    padding: 0.5rem;
    background: var(--success);
    border: none;
    border-radius: 4px;
    color: var(--bg-dark);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-save:hover {
    opacity: 0.9;
}

.editor-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn-run-prog { background: var(--success); color: #1a1a2e; }
.btn-step-prog { background: var(--accent); color: #1a1a2e; }
.btn-reset-prog { background: var(--warning); color: #1a1a2e; }

.editor-status {
    background: var(--bg-input);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-item label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.status-item span {
    color: var(--success);
    font-family: 'Consolas', monospace;
}

.editor-examples {
    margin-bottom: 1.5rem;
}

.editor-examples h3 {
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.example-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.paradigm-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
}

.paradigm-tab {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
}

.paradigm-tab:first-child {
    border-radius: 4px 0 0 4px;
}

.paradigm-tab:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.paradigm-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.paradigm-tab:hover:not(.active) {
    background: var(--border);
}

.paradigm-content {
    display: none;
}

.paradigm-content.active {
    display: block;
}

.paradigm-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    font-style: italic;
}

.btn-example {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-example:hover {
    background: var(--border);
    border-color: var(--accent);
}

.editor-help h3 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.help-section {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

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

.editor-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.code-editor-panel {
    flex: 1;
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.code-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.line-numbers {
    padding: 1rem 0.5rem 1rem 14px;
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border);
    min-width: 44px;
    overflow-y: auto;
}

.line-numbers span {
    display: block;
    height: calc(0.9rem * 1.5);
    line-height: calc(0.9rem * 1.5);
    cursor: pointer;
    position: relative;
    padding-right: 4px;
}

.line-numbers span:hover {
    color: var(--text-primary);
}

.line-numbers span.exec-line {
    color: #ffff00;
    font-weight: bold;
    text-shadow: 0 0 4px #ffff00;
}

.line-numbers span.bp-line {
    color: #ff4444;
    font-weight: bold;
}

.line-numbers span.bp-line::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4444;
}

.line-numbers span.exec-line.bp-line {
    color: #ffff00;
    text-shadow: 0 0 4px #ffff00;
}

.line-numbers span.exec-line.bp-line::before {
    background: #ff4444;
    box-shadow: 0 0 4px #ff4444;
}

.parsed-line.has-breakpoint {
    border-left: 3px solid #ff4444;
    padding-left: 2px;
}

.bp-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4444;
    margin-right: 4px;
    vertical-align: middle;
}

.btn-cr7 {
    background: rgba(0, 200, 255, 0.15) !important;
    color: #00c8ff !important;
    border: 1px solid rgba(0, 200, 255, 0.4) !important;
    font-weight: bold;
}
.btn-cr7:hover {
    background: rgba(0, 200, 255, 0.3) !important;
}

.cr7-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cr7-panel {
    background: var(--bg-dark, #1a1a2e);
    border: 1px solid var(--border, #333);
    border-radius: 8px;
    width: 520px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.cr7-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border, #333);
    font-weight: bold;
    color: #00c8ff;
    font-size: 0.95rem;
}

.cr7-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
}
.cr7-close:hover { color: #ff4444; }

.cr7-panel-body {
    padding: 0.75rem 1rem;
}

.cr7-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cr7-section:last-child { border-bottom: none; margin-bottom: 0; }

.cr7-section-title {
    color: #00c8ff;
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cr7-field {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 0.85rem;
}

.cr7-label {
    color: var(--text-secondary, #888);
    min-width: 90px;
}

.cr7-value {
    color: var(--text-primary, #e0e0e0);
    font-family: 'Consolas', monospace;
    text-align: right;
}

.cr7-linkage {
    color: #4fc3f7;
}

.cr7-key {
    color: #ffd700;
    font-size: 0.75rem;
}

.cr7-empty {
    color: #666;
    font-style: italic;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.cr7-clist {
    margin-top: 0.3rem;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}

.cr7-clist-entry {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-family: 'Consolas', monospace;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cr7-clist-entry:last-child { border-bottom: none; }
.cr7-clist-entry:nth-child(even) { background: rgba(255,255,255,0.02); }

.cr7-clist-idx {
    color: #888;
    min-width: 28px;
}

.cr7-clist-name {
    color: var(--text-primary, #e0e0e0);
    flex: 1;
}

.cr7-clist-type {
    font-size: 0.7rem;
    padding: 0 4px;
    border-radius: 3px;
}
.cr7-type-null { color: #666; }
.cr7-type-code { color: #4fc3f7; }
.cr7-type-func { color: #81c784; }
.cr7-type-abs { color: #ffb74d; }

.cr7-clist-perms {
    color: #4caf50;
    min-width: 40px;
    text-align: right;
}

#codeEditor {
    flex: 1;
    padding: 1rem;
    background: var(--bg-input);
    border: 2px solid transparent;
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    white-space: pre;
    overflow-wrap: normal;
    word-wrap: normal;
}

#codeEditor.editor-modified {
    border-color: #f59e0b;
    box-shadow: inset 0 0 8px rgba(245, 158, 11, 0.2);
}

#codeEditor.editor-saved {
    border-color: #10b981;
    box-shadow: inset 0 0 8px rgba(16, 185, 129, 0.2);
}

#codeEditor::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.editor-registers-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    overflow-y: auto;
    min-width: 200px;
}

.editor-reg-section h3 {
    font-size: 0.75rem;
    color: var(--accent);
    margin: 0 0 0.3rem 0;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
}

.editor-reg-section .register-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.editor-reg-section .register-row {
    display: grid;
    grid-template-columns: 35px 1fr 40px;
    gap: 0.3rem;
    padding: 0.15rem 0.3rem;
    font-size: 0.7rem;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.editor-reg-section .register-row .name {
    color: var(--accent);
    font-weight: bold;
}

.editor-reg-section .register-row .value {
    color: var(--text-primary);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-reg-section .register-row .perms {
    color: var(--success);
    font-size: 0.65rem;
}

.editor-reg-section .register-row.null .value {
    color: var(--text-muted);
}

.editor-flags-section .flag-display-inline {
    display: flex;
    gap: 0.3rem;
}

.flag-mini {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-muted);
}

.flag-mini.active {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

.editor-output-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.output-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.output-tab {
    padding: 0.4rem 0.3rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.65rem;
    flex: 1;
    text-align: center;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.output-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.output-content {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.output-content.hidden {
    display: none;
}

.console-line {
    margin-bottom: 0.3rem;
    padding: 0.2rem 0;
}

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

.console-line.success {
    color: var(--success);
}

.console-line.error {
    color: var(--error);
}

.console-line.exec {
    color: var(--accent);
}

.console-line.highlight {
    background: rgba(168, 85, 247, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.trace-row {
    display: flex;
    gap: 0.5em;
    padding: 1px 0;
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.trace-row:hover {
    background: rgba(168, 85, 247, 0.08);
}

.trace-fault {
    background: rgba(239, 68, 68, 0.1);
}

.trace-fault:hover {
    background: rgba(239, 68, 68, 0.18);
}

.trace-seq {
    color: var(--text-secondary);
    opacity: 0.5;
    min-width: 3em;
    text-align: right;
    flex-shrink: 0;
}

.trace-line {
    color: var(--warning, #f59e0b);
    min-width: 3em;
    flex-shrink: 0;
}

.trace-instr {
    color: var(--accent);
    min-width: 12em;
    flex-shrink: 0;
    font-weight: 600;
}

.trace-comment {
    color: var(--text-secondary);
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.reg-display {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.reg-item {
    background: var(--bg-input);
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.reg-item .name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.reg-item .val {
    color: var(--success);
    font-size: 0.8rem;
}

.parsed-line {
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
}

.parsed-line:last-child {
    border-bottom: none;
}

.parsed-addr {
    color: var(--text-secondary);
    margin-right: 1rem;
}

.parsed-instr {
    color: var(--accent);
    font-weight: bold;
}

.parsed-args {
    color: var(--success);
}

.current-line {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 3px;
}

@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .line-numbers,
    #codeEditor {
        font-size: 16px;
        line-height: 1.4;
    }
    
    .line-numbers span {
        height: calc(16px * 1.4);
        line-height: calc(16px * 1.4);
    }
    
    .line-numbers {
        padding: 0.75rem 0.4rem;
        min-width: 35px;
    }
    
    #codeEditor {
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .flag-display {
        flex-wrap: wrap;
    }
}

/* ==================== NAMESPACE BROWSER ==================== */

.namespace-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 200px);
}

.ns-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.ns-panel h2 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.ns-intro {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.ns-empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.ns-header {
    color: var(--warning);
    font-weight: bold;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.ns-table-header {
    display: grid;
    grid-template-columns: 50px 100px 80px 120px 80px 60px;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-dark);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.ns-obj-row {
    display: grid;
    grid-template-columns: 50px 100px 80px 120px 80px 60px;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8rem;
    font-family: 'Consolas', monospace;
}

.ns-col-offset {
    color: var(--accent);
    font-weight: bold;
}

.ns-col-name {
    color: var(--text-primary);
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ns-col-type {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.ns-col-word1 {
    color: var(--warning);
}

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

.ns-col-perms {
    color: var(--success);
}

.ns-object {
    background: var(--bg-input);
    border-radius: 4px;
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.3rem;
    border-left: 3px solid var(--border);
    transition: all 0.2s;
}

.ns-object:hover {
    border-left-color: var(--accent);
}

.ns-abstraction {
    border-left-color: var(--accent);
}

.ns-thread {
    border-left-color: var(--success);
}

.ns-system {
    border-left-color: var(--warning);
}

.ns-clist {
    border-left-color: #9b59b6;
}

.ns-code {
    border-left-color: #3498db;
}

.ns-obj-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.ns-obj-name {
    font-weight: bold;
    color: var(--text-primary);
}

.ns-obj-type {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    background: var(--bg-dark);
    color: var(--text-secondary);
}

.ns-obj-details {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'Consolas', monospace;
}

.ns-obj-loc {
    color: var(--warning);
}

.ns-obj-perms {
    color: var(--success);
}

/* Hierarchy Tree */

.hier-container {
    padding: 0.5rem;
}

.hier-node {
    margin-bottom: 0.5rem;
}

.hier-root > .hier-label {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--bg-input) 0%, var(--bg-dark) 100%);
    border-radius: 8px;
    border: 2px solid var(--accent);
    text-align: center;
    margin-bottom: 1rem;
}

.hier-children {
    padding-left: 1rem;
    border-left: 2px dashed var(--border);
    margin-left: 1rem;
}

.hier-group {
    margin-bottom: 1.5rem;
}

.hier-group-label {
    color: var(--warning);
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-dark);
    border-radius: 4px;
    display: inline-block;
}

.hier-thread > .hier-label,
.hier-abstraction > .hier-label {
    padding: 0.6rem 1rem;
    background: var(--bg-input);
    border-radius: 6px;
    border: 1px solid var(--border);
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.hier-thread > .hier-label {
    color: var(--success);
    border-left: 3px solid var(--success);
}

.hier-abstraction > .hier-label {
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.hier-active > .hier-label {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
}

.hier-clist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.5rem;
    padding-left: 1rem;
}

.hier-gt {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-dark);
    border-radius: 3px;
    color: var(--text-secondary);
}

.hier-func {
    color: var(--warning);
    border: 1px solid var(--warning);
}

.hier-const {
    color: #9b59b6;
    border: 1px solid #9b59b6;
    font-style: italic;
}

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

/* ==================== TOOLTIPS ==================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 99999;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.6rem 0.8rem;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: normal;
    border-radius: 6px;
    border: 1px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    width: 250px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--accent);
}

/* CSS tooltips disabled - using JavaScript floating tooltips instead */
/*
[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}
*/

body.tooltip-hidden [data-tooltip]:hover::before,
body.tooltip-hidden [data-tooltip]:hover::after {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

[data-tooltip].tooltip-right::before {
    left: auto;
    right: 0;
    transform: none;
}

[data-tooltip].tooltip-right::after {
    left: auto;
    right: 10px;
    transform: none;
}

[data-tooltip].tooltip-left::before {
    left: 0;
    transform: none;
}

[data-tooltip].tooltip-left::after {
    left: 10px;
    transform: none;
}

/* Tooltip appears BELOW the element (for items near top of viewport) */
[data-tooltip].tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 8px);
}

[data-tooltip].tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: var(--accent);
}

.btn[data-tooltip]::before {
    bottom: calc(100% + 10px);
}

.btn[data-tooltip].tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 8px);
}

.btn[data-tooltip].tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 2px);
}

.register-row[data-tooltip] {
    cursor: help;
}

.state-row[data-tooltip],
.boot-step[data-tooltip] {
    cursor: help;
}

/* Ensure state-row and boot-step tooltips appear below */
.state-row[data-tooltip].tooltip-bottom::before,
.boot-step-btn[data-tooltip].tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 8px);
}

.state-row[data-tooltip].tooltip-bottom::after,
.boot-step-btn[data-tooltip].tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: var(--accent);
}

/* ==================== NAMESPACE TOOLBAR ==================== */

.namespace-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #1e1e2e 0%, #252538 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.toolbar-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toolbar-label span {
    color: var(--accent);
    font-weight: 600;
}

.toolbar-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.5rem;
}

.btn-toolbar {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toolbar:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-toolbar.btn-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
}

.btn-toolbar.btn-gc {
    border-color: #17a2b8;
    color: #17a2b8;
}

.btn-toolbar.btn-gc:hover {
    background: #17a2b8;
    border-color: #17a2b8;
    color: #fff;
}

.ns-object.selected,
.hier-item.selected > .hier-node {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    background: rgba(233, 69, 96, 0.15);
}

/* ==================== CONTEXT MENU ==================== */

.context-menu {
    position: fixed;
    background: linear-gradient(135deg, #1e1e2e 0%, #252538 100%);
    border: 1px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 180px;
    z-index: 2000;
    display: none;
    padding: 0.5rem 0;
    animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.context-menu-item {
    padding: 0.35rem 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    transition: background 0.15s ease;
}

.context-menu-item:hover {
    background: rgba(233, 69, 96, 0.2);
}

.context-menu-item .menu-icon {
    width: 16px;
    text-align: center;
    color: var(--accent);
}

.context-menu-separator {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 0;
}

.context-menu-item.disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.context-menu-item.disabled:hover {
    background: none;
}

/* ==================== CODE EDITOR CONTEXT MENU ==================== */

/* BASE: Minimum width and allow submenus to overflow */
.code-context-menu {
    min-width: 160px;  /* Narrower menu width */
    overflow: visible; /* Allow submenus to extend beyond menu bounds */
}

/* COMPACT MENU STYLES - Delete this block to restore original sizes */
/* START COMPACT STYLES */
.code-context-menu .context-menu-header {
    padding: 4px 8px !important;  /* Reduced from 0.5rem 1rem */
    font-size: 10px !important;   /* Reduced from 0.85rem (~13.6px) */
}

.code-context-menu > .context-menu-item {
    padding: 4px 8px !important;  /* Reduced from 0.6rem 1rem */
    font-size: 11px !important;   /* Reduced from 0.9rem (~14.4px) */
    gap: 6px !important;          /* Reduced from 0.6rem */
}

.code-context-menu .submenu .context-menu-item {
    padding: 3px 8px !important;  /* Reduced from 0.5rem 1rem */
    font-size: 10px !important;   /* Reduced from 0.85rem (~13.6px) */
}

.code-context-menu .context-menu-separator {
    margin: 2px 0 !important;     /* Reduced separator spacing */
}
/* END COMPACT STYLES */

.context-menu-header {
    padding: 0.3rem 0.8rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.2rem;
}

.context-menu-item.has-submenu {
    position: relative;
}

.context-menu-item .submenu-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.context-menu-item .submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: linear-gradient(135deg, #1e1e2e 0%, #252538 100%);
    border: 1px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 180px;
    padding: 0.5rem 0;
    z-index: 2001;
}

.context-menu-item.has-submenu:hover > .submenu {
    display: block;
}

.context-menu-item .submenu.flip-left {
    left: auto;
    right: 100%;
}

.submenu .context-menu-item {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    padding: 0.3rem 0.8rem;
}

.submenu .context-menu-item:hover {
    background: rgba(233, 69, 96, 0.3);
    color: var(--accent);
}

/* ==================== OBJECT MODAL ==================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-panel) 0%, #1a1a2e 100%);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: 380px;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.2s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    color: var(--accent);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

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

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-field label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.modal-field input,
.modal-field select {
    padding: 0.45rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal-field input:focus,
.modal-field select:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-perms {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-perm-check {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-perm-check:hover {
    border-color: var(--accent);
}

.modal-perm-check input {
    display: none;
}

.modal-perm-check input:checked + span {
    color: var(--accent);
    font-weight: bold;
}

.modal-perm-check span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-perm-check.perm-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.modal-perm-check.perm-disabled span {
    background: #333;
    color: #666;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 0.8rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.modal-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-btn-cancel {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.modal-btn-cancel:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-btn-confirm {
    background: var(--accent);
    color: white;
}

.modal-btn-confirm:hover {
    background: #d13652;
}

.modal-btn-danger {
    background: #e74c3c;
    color: white;
}

.modal-btn-danger:hover {
    background: #c0392b;
}

.required {
    color: #e74c3c;
    font-weight: bold;
}

.modal-header-danger {
    background: linear-gradient(135deg, #5a1a1a 0%, #3a0a0a 100%);
    border-bottom-color: #e74c3c;
}

.modal-header-danger h3 {
    color: #e74c3c;
}

.modal-delete {
    max-width: 450px;
}

.delete-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 1rem;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.delete-warning .warning-icon {
    font-size: 1.5rem;
}

.delete-warning p {
    margin: 0;
    color: var(--text-primary);
}

.delete-impact {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.delete-impact h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.delete-impact ul {
    margin: 0;
    padding-left: 1.2rem;
}

.delete-impact li {
    color: var(--text-primary);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.delete-impact li.impact-safe {
    color: #27ae60;
}

.delete-impact li.impact-warning {
    color: #f39c12;
}

.delete-impact li.impact-danger {
    color: #e74c3c;
    font-weight: 500;
}

.delete-impact li.impact-critical {
    color: #c0392b;
    font-weight: 600;
    background: rgba(192, 57, 43, 0.1);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    margin-left: -0.5rem;
}

/* Namespace objects with right-click support */
.ns-object {
    cursor: context-menu;
}

.ns-object:hover {
    background: rgba(233, 69, 96, 0.15);
}

.hier-item {
    cursor: context-menu;
}

.hier-item:hover > .hier-node {
    background: rgba(233, 69, 96, 0.15);
}

.ns-dynamic-tag,
.hier-custom-tag {
    font-size: 0.7rem;
    color: var(--warning);
    font-style: italic;
}

.hier-dynamic {
    border-left: 2px solid var(--warning);
}

.ns-data,
.ns-clist,
.ns-gt {
    border-left: 3px solid var(--warning);
}

/* Instructions View */
.instructions-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1rem;
}

.instr-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-panel);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.instr-header h2 {
    margin: 0;
    color: var(--accent);
    font-size: 1.2rem;
}

.instr-tabs {
    display: flex;
    gap: 0.5rem;
}

.instr-tab {
    padding: 0.6rem 1.5rem;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.instr-tab:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.instr-tab.active {
    background: var(--accent);
    color: white;
}

.instr-content {
    flex: 1;
    overflow-y: auto;
}

.instr-panel {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 1rem;
}

.instr-panel.hidden {
    display: none;
}

.instr-panel h2 {
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.instr-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Binary Format Card */
.instr-format-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.instr-format-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.instr-format-name {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.instr-format-syntax {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--success);
    padding: 0.2rem 0.6rem;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 4px;
}

.instr-format-brief {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.instr-format-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* Bit Diagram */
.bit-diagram {
    background: var(--bg-dark);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.bit-fields {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.bit-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.2rem;
    border-right: 1px solid var(--border);
    background: var(--bg-panel);
    min-width: 0;
}

.bit-field:last-child {
    border-right: none;
}

.bit-field.bit-fixed {
    background: rgba(233, 69, 96, 0.15);
}

.bit-range {
    font-family: 'Consolas', monospace;
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.bit-name {
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    word-break: break-all;
}

.bit-width {
    font-family: 'Consolas', monospace;
    font-size: 0.6rem;
    color: var(--accent);
    margin-top: 0.2rem;
}

/* Field Descriptions */
.field-descs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.3rem;
}

.field-desc-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
}

.field-desc-name {
    font-family: 'Consolas', monospace;
    color: var(--accent);
    font-weight: 600;
    min-width: 60px;
}

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

/* Variants Section */
.instr-variants {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.variant-label,
.opcode-label,
.cond-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.variant-item {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

.variant-name {
    font-family: 'Consolas', monospace;
    color: var(--success);
    font-weight: 600;
    min-width: 70px;
}

.variant-fields {
    color: var(--text-secondary);
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
}

/* Instruction Timing Table */
.timing-header {
    background: var(--bg-panel);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.timing-header h3 {
    margin: 0 0 0.75rem 0;
    color: var(--accent);
    font-size: 1.1rem;
}

.timing-specs {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.timing-spec {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.spec-label {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.timing-assumptions {
    background: var(--bg-tertiary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--border);
}

.timing-assumptions h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.timing-assumptions ul {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.3rem;
}

.timing-assumptions li {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.timing-category {
    margin-bottom: 1.5rem;
}

.timing-category h4 {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.timing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: var(--bg-panel);
    border-radius: 8px;
    overflow: hidden;
}

.timing-table thead {
    background: var(--bg-dark);
}

.timing-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timing-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.timing-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.timing-table .instr-name {
    font-family: 'Consolas', monospace;
    font-weight: 600;
    color: var(--accent);
}

.timing-table .cycles {
    font-family: 'Consolas', monospace;
    color: var(--success);
    font-weight: 600;
}

.timing-table .best {
    font-family: 'Consolas', monospace;
    color: #4ade80;
}

.timing-table .worst {
    font-family: 'Consolas', monospace;
    color: #f87171;
}

.timing-table .time {
    font-family: 'Consolas', monospace;
    color: #60a5fa;
}

.timing-table .notes {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timing-legend {
    background: var(--bg-panel);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.timing-legend h4 {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-cycles {
    font-family: 'Consolas', monospace;
    background: var(--bg-dark);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--success);
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    font-size: 0.8rem;
}

.legend-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.timing-security-note {
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.1), rgba(233, 69, 96, 0.1));
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.timing-security-note strong {
    color: var(--accent);
}

/* Opcodes Section */
.instr-opcodes {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.opcode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.3rem;
}

.opcode-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
    align-items: baseline;
}

.opcode-code {
    font-family: 'Consolas', monospace;
    color: var(--accent);
    background: rgba(233, 69, 96, 0.15);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.65rem;
}

.opcode-name {
    font-family: 'Consolas', monospace;
    color: var(--success);
    font-weight: 600;
    min-width: 40px;
}

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

/* Conditions Section */
.instr-conditions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.cond-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.3rem;
}

.cond-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
    align-items: baseline;
}

.cond-code {
    font-family: 'Consolas', monospace;
    color: var(--warning);
    background: rgba(251, 191, 36, 0.15);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.65rem;
}

.cond-name {
    font-family: 'Consolas', monospace;
    color: var(--success);
    font-weight: 600;
    min-width: 25px;
}

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

/* Instruction Notes */
.instr-notes {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid var(--warning);
    border-radius: 0 4px 4px 0;
    margin-bottom: 0.75rem;
}

.notes-icon {
    font-weight: 700;
    color: var(--warning);
    font-size: 0.9rem;
}

.notes-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Math type badges for abstractions */
.math-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.math-type-badge.math-float {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.math-type-badge.math-integer {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
}

.math-type-badge.math-geometry {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.math-type-badge.math-capability {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.math-type-badge.math-time {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.math-type-badge.math-functional {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.math-type-badge.math-system {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.math-type-badge.math-forge {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #1a1a2e;
    font-weight: 700;
}

.math-type-badge.math-constant {
    background: linear-gradient(135deg, #f472b6, #ec4899);
    color: white;
    font-weight: 700;
}

/* Instruction Security Notes */
.instr-security {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(46, 204, 113, 0.1);
    border-left: 3px solid var(--success);
    border-radius: 0 4px 4px 0;
    margin-bottom: 0.75rem;
}

.security-icon {
    font-weight: 700;
    color: var(--success);
    font-size: 0.85rem;
}

.security-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Flags & Stack Combined Panel */
.panel.flags-and-stack h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stack-word-count {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.stack-list {
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: 6px;
    margin-top: 0.75rem;
}

.stack-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
}

.stack-frame {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.stack-frame:last-child {
    margin-bottom: 0;
}

.stack-frame-header {
    background: var(--bg-input);
    padding: 0.35rem 0.6rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
}

.stack-word {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.stack-word:last-child {
    border-bottom: none;
}

.stack-word-label {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    min-width: 1.8rem;
}

.stack-word-name {
    color: var(--warning);
    font-weight: 500;
    min-width: 4.5rem;
}

.stack-word-value {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stack indicator in Assembly Editor toolbar */
.stack-indicator {
    cursor: pointer;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.stack-indicator:hover {
    background: var(--bg-input);
    color: var(--accent);
}

/* ==================== CODE BROWSER ==================== */

.code-browser-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
    height: calc(100vh - 140px);
    padding: 1rem;
}

.file-tree-panel {
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-tree-panel h3 {
    padding: 1rem;
    margin: 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: 1rem;
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.file-folder {
    margin-bottom: 0.5rem;
}

.file-folder .folder-icon {
    margin-right: 0.3rem;
}

.folder-children {
    margin-left: 1.2rem;
    margin-top: 0.3rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-bottom: 0.2rem;
}

.file-item:hover {
    background: var(--bg-input);
}

.file-item.active {
    background: var(--accent);
    color: var(--bg-dark);
}

.file-item .file-icon {
    margin-right: 0.4rem;
}

.file-item .file-size {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.file-item.active .file-size {
    color: var(--bg-dark);
    opacity: 0.8;
}

.file-tree-footer {
    padding: 0.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
}

.search-box {
    display: flex;
    gap: 0.3rem;
}

.search-box input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.search-box .search-btn {
    padding: 0.4rem 0.6rem;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.search-box .search-btn:hover {
    opacity: 0.8;
}

.code-viewer-panel {
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.current-file {
    color: var(--accent);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.code-nav-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.code-viewer-content {
    flex: 1;
    overflow: auto;
    background: #0d0d12;
}

.markdown-body {
    padding: 2rem 2.5rem;
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 900px;
    overflow-y: auto;
}

.markdown-body h1 {
    color: var(--accent);
    font-size: 1.8rem;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.markdown-body h2 {
    color: #f5c842;
    font-size: 1.4rem;
    margin: 2rem 0 0.8rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(245,200,66,0.15);
}

.markdown-body h3 {
    color: #5dade2;
    font-size: 1.15rem;
    margin: 1.5rem 0 0.6rem 0;
}

.markdown-body h4 {
    color: #c39bd3;
    font-size: 1.05rem;
    margin: 1.2rem 0 0.5rem 0;
}

.markdown-body h5, .markdown-body h6 {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 1rem 0 0.4rem 0;
}

.markdown-body p {
    margin: 0.4rem 0;
    color: var(--text-secondary);
}

.markdown-body a {
    color: var(--accent);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-body em {
    color: #c39bd3;
    font-style: italic;
}

.markdown-body code {
    background: rgba(0,0,0,0.3);
    color: #e8b86d;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
}

.markdown-body pre {
    background: #0a0e17;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 0.8rem 0;
}

.markdown-body pre code {
    background: none;
    color: #c8d6e5;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.markdown-body ul, .markdown-body ol {
    margin: 0.5rem 0;
    padding-left: 1.8rem;
    color: var(--text-secondary);
}

.markdown-body li {
    margin: 0.25rem 0;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin: 0.8rem 0;
    background: rgba(0,0,0,0.2);
    color: var(--text-muted);
    border-radius: 0 4px 4px 0;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8rem 0;
    font-size: 0.9rem;
}

.markdown-body th {
    background: rgba(0,0,0,0.3);
    color: var(--accent);
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    text-align: left;
    font-weight: 600;
}

.markdown-body td {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.markdown-body tr:nth-child(even) td {
    background: rgba(0,0,0,0.1);
}

.code-welcome {
    padding: 2rem;
    text-align: center;
}

.code-welcome h2 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.code-welcome p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.code-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--success);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.file-descriptions {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.file-desc {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}

.file-desc strong {
    color: var(--accent);
}

.source-code-display {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
    padding: 1rem;
    margin: 0;
}

.code-line {
    display: flex;
}

.line-number {
    width: 60px;
    color: var(--text-muted);
    text-align: right;
    padding-right: 1rem;
    user-select: none;
    opacity: 0.5;
    flex-shrink: 0;
}

.line-content {
    flex: 1;
}

.code-line:hover {
    background: rgba(233, 69, 96, 0.1);
}

.code-line:hover .line-number {
    opacity: 1;
    color: var(--accent);
}

/* Syntax highlighting */
.code-line .keyword { color: #c678dd; }
.code-line .string { color: #98c379; }
.code-line .comment { color: #5c6370; font-style: italic; }
.code-line .number { color: #d19a66; }
.code-line .function { color: #61afef; }
.code-line .operator { color: #56b6c2; }
.code-line .property { color: #e5c07b; }

.search-results {
    padding: 0.5rem 1rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-match {
    background: rgba(233, 69, 96, 0.3);
    border-bottom: 2px solid var(--accent);
}

/* ==================== AUTHENTICATION ====================*/

.auth-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-logged-out {
    display: flex;
    align-items: center;
}

.auth-logged-in {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-login {
    background: var(--success);
    color: var(--bg-dark);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.btn-login:hover {
    opacity: 0.85;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.user-name {
    color: var(--text-primary);
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-save {
    background: var(--success);
    color: var(--bg-dark);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

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

.user-menu-container {
    position: relative;
}

.btn-menu {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
}

.btn-menu:hover {
    background: var(--bg-tertiary);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #1e3a5f;
    border: 1px solid #2a4a6f;
    border-radius: 6px;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-menu button,
.user-dropdown-menu a {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
}

.user-dropdown-menu button:hover,
.user-dropdown-menu a:hover {
    background: #2a5080;
}

.user-dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

.user-dropdown-menu a:last-child {
    color: var(--danger);
}

.user-dropdown-menu a:last-child:hover {
    background: var(--danger);
    color: white;
}

/* ==================== LANDING PAGE ==================== */

.landing-page {
    min-height: calc(100vh - 60px);
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0f1a2e 50%, #1a1a2e 100%);
    overflow-y: auto;
}

.landing-container {
    max-width: 1200px;
    margin: 0 auto;
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-header h1 {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px var(--accent-glow);
}

.landing-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.landing-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.landing-left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.author-books-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-panel);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.author-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.author-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
}

.author-info h3 {
    color: var(--accent);
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.author-info p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.85rem;
}

.landing-description {
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.landing-description h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.landing-description p {
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.landing-description strong {
    color: var(--success);
}

.landing-features {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.feature-icon {
    font-size: 1.5rem;
    min-width: 2rem;
    text-align: center;
}

.feature-item strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.landing-examples {
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.landing-examples h2 {
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.cloomc-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.cloomc-section h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.cloomc-section p {
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.cloomc-section em {
    color: var(--accent);
    font-style: italic;
}

.church-instructions-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.church-instructions-section h2 {
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
}

.church-instructions-section p {
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.church-instr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.church-instr-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.church-instr-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: top;
}

.church-instr-table tr:last-child td {
    border-bottom: none;
}

.church-instr-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.church-instr-table td:first-child {
    white-space: nowrap;
    width: 7rem;
}

.church-instr-table code {
    font-family: 'Consolas', monospace;
    color: var(--warning);
    font-size: 0.95rem;
    font-weight: 600;
}

.text-warning {
    color: var(--warning);
    font-weight: 600;
}

.text-success {
    color: var(--success);
    font-weight: 600;
}

.example-code {
    margin-bottom: 1.5rem;
}

.example-code:last-child {
    margin-bottom: 0;
}

.example-code h3 {
    color: var(--success);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.example-code pre {
    background: #0a0a1a;
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.book-image-link {
    display: inline-block;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.book-image-link:hover {
    transform: translateY(-2px);
}

.book-cover-image {
    width: 120px;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}

.book-image-link:hover .book-cover-image {
    box-shadow: 0 8px 25px var(--accent-glow);
}

.landing-cta {
    text-align: center;
    padding: 2rem;
    background: var(--bg-panel);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.landing-cta p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.landing-cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.btn-tutorial-landing {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid var(--accent);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-tutorial-landing:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-register {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--accent);
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-register:hover {
    background: #d63850;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-github {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: #24292e;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(36, 41, 46, 0.4);
}

.btn-github:hover {
    background: #3a4148;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(36, 41, 46, 0.5);
}

.landing-note {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Hide nav buttons when on landing page */
body.landing-mode .view-buttons {
    display: none !important;
}

body.landing-mode .auth-logged-in {
    display: none !important;
}

body.landing-mode .auth-section {
    display: none !important;
}

.landing-edit-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-edit-landing {
    background: var(--accent);
    color: var(--bg-main);
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-edit-landing:hover {
    background: var(--accent-hover);
}

.landing-edit-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-save-landing {
    background: var(--success);
    color: var(--bg-main);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-cancel-landing {
    background: var(--text-secondary);
    color: var(--bg-main);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-back-landing {
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-back-landing:hover {
    background: var(--bg-main);
    border-color: var(--accent);
}

.btn-link-landing {
    background: var(--accent);
    color: var(--bg-main);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-link-landing:hover {
    background: var(--accent-hover);
}

.btn-unlink-landing {
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-unlink-landing:hover {
    border-color: var(--warning);
    color: var(--warning);
}

.landing-description.editing,
.landing-examples.editing {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
    background: rgba(0, 255, 136, 0.05);
}

.landing-description.editing *[contenteditable="true"],
.landing-examples.editing *[contenteditable="true"] {
    min-height: 1em;
}

.landing-description.editing *[contenteditable="true"]:focus,
.landing-examples.editing *[contenteditable="true"]:focus {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s ease-out, toastFadeOut 0.3s ease-in 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.success {
    background: linear-gradient(135deg, #065f46, #047857);
    border: 1px solid var(--success);
    color: #ecfdf5;
}

.toast.error {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border: 1px solid var(--error);
    color: #fef2f2;
}

.toast.info {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
    border: 1px solid #60a5fa;
    color: #eff6ff;
}

.toast-icon {
    font-size: 1.1rem;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.tunnel-msg-panel {
    background: var(--bg-dark, #1a1a2e);
    border: 1px solid var(--border, #333);
    border-radius: 12px;
    width: 480px;
    max-width: 95vw;
    max-height: 85vh;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: tunnelMsgAppear 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes tunnelMsgAppear {
    from {
        transform: scale(0.85);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tunnel-msg-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #00e676;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary, #e0e0e0);
}

.tunnel-msg-icon {
    font-size: 1.4rem;
}

.tunnel-msg-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.tunnel-msg-payload {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    padding: 1rem;
    margin: 0.5rem 0 1rem;
    border: 2px solid #00e676;
    border-radius: 8px;
    background: rgba(0, 230, 118, 0.06);
    letter-spacing: 0.05em;
    font-family: 'Georgia', serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.tunnel-msg-payload.tunnel-long-msg {
    font-size: 1.1rem;
    letter-spacing: 0;
    line-height: 1.5;
    text-align: left;
    padding: 0.75rem 1rem;
}

.tunnel-msg-flow {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-secondary, #aaa);
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.tunnel-msg-details {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.tunnel-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    line-height: 1.5;
}

.tunnel-detail-label {
    color: var(--text-secondary, #888);
    min-width: 100px;
}

.tunnel-detail-value {
    color: var(--text-primary, #e0e0e0);
    text-align: right;
}

.tunnel-msg-zeroes {
    font-size: 0.78rem;
    color: var(--text-secondary, #888);
    padding: 0.6rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.btn-tunnel-notify {
    position: relative;
    background: transparent;
    border: 1px solid #00e676;
    color: #00e676;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    animation: notifyPulse 2s infinite;
}

.btn-tunnel-notify:hover {
    background: rgba(0, 230, 118, 0.15);
    transform: scale(1.05);
}

.tunnel-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e53935;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 50%;
    text-align: center;
    padding: 0 3px;
}

@keyframes notifyPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(0, 230, 118, 0.2); }
}

.tunnel-msg-timestamp {
    text-align: center;
    font-size: 0.8rem;
    font-family: monospace;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.tunnel-reply-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.75rem;
}

.tunnel-reply-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.tunnel-reply-input:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

.tunnel-reply-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.tunnel-reply-btn {
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: #1a1a2e;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.tunnel-reply-btn:hover {
    opacity: 0.85;
}

.zoom-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    height: calc(100vh - 120px);
    padding: 0.5rem;
}

.zoom-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.zoom-gt-summary {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.75rem;
}

.zoom-gt-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.zoom-gt-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.zoom-gt-perms {
    display: flex;
    gap: 3px;
}

.zoom-gt-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.4;
}

.zoom-gt-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    flex-wrap: wrap;
}

.zoom-gt-meta span {
    background: rgba(255,255,255,0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.zoom-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.zoom-methods-label {
    font-size: 0.75rem;
    color: #94a3b8;
    width: 100%;
    margin-bottom: 2px;
}

.zoom-method-chip {
    font-size: 0.7rem;
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.zoom-abs-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
}

.zoom-abstraction-list {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
}

.zoom-abs-item {
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s;
}

.zoom-abs-item:hover {
    background: rgba(255,255,255,0.06);
}

.zoom-abs-active {
    background: rgba(99,102,241,0.15);
    color: #e2e8f0;
    border-left: 3px solid #6366f1;
}

.zoom-abs-cr6 {
    box-shadow: inset 0 0 0 1px rgba(52,211,153,0.3);
}

.zoom-cr6-tag {
    font-size: 0.65rem;
    background: rgba(52,211,153,0.2);
    color: #34d399;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.zoom-main {
    overflow-y: auto;
}

.zoom-clist-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.75rem;
    height: 100%;
    overflow-y: auto;
}

.zoom-clist-header h3 {
    font-size: 0.95rem;
    color: #e2e8f0;
    margin: 0 0 0.5rem 0;
}

.zoom-clist-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.zoom-clist-row {
    display: grid;
    grid-template-columns: 40px 140px 80px 160px 100px 60px 1fr;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #cbd5e1;
    transition: background 0.15s;
}

.zoom-clist-row:hover {
    background: rgba(255,255,255,0.04);
}

.zoom-clist-row-header {
    color: #64748b;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}

.zoom-clist-row-header:hover {
    background: transparent;
}

.zoom-row-active {
    background: rgba(52,211,153,0.08);
    border-left: 3px solid #34d399;
}

.zoom-col-idx {
    font-family: 'JetBrains Mono', monospace;
    color: #64748b;
    font-size: 0.75rem;
}

.zoom-col-name {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-col-type {
    font-size: 0.75rem;
}

.zoom-type-label {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
}

.zoom-type-null {
    color: #475569;
}

.zoom-type-code {
    color: #60a5fa;
}

.zoom-type-label.zoom-type-code {
    background: rgba(96,165,250,0.12);
}

.zoom-type-data {
    color: #fbbf24;
}

.zoom-type-label.zoom-type-data {
    background: rgba(251,191,36,0.12);
}

.zoom-type-func {
    color: #a78bfa;
}

.zoom-type-label.zoom-type-func {
    background: rgba(167,139,250,0.12);
}

.zoom-type-const {
    color: #2dd4bf;
}

.zoom-type-label.zoom-type-const {
    background: rgba(45,212,191,0.12);
}

.zoom-type-abstract {
    color: #f472b6;
}

.zoom-type-label.zoom-type-abstract {
    background: rgba(244,114,182,0.12);
}

.zoom-type-label.zoom-type-null {
    background: rgba(71,85,105,0.15);
}

.zoom-col-perms {
    display: flex;
    gap: 2px;
}

.zoom-col-addr, .zoom-col-size {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #94a3b8;
}

.zoom-col-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zoom-cr6-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 4px rgba(52,211,153,0.5);
}

.zoom-cr6-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.zoom-empty {
    color: #64748b;
    padding: 2rem;
    text-align: center;
    font-size: 0.9rem;
}

.zoom-tab-btn {
    background: rgba(99,102,241,0.15) !important;
    color: #a5b4fc !important;
    border-color: rgba(99,102,241,0.3) !important;
}

.zoom-tab-btn:hover {
    background: rgba(99,102,241,0.25) !important;
}

@media (max-width: 900px) {
    .zoom-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .zoom-clist-row {
        grid-template-columns: 30px 100px 60px 120px 80px 50px 1fr;
        font-size: 0.72rem;
    }
}

.hp35-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 16px;
    height: calc(100vh - 80px);
    padding: 16px;
    overflow: hidden;
}

.hp35-info-panel {
    overflow-y: auto;
}

.hp35-info-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.hp35-info-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.hp35-info-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.hp35-info-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.hp35-info-section {
    margin-bottom: 14px;
}

.hp35-info-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 6px;
    font-weight: 600;
}

.hp35-info-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.hp35-stack-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hp35-stack-reg {
    background: #0a0e1a;
    border: 1px solid #2a2a3a;
    border-radius: 4px;
    padding: 6px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: #ff4444;
}

.hp35-reg-label {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 8px;
}

.hp35-reg-value {
    color: #ff4444;
}

.hp35-deps {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hp35-dep-badge {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s;
}

.hp35-dep-badge:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hp35-calculator-panel {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 8px;
}

.hp35-body {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 2px solid #444;
    border-radius: 16px;
    padding: 20px 16px 24px;
    width: 340px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

.hp35-brand {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 8px 12px;
}

.hp35-hp-logo {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: #888;
    font-weight: 300;
    text-transform: uppercase;
}

.hp35-model {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ccc;
    font-style: italic;
}

.hp35-screen {
    background: #0a0a0a;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 12px 16px 10px;
    margin-bottom: 16px;
    position: relative;
    min-height: 48px;
}

.hp35-arc-indicator {
    position: absolute;
    top: 2px;
    left: 8px;
    font-size: 0.55rem;
    color: #ff3333;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.hp35-screen-value {
    font-family: 'Courier New', monospace;
    font-size: 1.6rem;
    color: #ff3333;
    text-align: right;
    text-shadow: 0 0 8px rgba(255,50,50,0.6);
    letter-spacing: 2px;
    min-height: 28px;
    overflow: hidden;
    white-space: nowrap;
}

.hp35-keys {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hp35-key-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.hp35-key {
    width: 58px;
    height: 38px;
    border: none;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hp35-key:active {
    transform: translateY(1px);
    filter: brightness(0.85);
}

.hp35-key-digit {
    background: linear-gradient(180deg, #555, #3a3a3a);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.hp35-key-digit:hover {
    background: linear-gradient(180deg, #666, #4a4a4a);
}

.hp35-key-op {
    background: linear-gradient(180deg, #cc6600, #994d00);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.hp35-key-op:hover {
    background: linear-gradient(180deg, #dd7711, #aa5500);
}

.hp35-key-fn {
    background: linear-gradient(180deg, #2a4a6a, #1a3050);
    color: #ccdde8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-size: 0.7rem;
}

.hp35-key-fn:hover {
    background: linear-gradient(180deg, #3a5a7a, #2a4060);
}

.hp35-key-enter {
    width: 125px;
    background: linear-gradient(180deg, #2a4a6a, #1a3050);
    color: #ccdde8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.hp35-key-enter:hover {
    background: linear-gradient(180deg, #3a5a7a, #2a4060);
}

.hp35-trace-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
}

.hp35-trace-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hp35-trace-list {
    overflow-y: auto;
    padding: 4px 0;
    flex: 1;
}

.hp35-trace-entry {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(45,55,72,0.4);
}

.hp35-trace-latest {
    background: rgba(233,69,96,0.08);
}

.hp35-trace-lambda {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: #88ccff;
    word-break: break-all;
    line-height: 1.3;
}

.hp35-trace-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

@media (max-width: 1100px) {
    .hp35-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }
    .hp35-info-panel {
        order: 2;
    }
    .hp35-calculator-panel {
        order: 1;
    }
    .hp35-trace-panel {
        order: 3;
        max-height: 300px;
    }
}
