:root {
    --bg1: #101112;
    --bg2: #202122;
    --text1: #deeaf5;
    --text2: #ced7df;
    --text3: #b0b6bc;
    --border: #30363d;
    --accent: #58a6ff;
}

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

html { font-size: 20px; }
@media (min-width: 500px) { html { font-size: 16px; } }
@media (min-width: 800px) { html { font-size: 14px; } }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "SimSun", "宋体", sans-serif;
    background-color: var(--bg1);
    color: var(--text1);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 1000px;
}

h1 {
    color: var(--text1);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.card,
.main-container {
    background-color: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

h2,
#msg {
    color: var(--text1);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    white-space: pre-line; /* 保留换行符 */
}

p {
    color: var(--text2);
    font-size: 1rem;
    margin-bottom: 8px;
}

#view {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg2);
}

#view::-webkit-scrollbar {
    width: 8px;
}

#view::-webkit-scrollbar-track {
    background: var(--bg2);
    border-radius: 4px;
}

#view::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

#view::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

#view video,
#view img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
}

#view pre {
    color: var(--text2);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---- Markdown 渲染样式 ---- */
#view.md-mode {
    display: block;
    text-align: left;
    overflow-x: auto;
}

.md-view {
    color: var(--text2);
    font-size: 1rem;
    line-height: 1.7;
    word-wrap: break-word;
    width: 100%;
}

.md-view h1,
.md-view h2,
.md-view h3,
.md-view h4,
.md-view h5,
.md-view h6 {
    color: var(--text1);
    margin: 1.2em 0 0.5em;
    line-height: 1.3;
}

.md-view h1 {
    font-size: 1.6rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3em;
}

.md-view h2 {
    font-size: 1.35rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3em;
}

.md-view h3 { font-size: 1.15rem; }
.md-view h4,
.md-view h5,
.md-view h6 { font-size: 1rem; }

.md-view p {
    margin: 0.6em 0;
    color: var(--text2);
}

.md-view ul,
.md-view ol {
    margin: 0.6em 0 0.6em 1.6em;
}

.md-view li {
    margin: 0.25em 0;
}

.md-view code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85em;
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15em 0.35em;
    color: #e3b341;
}

.md-view pre {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 0.8em 0;
}

.md-view pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text2);
    font-size: 0.85rem;
    white-space: pre;
    word-break: normal;
}

.md-view blockquote {
    border-left: 3px solid var(--accent);
    background: rgba(88, 166, 255, 0.06);
    margin: 0.8em 0;
    padding: 0.5em 1em;
    color: var(--text3);
}

.md-view a {
    color: var(--accent);
    text-decoration: none;
}

.md-view a:hover {
    text-decoration: underline;
}

.md-view img {
    max-width: 100%;
    max-height: none;
    border-radius: 6px;
}

.md-view table {
    border-collapse: collapse;
    margin: 0.8em 0;
    display: block;
    overflow-x: auto;
    max-width: 100%;
}

.md-view th,
.md-view td {
    border: 1px solid var(--border);
    padding: 6px 12px;
}

.md-view th {
    background: var(--bg1);
    color: var(--text1);
}

.md-view hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.2em 0;
}



.go-form {
    display: flex;
    gap: 12px;
}

.go-form input,
.go-form button {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text1);
    font-size: 1rem;
    padding: 8px 12px;
}

.go-form input {
    flex: 1;
}

.go-form button {
    cursor: pointer;
}

.go-form button:hover {
    background: #1c1d1e;
    border-color: #484f58;
}
