@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-Light.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-LightItalic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-Thin.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-ThinItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-Regular.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-Italic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-SemiBoldItalic.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Typus Mono 95';
    src: url('fonts/TypusMono95-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

:root {
    --emacs-bg: #111111;
    --emacs-bg-dim: #222522;
    --emacs-bg-alt: #303230;
    --emacs-fg: #cfdfd5;
    --emacs-fg-dim: #808f80;
    --emacs-comment: #b7a07f;
    --emacs-keyword: #00c089;
    --emacs-string: #af9fff;
    --emacs-fn: #7fc500;
    --emacs-type: #7fcfdf;
    --emacs-warning: #cfc04f;
    --emacs-error: #ef6560;
    --emacs-indicator: #cfdfd5;

    --page-bg: #000000;
    --page-fg: #d0d3d6;
    --page-fg-dim: #777777;
    --page-border: #282828;
    --page-border-focus: #ffffff;
    --dashed-border: #404040;
    --font-mono: 'Typus Mono 95', 'Typus Mono', 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
    --font-icons: 'Symbols Nerd Font Mono', 'Symbols Nerd Font',
                  'JetBrainsMono Nerd Font', 'FiraCode Nerd Font Mono',
                  'Hack Nerd Font', 'MesloLGS NF', 'DejaVu Sans Mono',
                  var(--font-mono);
    --sp: 8px;
}

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

html, body, button, input, select, textarea, pre, code, kbd, samp {
    font-family: var(--font-mono);
}

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--page-bg);
    color: var(--page-fg);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.emacs-tab,
.tab-content,
.tab-label,
.tab-base-name,
.tab-dir-prefix,
.tab-num-prefix,
.gutter,
.buffer-text,
.buffer-text pre,
.buffer-text code,
.code-box pre,
.code-box code {
    font-family: var(--font-mono);
}
.header, .content, .footer {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 18px;
}

.header {
    padding-top: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--page-border);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
}

.site-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
    display: inline;
}

.site-tag {
    color: var(--page-fg-dim);
    font-size: 0.9rem;
    margin-left: 10px;
}

.raw-link {
    color: #81a2be;
    text-decoration: none;
    font-size: 0.9rem;
}

.raw-link:hover {
    text-decoration: underline;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-top: 24px;
    padding-bottom: 48px;
}

.section {
    width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--dashed-border);
}

.section-title {
    font-weight: 700;
    color: #ffffff;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.section-hint {
    color: var(--page-fg-dim);
    font-size: 0.82rem;
}

.emacs-window {
    width: 100%;
    background-color: var(--emacs-bg);
    border: 1px solid var(--page-border);
    display: flex;
    flex-direction: column;
    outline: none;
    overflow: hidden;
}

.emacs-window:focus-within {
    border-color: #555a64;
}

.bufferline-container {
    width: 100%;
    background-color: var(--emacs-bg-alt);
    user-select: none;
    overflow: hidden;
}

.bufferline-bar {
    display: flex;
    align-items: stretch;
    min-height: 28px;
    white-space: nowrap;
    width: 100%;
}

.emacs-tab {
    display: inline-flex;
    align-items: stretch;
    background-color: var(--emacs-bg-dim);
    color: var(--emacs-comment);
    font-size: 0.9rem;
    line-height: 1.5;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    border: none;
}

.emacs-tab:hover {
    background-color: var(--emacs-bg);
}

.emacs-tab.active {
    background-color: var(--emacs-bg);
    color: var(--emacs-fg);
    font-weight: 600;
    font-style: italic;
}

.tab-content {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    padding-left: var(--sp);
}

.tab-sep-left, .tab-sep-right {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    flex-shrink: 0;
    overflow: visible;
    font-style: normal;
}

.tab-sep-left.pixel-bar {
    background-color: transparent;
}

.emacs-tab.active .tab-sep-left.pixel-bar {
    background-color: var(--emacs-indicator);
}

.tab-sep-left.glyph, .tab-sep-right.glyph {
    font-family: var(--font-icons);
    font-size: 1.05rem;
    line-height: 1.5;
    font-style: normal;
    font-weight: normal;
    padding: 0;
}

.tab-pin-icon,
.tab-file-icon,
.tab-ro-icon,
.tab-mod-icon,
.tab-diag-badge,
.tab-overflow-marker {
    font-family: var(--font-icons);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    flex-shrink: 0;
    overflow: visible;
    font-style: normal;
    font-variant-ligatures: none;
    text-rendering: geometricPrecision;
}

.tab-pin-icon {
    color: var(--emacs-keyword);
    font-weight: bold;
    margin-right: var(--sp);
}

.tab-file-icon {
    font-size: 1.02rem;
}

.tab-label {
    display: inline-block;
    white-space: pre;
    min-width: 0;
}

.tab-num-prefix {
    color: var(--emacs-comment);
}

.tab-dir-prefix {
    color: var(--emacs-comment);
    font-style: italic;
    font-weight: 300;
}

.tab-base-name {
    font-weight: inherit;
    font-style: inherit;
}

.tab-ro-icon {
    color: var(--emacs-comment);
    margin-left: var(--sp);
}

.tab-mod-icon {
    color: var(--emacs-warning);
    font-weight: bold;
    margin-left: var(--sp);
}

