.mmd-viewer {
    --mmd-paper: #617b94;
    --mmd-grid: #516a82;
    --mmd-root-fill: #031a31;
    --mmd-root-text: #ffffff;
    --mmd-first-fill: #b1bfcc;
    --mmd-other-fill: #fdfdfd;
    --mmd-text: #000000;
    --mmd-border: #000000;
    --mmd-connector: #ffffff;
    --mmd-select: #ffa500;
    --mmd-jump: #00ffff;
    --mmd-panel: #1c2a38;
    --mmd-panel-text: #e8eef4;
    --mmd-accent: #7aa3e5;
    --mmd-font: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
    box-sizing: border-box;
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 240px;
    overflow: hidden;
    color: var(--mmd-panel-text);
    background: var(--mmd-paper);
    font-family: var(--mmd-font);
    font-size: 14px;
    line-height: 1.4;
    -webkit-user-select: none;
    user-select: none;
}

.mmd-viewer:focus,
.mmd-viewer:focus-visible {
    outline: none;
}

.mmd-viewer *,
.mmd-viewer *::before,
.mmd-viewer *::after {
    box-sizing: border-box;
}

.mmd-viewer__main {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
}

.mmd-viewer__toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    z-index: 2;
    padding: 8px 10px;
    background: rgba(12, 22, 32, 0.78);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mmd-viewer__toolbar > * + * {
    margin-left: 6px;
}

.mmd-viewer__toolbar button,
.mmd-viewer__toolbar label.mmd-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    color: var(--mmd-panel-text);
    background: #2c3f52;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.02em;
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

.mmd-viewer__toolbar button:hover,
.mmd-viewer__toolbar label.mmd-file:hover {
    background: #3a536b;
}

.mmd-viewer__toolbar button:focus-visible,
.mmd-viewer__toolbar label.mmd-file:focus-within {
    outline: 2px solid var(--mmd-accent);
    outline-offset: 1px;
}

