* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: #11111b;
    color: #cdd6f4;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
#app-wrapper {
    display: flex;
    flex-direction: column;
    width: 1000px;
    max-height: calc(100vh - 40px);
}
#container {
    display: flex;
    flex-direction: row;
    height: 650px;
    border: 2px solid #89b4fa;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(137, 180, 250, 0.3),
                0 0 40px rgba(137, 180, 250, 0.1);
}
#viewport {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
#editor {
    flex: 1;
    overflow: auto;
    padding: 8px 0;
    background: #1e1e2e;
    user-select: none;
    cursor: text;
}
.line {
    display: flex;
    line-height: 1.5;
    min-height: 1.5em;
}
.line-number {
    width: 3em;
    text-align: right;
    padding-right: 1em;
    color: #585b70;
    user-select: none;
    flex-shrink: 0;
}
.line-content {
    white-space: pre;
    flex: 1;
}
.cursor {
    background: #cdd6f4;
    color: #1e1e2e;
}
.cursor-replace {
    box-shadow: inset 0 -3px 0 #f38ba8;
}
.cursor-insert {
    border-left: 2px solid #cdd6f4;
    margin-left: -1px;
}
.visual-highlight {
    background: #45475a;
}
#statusbar {
    display: flex;
    justify-content: space-between;
    background: #313244;
    padding: 4px 12px;
    line-height: 1.5;
    border-top: 1px solid #45475a;
}
#mode {
    font-weight: bold;
}
#mode.normal { color: #a6e3a1; }
#mode.insert { color: #89b4fa; }
#mode.visual, #mode.visual-line { color: #cba6f7; }
#mode.command { color: #f9e2af; }
#mode.replace { color: #f38ba8; }
#commandline {
    background: #181825;
    padding: 4px 12px;
    line-height: 1.5;
    min-height: calc(1.5em + 8px);
    color: #f9e2af;
    border-top: 1px solid #45475a;
}
#info {
    color: #6c7086;
}
#filename {
    color: #cdd6f4;
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 12px;
}
#filename .modified {
    color: #f9e2af;
}
.command-cursor {
    background: #cdd6f4;
    color: #1e1e2e;
}
.status-error {
    color: #f38ba8;
}

/* Sidebar */
#sidebar {
    width: 300px;
    background: #181825;
    border-left: 1px solid #45475a;
    overflow-y: auto;
    font-size: 12px;
}
.sidebar-panel {
    border-bottom: 1px solid #313244;
    padding: 8px 12px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar-panel > *:not(.sidebar-panel-title) {
    flex-shrink: 0;
}
.sidebar-panel-title {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #89b4fa;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}
.sidebar-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    color: #a6adc8;
}
.sidebar-row-label {
    color: #6c7086;
}
.sidebar-row-value {
    color: #cdd6f4;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}
.register-name {
    color: #f9e2af;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}
.register-content {
    color: #a6adc8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.undo-entry {
    padding: 2px 4px;
    color: #6c7086;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.undo-entry.current {
    color: #a6e3a1;
    background: #313244;
    border-radius: 3px;
}
.history-entry {
    padding: 1px 4px;
    color: #a6adc8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-keys {
    color: #f9e2af;
    margin-right: 6px;
}
.panels-row {
    display: flex;
    gap: 0;
}
.panels-row .sidebar-panel {
    flex: 1;
    border-bottom: 1px solid #313244;
    border-right: 1px solid #313244;
}
.panels-row .sidebar-panel:last-child {
    border-right: none;
}

/* Config Bar */
#config-bar {
    background: #181825;
    border: 2px solid #89b4fa;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}
.config-toggle {
    width: 100%;
    background: #313244;
    border: none;
    border-bottom: 1px solid #45475a;
    color: #89b4fa;
    padding: 8px 12px;
    text-align: left;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.2s;
}
.config-toggle:hover {
    background: #45475a;
}
.config-content {
    padding: 12px;
    max-height: 250px;
    overflow-y: auto;
}

/* Config Panel */
.config-panel {
    border: none;
    padding: 0;
}
.config-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.config-column {
    min-width: 0;
}
.config-section-title {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #89b4fa;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}
.config-section {
    margin-bottom: 12px;
}
.config-item {
    padding: 3px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.config-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #a6adc8;
    user-select: none;
    width: 100%;
}
.config-checkbox input[type="checkbox"] {
    cursor: pointer;
    accent-color: #89b4fa;
}
.config-checkbox span {
    flex: 1;
}
.config-number {
    gap: 8px;
}
.config-number label {
    color: #6c7086;
    flex: 1;
}
.config-number input[type="number"] {
    width: 50px;
    background: #313244;
    border: 1px solid #45475a;
    border-radius: 3px;
    color: #cdd6f4;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 11px;
}
.config-number input[type="number"]:focus {
    outline: none;
    border-color: #89b4fa;
}