:root { color-scheme: light; font-size: 19.2px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); }
:root {
    --text: #143b36;
    --page: #f4f8f5;
    --surface: #fffefa;
    --field: #f5f7f2;
    --border: #dde5dd;
    --selected: #edf7ee;
    --selected-border: #84b99d;
    --muted: #657d70;
    --placeholder: #8b978e;
    --accent: #208f6b;
    --primary: #143b36;
    --primary-text: #fff;
    --secondary: #e5eee4;
    --overlay: rgba(228, 238, 232, .64);
    --highlight: #32bb8e;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --text: #f0f0f0;
    --page: #000;
    --surface: #161616;
    --field: #222;
    --border: #363636;
    --selected: #303030;
    --selected-border: #737373;
    --muted: #b5b5b5;
    --placeholder: #969696;
    --accent: #eee;
    --primary: #eee;
    --primary-text: #000;
    --secondary: #2d2d2d;
    --overlay: #000;
    --highlight: #eee;
}
* { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; }
body { background: var(--page); font-family: inherit; }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { transition: background .15s, transform .15s; }
button:hover { filter: brightness(.95); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--highlight); outline-offset: 3px; }
#overlays { background: var(--overlay); backdrop-filter: blur(7px); }
#death-dialog { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 20px; background: #0009; backdrop-filter: blur(7px); }
#death-dialog[hidden] { display: none; }
.death-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); color: var(--text); text-align: center; box-shadow: 0 24px 80px #0005; }
.death-card h2 { margin: 0 0 14px; font-size: 28.8px; }
.death-card p { margin: 0 0 26px; font-size: 16.8px; line-height: 1.6; color: var(--muted); }
#death-ok { width: 100%; background: var(--primary); color: var(--primary-text); }
#death-ok:disabled { opacity: .65; cursor: wait; }
#menu-layout { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; width: min(900px, calc(100% - 32px)); max-height: calc(100dvh - 32px); }
#helloDialog, #servers-panel { min-width: 0; min-height: 0; padding: 30px; border-radius: 26px; background: var(--surface); box-shadow: 0 22px 90px #123d3624; border: 1px solid var(--border); max-height: calc(100dvh - 32px); overflow-y: auto; }
:root[data-theme="dark"] #helloDialog, :root[data-theme="dark"] #servers-panel { box-shadow: 0 24px 80px #0008, inset 0 1px 0 #ffffff05; }
#helloDialog { position: static; transform: none; width: auto; margin: 0; }
#servers-panel h2 { margin: 0 0 24px; font-size: 28.8px; letter-spacing: -.6px; }
#server-list { display: grid; gap: 10px; }
.server-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px; text-align: left; background: var(--field); border: 1px solid var(--border); border-radius: 13px; color: var(--text); }
.server-row[aria-pressed="true"] { background: var(--selected); border-color: var(--selected-border); box-shadow: inset 3px 0 var(--highlight); }
.server-row:disabled { opacity: .55; cursor: default; }
.server-row strong { display: block; font-size: 16.8px; font-weight: 650; }
.server-row small { display: block; margin-top: 6px; color: var(--muted); font-size: 13.2px; }
.server-population { flex-shrink: 0; padding: 6px 9px; border-radius: 7px; background: var(--surface); color: var(--accent); font-size: 15.6px; font-variant-numeric: tabular-nums; font-weight: 650; }
#servers-status { margin: 14px 0 0; color: var(--muted); font-size: 14.4px; line-height: 1.6; }
.form-group { margin-bottom: 12px; }
.profile-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; font-size: 15.6px; color: var(--muted); }
#profile-points { color: var(--text); font-variant-numeric: tabular-nums; }
#progress-status { margin: 10px 0 0; color: var(--muted); font-size: 13.2px; line-height: 1.5; }
#progress-status:empty { display: none; }
.skin-section + .skin-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.skin-section h3 { margin: 0 0 8px; font-size: 21.6px; }
.skin-section > p { margin: 0 0 12px; color: var(--muted); font-size: 14.4px; }
.daily-skins-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.daily-skin { padding: 12px 6px; border: 1px solid var(--border); border-radius: 16px; background: var(--field); color: var(--text); min-width: 0; }
.daily-skin[aria-pressed="true"] { border-color: var(--highlight); box-shadow: inset 0 0 0 1px var(--highlight); background: var(--selected); }
.daily-skin img { display: block; width: min(100%, 100px); height: auto; aspect-ratio: 1; margin: 0 auto 10px; border-radius: 50%; }
.daily-skin strong { display: block; font-size: 14.4px; overflow-wrap: anywhere; }
.daily-skin span { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.daily-skin:disabled { cursor: default; }
.daily-skin:disabled img { filter: saturate(.6); opacity: .65; }
.skin-clear { margin-bottom: 14px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--field); color: var(--text); font-size: 14.4px; }
@media (max-width: 430px) { #gallery-body { padding: 16px; } .daily-skins-grid { gap: 8px; } .daily-skin { padding: 8px 4px; } }
.form-control { border: 1px solid var(--border); color: var(--text); background: var(--field); border-radius: 11px; padding: 12px; height: 50px; outline: none; min-width: 0; }
.form-control::placeholder { color: var(--placeholder); }
.identity-row { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(100px, 1.7fr) 54px; align-items: center; gap: 8px; }
.identity-row #nick { width: 100%; }
.tag-field { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0 10px; height: 50px; border: 1px solid var(--border); border-radius: 11px; background: var(--field); color: var(--muted); font-size: 14px; }
.tag-field input { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); outline: none; font: inherit; }
.skin-preview { display: grid; place-items: center; width: 54px; height: 54px; padding: 3px; border: 1px solid var(--border); border-radius: 50%; background: var(--field); color: var(--muted); font-size: 28px; cursor: pointer; }
.identity-row #skin { width: 54px; height: 54px; margin: 0; }
.skin-preview img { width: 46px; height: 46px; object-fit: cover; border-radius: 50%; }
.skin-preview [hidden] { display: none; }
.btn { border: 0; border-radius: 11px; padding: 13px 16px; font-size: 16.8px; font-weight: 650; }
.play-actions { display: flex; gap: 10px; margin: 4px 0 10px; }
#play-btn, #spectate-btn { flex: 1; min-width: 0; width: auto; margin: 0; float: none; text-align: center; }
#play-btn { background: var(--primary); color: var(--primary-text); }
#spectate-btn { background: var(--secondary); color: var(--text); }
#gallery-btn { margin: 0; background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 9px; font-size: 14.4px; }
.preferences { margin-top: 21px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.preferences summary { padding: 15px 0; list-style: none; font-size: 14.4px; color: var(--muted); }
.preferences summary::-webkit-details-marker { display: none; }
.preferences summary span { float: right; }
#settings > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 4px; padding: 0 0 16px; font-size: 13.2px; color: var(--muted); }
#settings label { display: flex; align-items: center; gap: 6px; margin: 0; }
input[type="checkbox"] { accent-color: var(--accent); }
#connection-status { margin: 16px 0 0; color: var(--muted); font-size: 14.4px; line-height: 1.6; }
#client-version { margin: 18px 0 0; color: var(--muted); font-size: 13.2px; text-align: center; }
#connecting { z-index: 350; background: var(--overlay); backdrop-filter: blur(7px); }
#connecting-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; width: min(360px, calc(100% - 36px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 30px; text-align: center; border-radius: 22px; box-shadow: 0 16px 70px #123d3615; }
#connecting h2 { font-size: 24px; }
#connecting p { font-size: 15.6px; color: var(--muted); line-height: 1.6; }
#connecting-description { white-space: pre-line; }
#connecting button { width: 100%; margin-top: 10px; white-space: normal; }
#connecting button[hidden] { display: none; }
#connecting[data-state="error"] .connection-orb { animation: none; opacity: .5; }
#connection-steps { display: grid; gap: 10px; margin: 22px 0 10px; padding: 0; list-style: none; text-align: left; }
#connection-steps:empty { display: none; }
.connection-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 2px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--field); color: var(--muted); transition: background .2s, border-color .2s; }
.connection-step strong { overflow-wrap: anywhere; font-size: 15px; font-weight: 650; }
.connection-step-marker { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 50%; font-size: 13px; font-variant-numeric: tabular-nums; }
.connection-step-status { grid-column: 2; font-size: 12px; line-height: 1.5; }
.connection-step[data-state="active"] { border-color: var(--highlight); background: var(--selected); color: var(--text); }
.connection-step[data-state="active"] .connection-step-marker { border: 2px solid var(--border); border-top-color: var(--accent); color: transparent; animation: connection-spin .9s linear infinite; }
.connection-step[data-state="failed"] .connection-step-marker { font-size: 22px; }
@keyframes connection-spin { to { transform: rotate(360deg); } }
.connection-orb { display: inline-block; width: 28px; height: 28px; border-radius: 50%; background: var(--highlight); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.75); opacity: .5; } }
#chat_textbox { font-family: inherit; border-radius: 8px; max-width: calc(100% - 20px); }
#chat-access-notice { position: fixed; bottom: 62px; left: 16px; z-index: 350; max-width: min(430px, calc(100% - 32px)); padding: 16px 20px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--surface); font-size: 16.8px; line-height: 1.5; box-shadow: 0 10px 36px #0005; }
#chat-access-notice[hidden] { display: none; }
#gallery { z-index: 300; background: var(--overlay); }
#gallery-content { max-width: calc(100% - 24px); border-radius: 18px; }
#gallery-header { font-size: 21.6px; }
.close-gallery { float: right; background: transparent; border: 0; font-size: 28.8px; }
#splitBtn, #ejectBtn { width: max(52px, 8vw); height: max(52px, 8vw); }
@media (max-width: 400px), (max-height: 720px) { #helloDialog, #servers-panel { padding: 22px; } .preferences { margin-top: 14px; } }
@media (max-width: 760px) { #menu-layout { top: 0; left: 0; transform: none; display: flex; flex-direction: column; gap: 16px; width: 100%; height: 100%; max-height: 100dvh; padding: 16px; overflow-y: auto; } #helloDialog, #servers-panel { flex-shrink: 0; max-height: none; } #servers-panel h2 { margin-bottom: 14px; font-size: 24px; } #servers-panel { padding: 20px 24px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.controls-panel { margin-top: 0; border-top: 0; }
.controls-help, #keybind-status { font-size: 13.2px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.keybind-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; font-size: 14.4px; border-top: 1px solid var(--border); }
.keybind-button { flex: 0 0 auto; min-width: 66px; max-width: 150px; padding: 8px 10px; color: var(--text); border: 1px solid var(--border); border-radius: 8px; background: var(--field); font-size: 14.4px; font-weight: 650; }
.keybind-button[aria-pressed="true"] { background: var(--selected); border-color: var(--highlight); }
#keybind-status { min-height: 35px; padding-top: 10px; margin-bottom: 4px; }
#reset-controls { padding: 8px 0 14px; border: 0; background: transparent; color: var(--muted); font-size: 13.2px; text-decoration: underline; }

#connecting-content, #gallery-content { background: var(--surface); color: var(--text); }
#gallery-header { background: var(--field); color: var(--text); padding: 10px; }
.close-gallery { color: var(--text); }
#skinsUL { scrollbar-color: var(--muted) var(--surface); }
:root[data-theme="dark"] #chat_textbox { background: #000c; color: var(--text); }
#chat-messages { position: fixed; z-index: 2; left: 10px; bottom: 55px; max-width: min(700px, calc(100vw - 20px)); max-height: 45vh; overflow: auto; font: 18px/1.35 system-ui, sans-serif; color: #151b24; pointer-events: none; text-shadow: 0 0 4px #fffd; }
#chat-panel { position: fixed; z-index: 2; left: 10px; bottom: 55px; width: min(700px, calc(100vw - 20px)); pointer-events: none; }
#chat-panel[hidden] { display: none; }
#chat-panel #chat-messages { position: static; max-width: 100%; }
#chat-tabs { display: flex; gap: 6px; margin-bottom: 8px; pointer-events: auto; }
#chat-tabs button { padding: 7px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); font: 15px system-ui, sans-serif; cursor: pointer; }
#chat-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-text); border-color: var(--highlight); }
#chat-tabs button:disabled { opacity: .5; cursor: default; }
.chat-message { display: flex; align-items: baseline; gap: 5px; overflow-wrap: anywhere; }
.chat-author { flex-shrink: 0; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-report { flex-shrink: 0; pointer-events: auto; border: 1px solid #6f8199; border-radius: 5px; background: #ecf2f9e8; color: #33445f; padding: 0 5px; min-width: 24px; min-height: 24px; font: inherit; cursor: pointer; text-shadow: none; }
.chat-report:hover, .chat-report:focus-visible { background: #bbd8ff; outline: 2px solid #4c8ddd; }
.chat-report:disabled { opacity: .6; cursor: default; }
#chat-report-status { position: fixed; z-index: 3; bottom: 13px; left: 325px; max-width: calc(100vw - 340px); padding: 8px 12px; border-radius: 8px; background: #102033ed; color: #eff6ff; font: 13px/1.4 system-ui, sans-serif; pointer-events: none; }
#chat-report-status:empty { display: none; }
:root[data-theme="dark"] #chat-messages { color: #fff; text-shadow: 0 1px 4px #000; }
:root[data-theme="dark"] .chat-report { background: #17283de8; color: #bfdcff; border-color: #456383; }
@media (max-width: 760px) { #chat-messages { max-width: calc(100vw - 20px); font-size: 14px; } #chat-report-status { left: 10px; bottom: 46px; max-width: calc(100vw - 20px); } }


/* Blogar.ru only: the local Bridge platform and hostname both allow website UI. */
#blogar-news-link { display: none; grid-column: 1 / -1; justify-self: center; min-width: 220px; padding: 10px 28px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); box-shadow: 0 12px 32px #123d3624; font-size: 16px; font-weight: 650; text-align: center; text-decoration: none; }
#blogar-news-link:hover, #blogar-news-link:focus-visible { border-color: var(--highlight); background: var(--selected); }
:root[data-blogar-website="true"] #blogar-news-link:not([hidden]) { display: block; }