.tab-diag-badge {
    color: var(--emacs-error);
    margin-left: var(--sp);
    gap: var(--sp);
}

.tab-diag-badge.warning {
    color: var(--emacs-warning);
}

.tab-diag-badge .diag-count {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: normal;
}

.tab-overflow-marker {
    align-self: stretch;
    padding: 0 var(--sp);
    background-color: var(--emacs-bg-alt);
    color: var(--emacs-keyword);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
}

.tab-overflow-marker:hover {
    filter: brightness(1.2);
}

.tab-overflow-marker .overflow-count {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--emacs-comment);
    font-weight: normal;
}

.tab-overflow-marker .overflow-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    margin: 0 var(--sp);
}

.emacs-body {
    display: flex;
    min-height: 240px;
    background-color: var(--emacs-bg);
    padding: 14px 0;
    font-size: 0.92rem;
    line-height: 1.55;
    overflow-x: auto;
}

.gutter {
    padding: 0 14px 0 12px;
    color: #4a483e;
    text-align: right;
    user-select: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.buffer-text {
    flex: 1;
    padding: 0 18px;
    color: var(--emacs-fg);
    white-space: pre;
}

.syn-comment { color: var(--emacs-comment); font-style: italic; }
.syn-keyword { color: var(--emacs-keyword); font-weight: 600; }
.syn-string  { color: var(--emacs-string); }
.syn-fn      { color: var(--emacs-fn); }
.syn-type    { color: var(--emacs-type); }

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    width: 100%;
}

.config-group {
    border: 1px solid var(--page-border);
    padding: 16px;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.config-group.full-col {
    grid-column: 1 / -1;
}

.config-group legend {
    color: #ffffff;
    font-weight: 700;
    padding: 0 6px;
    font-size: 0.85rem;
}

.field-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    min-width: 0;
}

.field-header label {
    color: var(--page-fg-dim);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-row.hidden {
    display: none;
}

.raw-select, .raw-input {
    width: 100%;
    background-color: #080808;
    color: var(--page-fg);
    border: 1px solid var(--page-border);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 6px 10px;
    outline: none;
}

.raw-select:focus, .raw-input:focus {
    border-color: var(--page-border-focus);
}

.slider-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.raw-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    background: var(--page-border);
    height: 4px;
    outline: none;
}

.raw-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--page-fg);
    cursor: pointer;
}

.raw-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--page-fg);
    cursor: pointer;
}

.slider-val {
    min-width: 40px;
    text-align: right;
    font-size: 0.8rem;
    color: #ffffff;
}

.custom-input-wrap {
    display: flex;
    gap: 8px;
    width: 100%;
}

.custom-input-wrap .raw-input {
    flex: 1;
}

.raw-btn {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background-color: transparent;
    color: #ffffff;
    border: 1px solid var(--page-border);
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
}

.raw-btn:hover {
    background-color: #222222;
    color: #ffffff;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.raw-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--page-fg);
    cursor: pointer;
}

.raw-checkbox input {
    accent-color: #ffffff;
    width: 14px;
    height: 14px;
}

.pkg-switch {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pkg-btn {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: none;
    border: 1px solid transparent;
    color: var(--page-fg-dim);
    padding: 3px 10px;
    cursor: pointer;
}

.pkg-btn.active {
    color: #ffffff;
    border-color: #444444;
    background-color: #222222;
}

.code-box {
    border: 1px solid var(--page-border);
    background-color: #060708;
    position: relative;
    width: 100%;
}

.code-actions {
    display: flex;
    justify-content: flex-end;
    padding: 6px 10px;
    border-bottom: 1px dashed var(--dashed-border);
    background-color: #0d0e11;
}

.code-box pre {
    padding: 16px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #c5c8c6;
    margin: 0;
    font-family: var(--font-mono);
}

.docs-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--page-border);
    background-color: #0d0e11;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    text-align: left;
    white-space: nowrap;
}

.docs-table th,
.docs-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--page-border);
    border-right: 1px solid var(--page-border);
}

.docs-table th:last-child,
.docs-table td:last-child {
    border-right: none;
    white-space: normal;
}

.docs-table tr:last-child td {
    border-bottom: none;
}

.docs-table th {
    background-color: #111111;
    color: #ffffff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    border-bottom: 1px dashed var(--dashed-border);
}

.docs-table td code {
    color: #ffffff;
    background-color: #141414;
    border: 1px solid #282828;
    padding: 1px 5px;
    font-size: 0.82rem;
}

.docs-table td.type-col {
    color: var(--page-fg-dim);
}

.docs-table td.default-col {
    color: #cccccc;
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    width: 100%;
}

.doc-card {
    border: 1px solid var(--page-border);
    background-color: transparent;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.doc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--page-fg);
}

.doc-list li code {
    color: #ffffff;
    background-color: #141414;
    padding: 2px 6px;
    border: 1px solid var(--page-border);
    font-weight: 600;
}

.doc-code {
    background-color: #060708;
    border: 1px solid var(--page-border);
    padding: 12px;
    margin: 0;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #c5c8c6;
}

.footer {
    padding-top: 18px;
    padding-bottom: 28px;
    border-top: 1px solid var(--page-border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--page-fg-dim);
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #b5bd68;
    color: #000000;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 16px;
    border: 1px solid #000;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