.mmd-viewer__zoom {
    min-width: 4.5em;
    color: #c5d4e2;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.mmd-viewer__hint {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
    z-index: 3;
    max-width: calc(100% - 16px);
    padding: 6px 10px;
    overflow: hidden;
    color: #e8eef4;
    background: rgba(12, 22, 32, 0.82);
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mmd-viewer__hint[hidden] {
    display: none !important;
}

.mmd-viewer__stage-wrap {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.mmd-viewer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    cursor: grab;
    -ms-touch-action: none;
    touch-action: none;
}

.mmd-viewer__toolbar[hidden],
.mmd-viewer__notes[hidden],
.mmd-viewer__notes-backdrop[hidden],
.mmd-viewer__notes-frame[hidden] {
    display: none !important;
}

.mmd-viewer.is-static .mmd-viewer__stage,
.mmd-viewer__stage.is-static {
    cursor: default;
    touch-action: auto;
}

.mmd-viewer__stage.is-panning {
    cursor: grabbing;
}

.mmd-viewer__stage svg {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.mmd-topic {
    cursor: pointer;
}

.mmd-extra {
    cursor: pointer;
}

.mmd-viewer.is-static .mmd-topic {
    cursor: default;
}

.mmd-connectors,
.mmd-jumps,
.mmd-selection,
.mmd-topic__shadow,
.mmd-paper {
    pointer-events: none;
}

.mmd-viewer__empty,
.mmd-viewer__error {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #d7e3ee;
    text-align: center;
    pointer-events: none;
}

.mmd-viewer__error {
    color: #ffd0d0;
}

.mmd-viewer__notes {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    width: min(360px, 42vw);
    min-width: 240px;
    min-height: 0;
    overflow: hidden;
    background: var(--mmd-panel);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.mmd-viewer__notes-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mmd-viewer__notes-head > * + * {
    margin-left: 8px;
}

.mmd-viewer__notes-title {
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    white-space: pre-wrap;
    word-break: break-word;
}

.mmd-viewer__notes-close {
    flex: none;
    width: 28px;
    height: 28px;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
}

.mmd-viewer__notes-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 12px 14px 18px;
    -webkit-overflow-scrolling: touch;
    -webkit-user-select: text;
    user-select: text;
}

.mmd-viewer__meta {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

.mmd-viewer__meta > * {
    margin: 0 6px 6px 0;
}

.mmd-chip,
.mmd-viewer__meta a {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 3px 8px;
    color: #d5e6f7;
    background: #2b4258;
    border-radius: 999px;
    font-size: 11px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mmd-viewer__meta a:hover {
    background: #3a5874;
}

.mmd-viewer__topic-image {
    display: grid;
    gap: 8px;
    justify-items: start;
    margin: 0 0 12px;
}

.mmd-viewer__topic-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.mmd-note,
.mmd-snippet {
    margin: 0 0 12px;
    padding: 10px;
    color: #0f1720;
    background: #f4f7fa;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.mmd-snippet {
    font-size: 12px;
}

.mmd-snippet-label {
    margin: 0 0 4px;
    color: #9aafc2;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mmd-encrypted {
    display: flex;
    flex-direction: column;
}

.mmd-encrypted > * + * {
    margin-top: 8px;
}

.mmd-encrypted input {
    padding: 8px 10px;
    color: #e8eef4;
    background: #0f1a24;
    border: 1px solid #3d556b;
    border-radius: 4px;
    font: inherit;
    font-size: 16px;
}

.mmd-encrypted button {
    align-self: flex-start;
    padding: 6px 12px;
    color: #0f1a24;
    background: var(--mmd-accent);
    border: 0;
    border-radius: 4px;
    font: inherit;
    cursor: pointer;
}

.mmd-encrypted-error {
    color: #ff8d8d;
    font-size: 12px;
}

.mmd-muted {
    color: #9aafc2;
}

.mmd-file input {
    display: none;
}

.mmd-viewer__notes-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    background: rgba(8, 14, 20, 0.55);
}

.mmd-viewer.is-notes-portrait .mmd-viewer__notes {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    width: auto;
    min-width: 0;
    max-height: 42%;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.28);
}

.mmd-viewer.is-notes-landscape .mmd-viewer__notes {
    z-index: 4;
}

.mmd-viewer.is-notes-modal .mmd-viewer__notes {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 6;
    width: 92%;
    max-width: 440px;
    min-width: 0;
    max-height: 80%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

@media (max-width: 720px) {
    .mmd-viewer.is-notes-landscape .mmd-viewer__notes {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 6;
        width: 48%;
        max-width: 320px;
        min-width: 0;
        box-shadow: -12px 0 28px rgba(0, 0, 0, 0.28);
    }
}

@media (max-width: 720px) and (orientation: portrait) {
    .mmd-viewer.is-notes-auto .mmd-viewer__notes {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 6;
        width: auto;
        min-width: 0;
        max-height: 42%;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.28);
    }
}

@media (max-width: 720px) and (orientation: landscape) {
    .mmd-viewer.is-notes-auto .mmd-viewer__notes {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 6;
        width: 48%;
        max-width: 320px;
        min-width: 0;
        box-shadow: -12px 0 28px rgba(0, 0, 0, 0.28);
    }
}

.mmd-viewer__notes-frame {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    display: flex;
    margin: 0;
    pointer-events: none;
}

.mmd-viewer__notes-frame.is-modal {
    align-items: center;
    justify-content: center;
}

.mmd-viewer__notes-frame.is-sheet {
    align-items: flex-end;
    justify-content: center;
}

.mmd-viewer__notes-frame.is-side {
    align-items: stretch;
    justify-content: flex-end;
}

.mmd-viewer .mmd-viewer__notes-frame .mmd-viewer__notes-backdrop {
    z-index: 0;
    pointer-events: auto;
    touch-action: auto;
}

.mmd-viewer .mmd-viewer__notes-frame .mmd-viewer__notes {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 1;
    flex: 0 1 auto;
    margin: 0;
    min-width: 0;
    min-height: 0;
    pointer-events: auto;
    touch-action: auto;
    -webkit-transform: none;
    transform: none;
}

.mmd-viewer .mmd-viewer__notes-frame.is-modal .mmd-viewer__notes {
    width: min(440px, 92%);
    max-width: 440px;
    max-height: 80%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.mmd-viewer .mmd-viewer__notes-frame.is-sheet .mmd-viewer__notes {
    width: 100%;
    max-height: 42%;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.28);
}

.mmd-viewer .mmd-viewer__notes-frame.is-side .mmd-viewer__notes {
    width: min(320px, 48%);
    max-width: 320px;
    height: 100%;
    max-height: none;
    box-shadow: -12px 0 28px rgba(0, 0, 0, 0.28);
}
