:root {
  font-family: Verdana, Arial, sans-serif;
  color: #223842;
  background: #dceef0;
  font-size: 12px;
  --blue: #176b91;
  --blue-dark: #164e6a;
  --blue-pale: #e8f5f7;
  --green: #78a63d;
  --line: #c4d9dd;
  --muted: #70858d;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-width: 340px; min-height: 100vh; margin: 0; background: linear-gradient(#e9f5f5,#d7e9eb); }
button, input, select, textarea { font: inherit; }
a { color: #176991; text-decoration: none; }
a:hover { color: #0a4b70; text-decoration: underline; }
button { color: inherit; }
.hidden { display: none !important; }
.ui-icon { display: inline-block; width: 16px; height: 16px; flex: 0 0 auto; object-fit: contain; pointer-events: none; vertical-align: middle; }

.site-header { border-bottom: 1px solid #b5cfd5; background: #fff; }
.header-inner, .nav-inner, .site-main, .site-footer { width: min(1120px, calc(100% - 36px)); margin: 0 auto; }
.header-inner { display: flex; height: 58px; align-items: center; gap: 27px; }
.site-logo { color: #124968; font-size: 19px; font-weight: 700; letter-spacing: -.8px; }
.site-logo span { color: #418a51; }
.site-logo:hover { text-decoration: none; }
.contest-name { padding-left: 14px; border-left: 1px solid #cddde0; color: #738890; font-size: 10px; }
.user-status { display: flex; align-items: center; gap: 7px; margin-left: auto; color: #71848a; font-size: 10px; }
.user-controls { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.user-controls #account-status { display: flex; align-items: center; gap: 6px; margin-right: 6px; color: #71848a; font-size: 9px; white-space: nowrap; }
.user-controls #account-status strong { color: #315a6c; }
.account-link { padding: 5px 7px; font-size: 8px; white-space: nowrap; }
.account-link, .theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.account-link .ui-icon { width: 15px; height: 15px; }
.theme-toggle { min-height: 29px; padding: 4px 7px; font-size: 8px; white-space: nowrap; }
.theme-toggle .theme-glyph { display: inline-block; width: 19px; height: 19px; font-size: 19px; line-height: 19px; text-align: center; }
.online-dot { width: 7px; height: 7px; border: 1px solid #fff; border-radius: 50%; background: #71af4e; box-shadow: 0 0 0 1px #6e9e57; }
.main-nav { min-height: 37px; border-top: 1px solid #e8f2f3; border-bottom: 1px solid #124d67; background: linear-gradient(#328bb0 0%,#1d6c91 52%,#155775 53%,#1b6485 100%); }
.nav-inner { display: flex; min-height: 36px; align-items: stretch; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; padding: 0 17px; border-right: 1px solid #ffffff22; color: #f6fdff; font-size: 10px; font-weight: 700; }
.nav-link .ui-icon { filter: drop-shadow(0 1px 0 #164d68); }
.nav-link:first-child { border-left: 1px solid #ffffff22; }
.nav-link:hover { background: #ffffff18; color: white; text-decoration: none; }
.nav-link.active { background: linear-gradient(#faffff,#d8edf1); color: #17536d; text-shadow: 0 1px white; }
.site-main { min-height: calc(100vh - 160px); padding: 24px 0 42px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.breadcrumbs { margin-bottom: 8px; color: #7c929a; font: 10px var(--mono); }
.breadcrumbs span { margin: 0 5px; color: #a6b9be; }
.page-heading h1 { margin: 0; color: #294d5d; font-size: 23px; font-weight: 400; letter-spacing: -.6px; }
.archive-total { display: flex; align-items: baseline; gap: 9px; padding-bottom: 2px; color: #778991; font-size: 9px; }
.archive-total strong { color: #24779b; font: 700 20px var(--mono); }
.notice-bar { display: flex; min-height: 34px; align-items: center; gap: 10px; margin: 0 0 18px; padding: 7px 11px; border: 1px solid #c9e0e1; border-left: 3px solid #73a849; background: linear-gradient(#f8fcf4,#eef7e8); color: #597067; font-size: 10px; }
.notice-bar strong { color: #51803f; font-size: 9px; white-space: nowrap; }

.problem-layout { display: grid; grid-template-columns: 205px minmax(0,1fr); align-items: start; gap: 17px; }
.sidebar { display: grid; gap: 12px; }
.sidebar-box { padding: 12px; border: 1px solid #c5d8dc; background: #f9fcfc; }
.sidebar-box h2 { margin: -12px -12px 12px; padding: 8px 11px; border-bottom: 1px solid #c7dde1; background: linear-gradient(#fff,#e9f4f5); color: #376276; font-size: 10px; font-weight: 700; }
.field-label { display: flex; justify-content: space-between; margin: 12px 0 5px; color: #768a91; font-size: 9px; font-weight: 700; }
.form-control { width: 100%; height: 29px; padding: 5px 7px; border: 1px solid #b9cdd1; border-radius: 2px; outline-color: #438aa5; background: #fff; color: #334c56; font-size: 11px; }
.plain-button { display: inline-block; padding: 6px 9px; border: 1px solid #b7cbd0; border-radius: 2px; background: linear-gradient(#fff,#e6eff1); color: #426477; cursor: pointer; font-size: 9px; }
.plain-button:hover { border-color: #89abb4; background: linear-gradient(#fff,#dcebed); text-decoration: none; }
#clear-filters { width: 100%; margin-top: 9px; }
.progress-filter { display: flex; width: 100%; justify-content: space-between; padding: 7px 5px; border: 0; border-bottom: 1px solid #e6eeee; background: transparent; color: #4b626b; cursor: pointer; text-align: left; font-size: 10px; }
.progress-filter:last-child { border-bottom: 0; }
.progress-filter:hover, .progress-filter.active { background: #e8f4f5; color: #155d7c; }
.progress-filter strong { color: #71868e; font: 10px var(--mono); }
.sidebar-statistics p { display: flex; justify-content: space-between; margin: 8px 0 0; color: #6a7f86; font-size: 10px; }
.sidebar-statistics p strong { color: #385b6b; font: 10px var(--mono); }

.content-column { min-width: 0; }
.content-toolbar { display: flex; min-height: 45px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 11px; border: 1px solid #c7dadd; border-bottom: 0; background: linear-gradient(#fff,#f1f8f8); }
.content-toolbar h2 { display: inline; margin: 0 8px 0 0; color: #365767; font-size: 12px; }
.subheading { color: #82939a; font-size: 10px; }
.sort-control { display: flex; align-items: center; gap: 7px; color: #7d8d93; font-size: 9px; }
.sort-control select { max-width: 150px; height: 25px; padding: 3px 5px; border: 1px solid #bfd0d4; background: white; color: #405d6a; font-size: 10px; }
.collection-section { margin-bottom: 16px; border: 1px solid #bdd4d9; background: #fff; }
.collection-title { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 7px 10px; border-bottom: 1px solid #bdd4d9; background: linear-gradient(#f7fcfc,#e3f0f2); color: #31586b; font-size: 11px; }
.collection-title small { color: #83969c; font-size: 9px; font-weight: 400; }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; text-align: left; }
.data-table thead { background: #f6f9f9; }
.data-table th { height: 29px; padding: 6px 8px; border-bottom: 1px solid #d9e4e6; color: #6c828b; font-size: 9px; font-weight: 700; white-space: nowrap; }
.data-table td { height: 36px; padding: 6px 8px; border-bottom: 1px solid #e5ecee; color: #455f69; font-size: 10px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f6fbfb; }
.problem-code { width: 70px; color: #24799b !important; font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.problem-name { min-width: 180px; }
.problem-name a { color: #246f91; font-size: 11px; font-weight: 700; }
.problem-name span { display: block; margin-top: 3px; color: #88999e; font-size: 9px; }
.data-table .muted { color: #89989c; font-size: 9px; }
.problem-state, .verdict-link { white-space: nowrap; }
.state-new { color: #788a90 !important; }
.state-todo { color: #ac7627 !important; }
.state-solved, .verdict-ac { color: #4c8e42 !important; }
.verdict-fail { color: #ac4439 !important; }
.verdict-other { color: #8c6331 !important; }
.table-action, .progress-toggle { padding: 4px 6px; border: 1px solid #c3d5d9; border-radius: 2px; background: linear-gradient(#fff,#e8f1f2); color: #376a80; cursor: pointer; font-size: 9px; }
.table-action:hover, .progress-toggle:hover { border-color: #7daab6; background: #e3f1f3; }
.progress-toggle { min-width: 29px; }
.progress-toggle.state-todo { color: #a27631; }
.progress-toggle.state-solved { color: #498b42; }
.empty-state, .loading-state, .table-placeholder { padding: 19px 12px; color: #758990; text-align: center; font-size: 11px; }
.empty-state { border: 1px solid #c5d9dd; background: #f9fcfc; }
.empty-state button { margin-left: 8px; padding: 4px 7px; border: 1px solid #b9cdd1; background: #fff; color: #276c8a; cursor: pointer; }

.submit-layout { display: grid; grid-template-columns: minmax(0,1fr) 250px; align-items: start; gap: 16px; }
.submit-form { padding: 13px; border: 1px solid #c5d8dc; background: #f9fcfc; }
.section-title { margin: -13px -13px 13px; padding: 9px 12px; border-bottom: 1px solid #c7dde1; background: linear-gradient(#fff,#e9f4f5); color: #376276; font-size: 10px; font-weight: 700; }
.submit-form .field-label { margin-top: 13px; }
.selected-problem-info { min-height: 28px; padding: 7px 0; color: #738890; font-size: 10px; }
.selected-problem-info a { margin-left: 5px; }
.editor-label { display: flex; justify-content: space-between; }
.editor-label span { color: #8a9a9f; font: 9px var(--mono); }
.code-editor { display: block; width: 100%; min-height: 340px; padding: 11px; resize: vertical; border: 1px solid #9db5bd; border-radius: 0; outline-color: #387e9a; background: #fff; color: #233e4e; font: 12px/1.55 Consolas,"Courier New",monospace; tab-size: 4; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.security-note { color: #87969a; font-size: 9px; }
.submit-button { display: inline-block; padding: 8px 13px; border: 1px solid #4a873e; border-radius: 2px; background: linear-gradient(#a9d969,#78ae42 55%,#63963a); color: white; cursor: pointer; font-size: 10px; font-weight: 700; text-align: center; text-shadow: 0 1px #548137; }
#new-topic-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.submit-button .ui-icon { width: 18px; height: 18px; }
.submit-button:hover { background: linear-gradient(#b7e37b,#83b94c 55%,#6b9c40); text-decoration: none; }
.submit-button:disabled { border-color: #adbabe; background: #d6dfe1; color: #748287; cursor: default; text-shadow: none; }
.submit-aside .sidebar-box { margin-bottom: 12px; }
.submit-aside p { color: #687e86; font-size: 10px; line-height: 1.55; }
.submit-steps { margin: 0; padding-left: 20px; color: #586f78; font-size: 10px; line-height: 1.8; }
.submit-steps strong { color: #3d6c7f; }
.submission-result { margin-top: 12px; padding: 11px; border: 1px solid #c9dcde; background: #fff; color: #536b73; font-size: 10px; line-height: 1.6; }
.submission-result > a { display: inline-block; margin-top: 7px; }
.submission-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.submission-summary strong { font: 700 14px var(--mono); }
.submission-summary span:last-child { margin-left: auto; color: #7c9097; font-family: var(--mono); font-size: 9px; }
.compiler-output { max-height: 240px; margin: 8px 0; padding: 9px; overflow: auto; border: 1px solid #d1dfe1; background: #f3f8f8; color: #344f5e; font: 10px/1.55 var(--mono); white-space: pre-wrap; }
.inline-notice { margin: 8px 0; padding: 10px; border: 1px solid #d5cba7; background: #fff9e9; color: #765a32; font-size: 10px; line-height: 1.55; }
.inline-notice a { margin-left: 5px; }

.page-heading > .plain-button { margin-bottom: 3px; }
.case-list { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; padding: 0; list-style: none; color: #59727b; font: 9px var(--mono); }
.verdict-link { padding: 0; border: 0; background: transparent; cursor: pointer; font: 700 10px var(--mono); text-decoration: underline; text-underline-offset: 2px; }
.verdict-link:hover { text-decoration: none; }
.submission-detail-row td { padding: 9px 13px; background: #f5f9f9; }
.progress-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.progress-summary > div { display: flex; min-height: 68px; flex-direction: column; justify-content: center; gap: 6px; padding: 10px 13px; border: 1px solid #c8dadd; background: linear-gradient(#fff,#edf6f7); }
.progress-summary span { color: #728890; font-size: 9px; }
.progress-summary strong { color: #246f90; font: 700 19px var(--mono); }

.problem-page-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin: 12px 0; }
.problem-page-heading h1 { margin: 0; color: #294d5d; font-size: 21px; font-weight: 400; }
.problem-page-heading p { margin: 7px 0 0; color: #778a91; font-size: 10px; }
.problem-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 17px; }
.statement-heading { margin: 18px 0 9px; padding-bottom: 7px; border-bottom: 1px solid #bdD3d8; color: #3d606f; font-size: 12px; }
.statement-frame { display: block; width: 100%; height: min(900px, max(620px, calc(100vh - 230px))); border: 0; background: white; }
.statement-text { min-height: 320px; padding: 22px; border: 1px solid #c8dadd; background: #fff; color: #334e59; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.problem-illustration { display: block; max-width: 100%; max-height: 620px; margin: 0 auto 12px; border: 1px solid #c8dadd; object-fit: contain; background: #fff; }
.reference-only-note { align-self: center; max-width: 520px; margin: 0; }
.problem-rating { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 13px 0; padding: 10px 12px; border: 1px solid #c8dadd; background: linear-gradient(#fff,#f0f8f8); }
.problem-rating > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.problem-rating > div:first-child strong { color: #365c6c; font-size: 10px; }
.rating-average, .rating-note { color: #72868d; font-size: 9px; }
.rating-stars { display: flex; gap: 3px; }
.rating-star { padding: 1px 3px; border: 0; background: transparent; color: #af7b26; cursor: pointer; font: 22px/1 Arial, sans-serif; }
.rating-star:hover:not(:disabled), .rating-star.selected { color: #d99a25; }
.rating-star:disabled { color: #9caeb1; cursor: default; }
.rating-note { margin-left: auto; }
.account-details { display: grid; max-width: 780px; gap: 12px; }
.account-card { padding: 14px; border: 1px solid #c5d8dc; background: #f9fcfc; }
.account-card h2, .admin-form > h2 { margin: -14px -14px 12px; padding: 9px 12px; border-bottom: 1px solid #c7dde1; background: linear-gradient(#fff,#e9f4f5); color: #376276; font-size: 12px; }
.account-info-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 20px; margin: 0; }
.account-info-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid #e3ecee; }
.account-info-list dt { color: #71858d; }
.account-info-list dd { margin: 0; color: #31596a; font-weight: 700; text-align: right; }
.forum-user-link { color: #315f77; font-weight: 700; text-decoration: none; }
.forum-user-link:hover { color: #1678a0; text-decoration: underline; }
.rank-badge { padding: 6px 10px; border: 1px solid currentColor; background: linear-gradient(#fff,#edf5f5); font-size: 11px; font-weight: 700; }
.rank-newbie { color: #71858d; }
.rank-pupil { color: #2c9b62; }
.rank-specialist { color: #18a5a8; }
.rank-expert { color: #3474cf; }
.rank-master { color: #a34dc5; }
.rank-grandmaster { color: #d15d52; }
.user-profile-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 12px 0 20px; }
.user-profile-summary > div { display: flex; min-height: 66px; flex-direction: column; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid #c5d8dc; background: linear-gradient(#fff,#f2f8f8); }
.user-profile-summary span { color: #71858d; font-size: 9px; font-weight: 700; }
.user-profile-summary strong { color: #31596a; font-size: 14px; }
.profile-section { margin: 18px 0; }
.profile-section > h2 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 9px; padding-bottom: 7px; border-bottom: 1px solid #c5d8dc; color: #3d606f; font-size: 13px; }
.collection-progress { width: min(180px,25vw); height: 8px; overflow: hidden; border: 1px solid #bed3d7; background: #e8f0f0; }
.collection-progress span { display: block; height: 100%; background: linear-gradient(#85d5a6,#48a875); }
.admin-form { max-width: 850px; }
.admin-form > h2 { margin: -14px -14px 14px; }
.admin-problem-fields { display: grid; grid-template-columns: 1fr 150px; gap: 0 12px; }
.admin-field { min-width: 0; }
.admin-field .field-label { margin-top: 5px; }
.admin-field-wide { grid-column: 1 / -1; }
.admin-statement { min-height: 180px; resize: vertical; }
.admin-testcases { min-height: 160px; resize: vertical; font-family: var(--mono); }
.admin-help { color: #71858d; font-size: 10px; line-height: 1.6; }
.admin-problem-submit { margin-top: 8px; }
.delete-post-button { margin-left: auto; color: #9a4d3b; }
.sample-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.sample-case { border: 1px solid #c8dadd; background: #fff; }
.sample-case h3 { margin: 0; padding: 7px 9px; border-bottom: 1px solid #d7e3e5; background: #f3f8f8; color: #57727d; font-size: 10px; }
.sample-columns { display: grid; grid-template-columns: 1fr 1fr; }
.sample-columns > div { min-width: 0; padding: 9px; }
.sample-columns > div + div { border-left: 1px solid #e0e8e9; }
.sample-columns strong { color: #71858c; font: 9px var(--mono); }
.sample-columns pre { min-height: 36px; margin: 7px 0 0; overflow-x: auto; color: #3e5865; font: 10px/1.5 var(--mono); white-space: pre-wrap; }

.site-footer { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #bfd2d6; color: #819398; font-size: 9px; }
.site-footer > span:first-child { color: #456a79; font-weight: 700; }
.site-footer a { color: inherit; text-decoration: underline; }

.forum-toolbar { display: flex; max-width: 350px; align-items: center; gap: 10px; margin-bottom: 12px; color: #71878e; font-size: 9px; font-weight: 700; }
.forum-toolbar .form-control { flex: 1; }
.forum-list { min-height: 110px; border: 1px solid #c5d8dc; background: #f9fcfc; }
.forum-topic-link { padding: 0; border: 0; background: transparent; color: #246f91; cursor: pointer; font-size: 11px; font-weight: 700; text-align: left; }
.forum-topic-link:hover { color: #0a4b70; text-decoration: underline; }
.forum-thread-heading { align-items: center; }
.forum-thread-heading h1 { max-width: 800px; overflow-wrap: anywhere; }
.forum-thread-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 5px 0 13px; color: #71858c; font-size: 10px; }
.forum-category-badge { padding: 4px 7px; border: 1px solid #c4d9dd; background: linear-gradient(#fff,#e8f2f3); color: #426e7c; font-size: 9px; font-weight: 700; }
.forum-post { margin: 10px 0; border: 1px solid #c5dadd; background: white; }
.forum-original-post { margin-top: 13px; }
.forum-post-meta { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #d9e5e7; background: #f3f8f8; color: #496876; font-size: 10px; }
.forum-post-meta span { color: #82949a; font-size: 9px; }
.forum-post p { margin: 0; padding: 11px; color: #435d67; font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.forum-images { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 11px 11px; }
.forum-images a { display: inline-flex; max-width: min(100%, 520px); padding: 3px; border: 1px solid #c6d8dc; background: #f4f9f9; }
.forum-images img { display: block; max-width: 100%; max-height: 420px; object-fit: contain; }
.forum-replies-heading { display: flex; align-items: baseline; gap: 7px; margin: 20px 0 8px; padding-bottom: 8px; border-bottom: 1px solid #c5d8dc; color: #436777; font-size: 14px; }
.forum-replies-heading span { color: #82949a; font-size: 10px; font-weight: 400; }
.forum-replies .forum-post { margin: 9px 0; }
.forum-compose { max-width: 820px; }
.forum-compose .field-label span,
.reply-form .field-label span { color: #879a9f; font: 9px var(--mono); }
.forum-textarea { min-height: 155px; }
.reply-form { max-width: 820px; margin: 22px 0 0; padding: 14px; border: 1px solid #c5d8dc; background: #f9fcfc; }
.reply-form h2 { margin: -14px -14px 12px; padding: 9px 12px; border-bottom: 1px solid #c7dde1; background: linear-gradient(#fff,#e9f4f5); color: #376276; font-size: 11px; }
.image-picker { height: auto; min-height: 34px; padding: 5px; }
.image-picker::file-selector-button { margin-right: 9px; padding: 5px 8px; border: 1px solid #b7cbd0; border-radius: 2px; background: linear-gradient(#fff,#e6eff1); color: #426477; cursor: pointer; font: inherit; font-size: 10px; }
.image-selection-note { min-height: 20px; margin-top: 5px; color: #738890; font-size: 9px; overflow-wrap: anywhere; }
.forum-form-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.account-dialog { width: min(450px,calc(100vw - 28px)); max-height: 90vh; padding: 0; overflow: auto; border: 1px solid #a9cbd2; border-radius: 3px; background: #f8fcfc; color: #344f5c; box-shadow: 0 12px 45px #15384c50; }
.account-dialog::backdrop { background: #284b5e80; }
.account-form { padding: 16px; }
.account-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -16px -16px 14px; padding: 10px 13px; border-bottom: 1px solid #a7c8d0; background: linear-gradient(#f9ffff,#dcecef); }
.account-dialog-heading h2 { margin: 0; color: #355c6e; font-size: 13px; }
.account-dialog-heading .dialog-close { width: 25px; height: 25px; padding: 0; border: 1px solid #b7cbd0; border-radius: 2px; background: linear-gradient(#fff,#e6eff1); color: #527080; cursor: pointer; font-size: 17px; line-height: 1; }
.account-form > p { color: #6c8087; font-size: 10px; line-height: 1.5; }
.account-form .form-control { margin-bottom: 3px; }
.account-form-error { min-height: 18px; margin: 5px 0; color: #a24337; font-size: 10px; }
.account-form .submit-button { margin-right: 7px; }
.account-switch { padding: 8px; }
.forum-textarea { height: auto; min-height: 100px; resize: vertical; line-height: 1.5; }
@media (max-width: 760px) {
  .user-controls { gap: 4px; }
  .user-controls #account-status { display: none; }
  .account-link { padding: 5px; font-size: 7px; }
}
@media (max-width: 760px) {
  .header-inner, .nav-inner, .site-main, .site-footer { width: calc(100% - 24px); }
  .contest-name { display: none; }
  .nav-link { padding: 0 11px; font-size: 9px; }
  .problem-layout { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
  .sidebar-statistics { display: none; }
  .submit-layout { grid-template-columns: 1fr; }
  .submit-aside { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .submit-aside .sidebar-box { margin-bottom: 0; }
  .statement-frame { height: max(580px, calc(100vh - 190px)); }
}
@media (max-width: 520px) {
  .header-inner, .nav-inner, .site-main, .site-footer { width: calc(100% - 18px); }
  .header-inner { height: 49px; }
  .site-logo { font-size: 17px; }
  .user-status { font-size: 9px; }
  .nav-inner { width: 100%; }
  .nav-link { flex: 1; justify-content: center; padding: 0 5px; font-size: 8px; }
  .nav-link { gap: 3px; }
  .nav-link .ui-icon { width: 13px; height: 13px; }
  .account-link span { display: none; }
  .account-link { width: 29px; min-width: 29px; padding: 4px; }
  .theme-toggle { width: 32px; min-width: 32px; padding: 4px; }
  .site-main { padding-top: 17px; }
  .page-heading { align-items: start; }
  .page-heading h1 { font-size: 20px; }
  .archive-total { font-size: 8px; }
  .archive-total strong { font-size: 17px; }
  .notice-bar { align-items: flex-start; flex-direction: column; gap: 4px; }
  .sidebar { gap: 8px; }
  .sidebar-box { padding: 9px; }
  .sidebar-box h2 { margin: -9px -9px 9px; padding: 7px 9px; }
  .content-toolbar { align-items: flex-start; padding: 8px; }
  .sort-control { flex-direction: column; align-items: flex-end; }
  .data-table th, .data-table td { padding-right: 5px; padding-left: 5px; font-size: 9px; }
  .data-table th { font-size: 8px; }
  .problem-name { min-width: 150px; }
  .problem-name a { font-size: 10px; }
  .submit-aside { grid-template-columns: 1fr; }
  .code-editor { min-height: 270px; }
  .security-note { max-width: 50%; line-height: 1.4; }
  .site-footer { flex-wrap: wrap; justify-content: flex-start; gap: 5px 12px; padding: 10px 0; }
  .site-footer > span:last-child { width: 100%; }
  .sample-columns { grid-template-columns: 1fr; }
  .statement-frame { height: 74vh; min-height: 500px; }
  .account-info-list { grid-template-columns: 1fr; }
  .user-profile-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .collection-progress { width: min(130px,25vw); }
  .problem-rating { align-items: flex-start; flex-direction: column; gap: 7px; }
  .rating-note { margin-left: 0; }
  .admin-problem-fields { grid-template-columns: 1fr; }
  .admin-field-wide { grid-column: auto; }
  .sample-columns > div + div { border-top: 1px solid #e0e8e9; border-left: 0; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  color: #d7e4e9;
  background: #14232b;
  --line: #354b55;
  --muted: #9aadb5;
}
html[data-theme="dark"] body { background: linear-gradient(#1a2b34,#14232b); color: #d7e4e9; }
html[data-theme="dark"] a { color: #83c9e4; }
html[data-theme="dark"] a:hover { color: #b5e8f7; }
html[data-theme="dark"] .site-header { border-color: #314b57; background: #1c303a; }
html[data-theme="dark"] .site-logo { color: #b2e3f1; }
html[data-theme="dark"] .contest-name,
html[data-theme="dark"] .user-controls #account-status { color: #a3b7bd; }
html[data-theme="dark"] .user-controls #account-status strong { color: #d6eff4; }
html[data-theme="dark"] .online-dot { border-color: #1c303a; }
html[data-theme="dark"] .main-nav { border-color: #102f3d; background: linear-gradient(#286b87 0%,#20566e 52%,#19495f 53%,#1c5068 100%); }
html[data-theme="dark"] .nav-link.active { background: linear-gradient(#344f5b,#293f49); color: #d8f2f5; text-shadow: 0 1px #15272e; }
html[data-theme="dark"] .page-heading h1,
html[data-theme="dark"] .problem-page-heading h1 { color: #d8eaf0; }
html[data-theme="dark"] .breadcrumbs { color: #a0b4bc; }
html[data-theme="dark"] .breadcrumbs span { color: #607b87; }
html[data-theme="dark"] .archive-total,
html[data-theme="dark"] .subheading { color: #a8b9bf; }
html[data-theme="dark"] .archive-total strong { color: #83c9e4; }
html[data-theme="dark"] .notice-bar { border-color: #3b5c50; border-left-color: #83bd5d; background: linear-gradient(#293b34,#23352f); color: #d1e1d4; }
html[data-theme="dark"] .notice-bar strong { color: #a9d784; }
html[data-theme="dark"] .sidebar-box,
html[data-theme="dark"] .submit-form,
html[data-theme="dark"] .forum-list { border-color: #344b56; background: #1e3039; }
html[data-theme="dark"] .sidebar-box h2,
html[data-theme="dark"] .section-title { border-color: #3b5662; background: linear-gradient(#304a56,#273d47); color: #c4e1e9; }
html[data-theme="dark"] .field-label,
html[data-theme="dark"] .sort-control,
html[data-theme="dark"] .sidebar-statistics p,
html[data-theme="dark"] .submit-aside p,
html[data-theme="dark"] .selected-problem-info,
html[data-theme="dark"] .problem-page-heading p { color: #a9bbc1; }
html[data-theme="dark"] .sidebar-statistics p strong { color: #c9dde3; }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .sort-control select,
html[data-theme="dark"] .code-editor,
html[data-theme="dark"] .forum-textarea { border-color: #506773; outline-color: #73b9d1; background: #14252e; color: #e0edf1; }
html[data-theme="dark"] .form-control::placeholder { color: #839aa3; }
html[data-theme="dark"] .plain-button,
html[data-theme="dark"] .table-action,
html[data-theme="dark"] .progress-toggle { border-color: #4a646f; background: linear-gradient(#344d58,#293e48); color: #d0e5eb; }
html[data-theme="dark"] .plain-button:hover,
html[data-theme="dark"] .table-action:hover,
html[data-theme="dark"] .progress-toggle:hover { border-color: #6d9eac; background: #365665; }
html[data-theme="dark"] .progress-filter { border-color: #334951; color: #c1d1d5; }
html[data-theme="dark"] .progress-filter:hover,
html[data-theme="dark"] .progress-filter.active { background: #2a4652; color: #a5dff0; }
html[data-theme="dark"] .progress-filter strong { color: #a4b6bd; }
html[data-theme="dark"] .content-toolbar { border-color: #344b56; background: linear-gradient(#293f49,#223640); }
html[data-theme="dark"] .content-toolbar h2 { color: #cee3e9; }
html[data-theme="dark"] .collection-section { border-color: #344b56; background: #1b2d36; }
html[data-theme="dark"] .collection-title { border-color: #3a535e; background: linear-gradient(#2e4853,#263b45); color: #d0e5eb; }
html[data-theme="dark"] .collection-title small { color: #a1b3b9; }
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .data-table thead { background: #1b2d36; }
html[data-theme="dark"] .data-table th { border-color: #354c56; color: #aabdc4; }
html[data-theme="dark"] .data-table td { border-color: #2c424c; color: #c7d7dc; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #263c46; }
html[data-theme="dark"] .problem-code,
html[data-theme="dark"] .problem-name a,
html[data-theme="dark"] .forum-topic-link { color: #8ed2e9 !important; }
html[data-theme="dark"] .problem-name span,
html[data-theme="dark"] .data-table .muted { color: #a0b1b7; }
html[data-theme="dark"] .state-new { color: #a1b2b7 !important; }
html[data-theme="dark"] .state-todo { color: #e0b96f !important; }
html[data-theme="dark"] .state-solved,
html[data-theme="dark"] .verdict-ac { color: #a2d58a !important; }
html[data-theme="dark"] .verdict-fail { color: #f0968c !important; }
html[data-theme="dark"] .verdict-other { color: #e4bd7b !important; }
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .loading-state,
html[data-theme="dark"] .table-placeholder { color: #a5b7bd; }
html[data-theme="dark"] .empty-state button { border-color: #4a646f; background: #263b45; color: #a6dff0; }
html[data-theme="dark"] .editor-label span,
html[data-theme="dark"] .security-note { color: #a4b5bb; }
html[data-theme="dark"] .submit-button { border-color: #5c984a; background: linear-gradient(#80b953,#5e943f 55%,#4b7938); color: #f3fff0; }
html[data-theme="dark"] .submit-button:disabled { border-color: #4b5b61; background: #384950; color: #a6b4b8; }
html[data-theme="dark"] .submit-steps { color: #c2d3d8; }
html[data-theme="dark"] .submit-steps strong { color: #a6d6e4; }
html[data-theme="dark"] .submission-result,
html[data-theme="dark"] .sample-case { border-color: #3a515c; background: #1b2d36; color: #c6d6db; }
html[data-theme="dark"] .compiler-output { border-color: #3c535e; background: #14252e; color: #d1e2e7; }
html[data-theme="dark"] .inline-notice { border-color: #665b3c; background: #393426; color: #f0dca6; }
html[data-theme="dark"] .progress-summary > div { border-color: #384f5a; background: linear-gradient(#2c434e,#223640); }
html[data-theme="dark"] .progress-summary span { color: #aabdc3; }
html[data-theme="dark"] .progress-summary strong { color: #94d2e5; }
html[data-theme="dark"] .statement-heading { border-color: #3b535e; color: #c1e0e9; }
html[data-theme="dark"] .statement-frame { border-color: #445c66; }
html[data-theme="dark"] .statement-text,
html[data-theme="dark"] .account-card { border-color: #3a515c; background: #1b2d36; color: #d0dfe3; }
html[data-theme="dark"] .account-card h2,
html[data-theme="dark"] .admin-form > h2 { border-color: #3b5662; background: linear-gradient(#304a56,#273d47); color: #c4e1e9; }
html[data-theme="dark"] .account-info-list > div { border-color: #354c56; }
html[data-theme="dark"] .forum-user-link { color: #9ed9eb; }
html[data-theme="dark"] .forum-user-link:hover { color: #d2f5ff; }
html[data-theme="dark"] .rank-badge,
html[data-theme="dark"] .user-profile-summary > div { background: linear-gradient(#2c434e,#223640); }
html[data-theme="dark"] .user-profile-summary > div { border-color: #3a515c; }
html[data-theme="dark"] .user-profile-summary span { color: #a9bbc1; }
html[data-theme="dark"] .user-profile-summary strong { color: #d0e6eb; }
html[data-theme="dark"] .profile-section > h2 { border-color: #3a515c; color: #c1e0e9; }
html[data-theme="dark"] .collection-progress { border-color: #3a515c; background: #1a2e37; }
html[data-theme="dark"] .account-info-list dt,
html[data-theme="dark"] .admin-help,
html[data-theme="dark"] .rating-average,
html[data-theme="dark"] .rating-note { color: #a9bbc1; }
html[data-theme="dark"] .account-info-list dd,
html[data-theme="dark"] .problem-rating > div:first-child strong { color: #cce5ec; }
html[data-theme="dark"] .problem-rating { border-color: #3a515c; background: linear-gradient(#253b45,#1d3039); }
html[data-theme="dark"] .rating-star:disabled { color: #71878e; }
html[data-theme="dark"] .sample-case h3 { border-color: #3a515c; background: #293f49; color: #c4dce3; }
html[data-theme="dark"] .sample-columns > div + div { border-color: #3a515c; }
html[data-theme="dark"] .sample-columns strong { color: #aabdc3; }
html[data-theme="dark"] .sample-columns pre { color: #d0e1e6; }
html[data-theme="dark"] .site-footer { border-color: #344b56; color: #9fb1b7; }
html[data-theme="dark"] .site-footer > span:first-child { color: #c0e0e9; }
html[data-theme="dark"] .site-footer a { color: #9ed9eb; }
html[data-theme="dark"] .forum-toolbar { color: #a9bbc1; }
html[data-theme="dark"] .forum-topic-link:hover { color: #c0effa !important; }
html[data-theme="dark"] .forum-thread-meta { color: #a8bbc1; }
html[data-theme="dark"] .forum-category-badge { border-color: #4b6570; background: linear-gradient(#354f59,#2b414a); color: #c2e0e9; }
html[data-theme="dark"] .forum-post { border-color: #3a515c; background: #192b34; }
html[data-theme="dark"] .forum-post-meta { border-color: #3a515c; background: #293f49; color: #c5dfe6; }
html[data-theme="dark"] .forum-post-meta span { color: #a1b4bb; }
html[data-theme="dark"] .forum-post p { color: #d0dfe3; }
html[data-theme="dark"] .forum-images a { border-color: #465f69; background: #243942; }
html[data-theme="dark"] .forum-replies-heading { border-color: #3a515c; color: #c1e0e9; }
html[data-theme="dark"] .forum-replies-heading span { color: #a6b7bd; }
html[data-theme="dark"] .reply-form { border-color: #3a515c; background: #1e3039; }
html[data-theme="dark"] .reply-form h2 { border-color: #3b5662; background: linear-gradient(#304a56,#273d47); color: #c4e1e9; }
html[data-theme="dark"] .forum-compose .field-label span,
html[data-theme="dark"] .reply-form .field-label span,
html[data-theme="dark"] .image-selection-note { color: #a5b7bd; }
html[data-theme="dark"] .image-picker::file-selector-button { border-color: #4a646f; background: linear-gradient(#344d58,#293e48); color: #d0e5eb; }
html[data-theme="dark"] .account-dialog { border-color: #44616d; background: #1c303a; color: #d7e4e9; }
html[data-theme="dark"] .account-dialog::backdrop { background: #03090dc9; }
html[data-theme="dark"] .account-dialog-heading { border-color: #3d5965; background: linear-gradient(#304a56,#263d47); }
html[data-theme="dark"] .account-dialog-heading h2 { color: #d4eaf0; }
html[data-theme="dark"] .account-dialog-heading .dialog-close { border-color: #536c77; background: linear-gradient(#3a5560,#2b414b); color: #d5e7eb; }
html[data-theme="dark"] .account-form > p { color: #adbec4; }
html[data-theme="dark"] .account-form-error { color: #ffaaa0; }
html[data-theme="dark"] .account-switch { color: #c5e0e8; }
html[data-theme="dark"] .account-switch:hover { color: #e5f8fc; }
html[data-theme="dark"] .verdict-link { color: inherit; }

@media (max-width: 520px) {
  .user-controls { gap: 3px; }
  .theme-toggle .theme-glyph { width: 19px; height: 19px; }
}
