:root {
    --color-bg: #f5f5f5;
    --color-card: #ffffff;
    --color-border: #dddddd;
    --color-border-light: #e5e5e5;
    --color-table-head: #f0f0f0;
    --color-code-bg: #f7f7f7;

    --color-text: #222222;
    --color-muted: #666666;
    --color-strong: #111111;
    --color-link: #1f4f7a;
    --color-link-hover: #173c5e;

    --color-primary: #444444;
    --color-primary-hover: #222222;

    --color-accepted: #087f5b;
    --color-error: #c92a2a;
    --color-pending: #a55b00;

    --color-control-border: #cccccc;
    --radius-control: 5px;
    --radius-panel: 7px;
    --control-height: 36px;
    --control-padding: 7px 12px;
    --focus-ring: 2px solid #555555;
    --section-title-size: 22px;
    --section-gap: 18px;
    --heading-line-height: 1.35;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: Arial, "Noto Sans KR", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

body > main {
    width: 100%;
    flex: 1 0 auto;
}

/* Footer */

.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 13px;
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.site-footer > .container {
    padding-block: 18px;
}

.site-footer-brand,
.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.site-footer-brand a {
    font-weight: 800;
}

.site-footer-brand {
    flex-wrap: nowrap;
    white-space: nowrap;
}

.site-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    white-space: nowrap;
}

.site-footer [data-soj-ad-settings][hidden] {
    display: none;
}

a {
    color: #333;
    text-decoration: none;
}

a:hover {
    color: #111;
    text-decoration: underline;
}

main p a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

main p a:hover {
    color: var(--color-link-hover);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}

.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    padding: 20px;
}

.page-title {
    margin: 0 0 18px;
    font-size: 26px;
    overflow-wrap: anywhere;
    line-height: var(--heading-line-height);
}

.empty {
    padding: 40px 0;
    text-align: center;
    color: var(--color-muted);
}

.empty-profile-text {
    margin: 0;
    color: var(--color-muted);
    line-height: 1.7;
}

/* Shared visuals for structural utilities. */

.skip-link {
    border: 1px solid #444;
    border-radius: var(--radius-control);
    background: #fff;
    color: #222;
    font-weight: 800;
}

/* Current problem metadata markup is a dl; reset browser defaults while keeping the original OJ density. */
.problem-meta {
    color: #555;
    font-size: 14px;
}

.problem-meta dt {
    color: var(--color-muted);
}

.problem-meta dd {
    color: #333;
    font-weight: 800;
}

/* Problem difficulty/tag spoilers are one-way disclosures. Native details keeps the
 * initial control keyboard-accessible; after opening, the control disappears and the
 * revealed value occupies the same metadata area instead of offering a hide action. */
details.problem-spoiler > summary {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-card);
    color: var(--color-muted);
    cursor: pointer;
}

details.problem-spoiler > summary:hover {
    border-color: #bbbbbb;
    color: var(--color-strong);
}

.problem-filter-summary::after {
    color: #666;
    font-size: 18px;
}

.difficulty-range-selected {
    border: 1px solid #ddd;
    border-radius: var(--radius-control);
    background: #fff;
    font-size: 13px;
    font-weight: 800;
}

.difficulty-range-slider::before,
.difficulty-range-slider::after {
    border-radius: 2px;
}

.difficulty-range-slider::before {
    background: #d2d2cc;
}

.difficulty-range-slider::after {
    background: #222;
}

.difficulty-range-slider input[type="range"] {
    border: 0;
    background: transparent;
}

.difficulty-range-slider input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
}

.difficulty-range-slider input[type="range"]::-moz-range-track {
    background: transparent;
}

.difficulty-range-slider input[type="range"]::-webkit-slider-thumb {
    border: 2px solid #222;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.difficulty-range-slider input[type="range"]::-moz-range-thumb {
    border: 2px solid #222;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.difficulty-range-scale {
    color: var(--color-muted);
    font-size: 12px;
}

/* Header */

.header {
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo,
.site-brand {
    color: var(--color-text);
    text-decoration: none;
}

.logo {
    font-size: 24px;
    font-weight: 800;
}

.logo:hover,
.site-brand:hover {
    color: var(--color-strong);
    text-decoration: none;
}

.site-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.site-brand-main {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.site-brand-sub {
    color: #355070;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.header-right {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
    align-items: center;
    gap: 20px;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    color: var(--color-muted);
    padding: 6px 10px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav a:hover {
    color: var(--color-strong);
    text-decoration: none;
}

.nav a.active {
    color: var(--color-strong);
    font-weight: 800;
    border-bottom: 2px solid #555;
}

.account-menu {
    position: relative;
    min-width: 0;
    max-width: 240px;
    color: var(--color-strong);
    font-weight: 800;
}

.management-menu summary,
.account-menu summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    list-style: none;
    cursor: pointer;
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    color: var(--color-text);
}

.auth-area summary::-webkit-details-marker {
    display: none;
}

.auth-area summary::after {
    content: "";
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: rotate(45deg);
}

.auth-area details[open] > summary::after {
    transform: rotate(225deg);
}

.management-links,
.account-links {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    display: grid;
    min-width: 190px;
    padding: 6px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
}

.management-links a,
.account-links a,
.account-links .logout-button {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    color: var(--color-text);
    width: 100%;
    justify-content: flex-start;
    font-size: 14px;
    font-weight: 400;
    border: 0;
    border-radius: 0;
}

.management-links a:hover,
.management-links a.active,
.account-links a:hover,
.account-links a.active {
    background: #f5f5f5;
    color: var(--color-strong);
}

.management-links a.active,
.account-links a.active {
    font-weight: 800;
}

.auth-area {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
}

.login-button:hover {
    background: #f5f5f5;
    text-decoration: none;
}

.account-menu summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-badge {
    padding: 3px 7px;
    border-radius: 999px;
    background: #eeeeee;
    color: #333;
    font-size: 12px;
    font-weight: 800;
}

.logout-form {
    display: inline;
    margin: 0;
}

.logout-button:hover {
    background: #f5f5f5;
    color: var(--color-strong);
}

/* Buttons */

.button-primary,
.button-primary-link,
.button-secondary-link,
.compact-action,
.segmented-option,
.button-danger,
.login-button,
.logout-button,
.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-height);
    max-width: 100%;
    padding: var(--control-padding);
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    background: var(--color-card);
    color: var(--color-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button-danger {
    color: var(--color-error);
}

.button-secondary-link.button-danger:hover:not(:disabled),
.compact-action.button-danger:hover:not(:disabled) {
    border-color: var(--color-error);
    background: #fff5f5;
    color: var(--color-error);
    text-decoration: none;
}

.login-button,
.logout-button,
.copy-button {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
}

.copy-button {
    min-width: 76px;
    flex-shrink: 0;
}

:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible,
body button:focus-visible,
body a:focus-visible,
body summary:focus-visible,
body [tabindex]:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.button-primary,
.button-primary-link {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.button-primary:hover:not(:disabled),
.button-primary-link:hover {
    background: var(--color-primary-hover);
    color: #fff;
    text-decoration: none;
}

.button-secondary-link:hover:not(:disabled),
.compact-action:hover:not(:disabled),
.segmented-option:hover:not(:disabled) {
    background: #e9ecef;
    color: #111;
    text-decoration: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.compact-action {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
}

.segmented-control {
    display: inline-flex;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
}

.segmented-option {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.segmented-option:first-child {
    border-radius: var(--radius-control) 0 0 var(--radius-control);
}

.segmented-option:last-child {
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.segmented-option[aria-pressed="true"],
.segmented-option[aria-pressed="true"]:hover {
    background: var(--color-primary);
    color: #fff;
}

.submit-actions > .back-link,
.source-title-row .back-link,
.request-admin-hero-actions > .back-link {
    margin-bottom: 0;
}

/* Suggestions use prose input, not the horizontal metadata form row. */
.suggestion-field {
    display: grid;
    gap: 8px;
}

.suggestion-field label {
    font-weight: 800;
}

.suggestion-field textarea {
    width: 100%;
    min-height: 240px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
}

.suggestion-form .form-help {
    margin: 8px 0 16px;
}

/* Common form */

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
    font-size: 14px;
}

.form-row label {
    min-width: 110px;
    flex-shrink: 0;
    font-weight: 800;
}

.form-help {
    margin: 6px 0 0;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.5;
}

select,
input,
textarea,
button {
    font-family: inherit;
}

input,
select,
textarea {
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    color: var(--color-text);
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select {
    min-height: var(--control-height);
    line-height: 20px;
}

textarea {
    padding: 12px;
    background: var(--color-card);
    font-size: 15px;
    line-height: 1.6;
}

input:user-invalid,
select:user-invalid,
textarea:user-invalid,
[aria-invalid="true"] {
    border-color: var(--color-error);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
    background: var(--color-code-bg);
    color: var(--color-muted);
}

.form-group {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 14px;
    font-weight: 800;
}

.form-group input {
    width: 100%;
}

.form-group input[type="number"] {
    max-width: 300px;
}

.muted {
    color: var(--color-muted);
}

.submission-connection-notice:empty,
.source-draft-status:empty {
    margin: 0;
}

.card h2 {
    font-size: var(--section-title-size);
}

input,
select {
    padding: 7px 10px;
    background: #fff;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #999;
}

.code-input {
    width: 100%;
    min-height: 240px;
    padding: 12px;
    resize: vertical;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.5;
}

.submit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* Tables */

.info-table,
.problem-table,
.submission-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.info-table th,
.info-table td,
.problem-table th,
.problem-table td,
.submission-table th,
.submission-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--color-border-light);
    text-align: left;
}

.info-table th,
.problem-table th,
.submission-table th {
    background: var(--color-table-head);
    font-weight: 800;
}

.info-table th {
    width: 160px;
}

.info-table thead th {
    width: auto;
}

.problem-table tr:hover td,
.submission-table tr:hover td,
.problem-table tr:focus-within td,
.submission-table tr:focus-within td {
    background: #fafafa;
}

.info-table td.empty,
.problem-table td.empty,
.submission-table td.empty {
    padding: 32px 12px;
    text-align: center;
    white-space: normal;
}

.empty p {
    margin: 0 0 12px;
}

.list-empty-state {
    padding: 32px 12px;
    border-block: 1px solid var(--color-border-light);
    overflow-wrap: anywhere;
}

.list-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    margin: 0 0 12px;
    color: var(--color-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.stat-value,
.profile-stat-value,
.profile-result-value,
.submission-table,
.profile-language-table {
    font-variant-numeric: tabular-nums;
}

.info-table code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f3f5;
    font-family: Consolas, Monaco, monospace;
}

/* Difficulty */

.difficulty {
    font-weight: 800;
}

.difficulty[data-difficulty="Unranked"] {
    color: #000000;
}

.difficulty[data-difficulty="Bronze I"],
.difficulty[data-difficulty="Bronze II"],
.difficulty[data-difficulty="Bronze III"],
.difficulty[data-difficulty="Bronze IV"],
.difficulty[data-difficulty="Bronze V"] {
    color: #ad5600;
}

.difficulty[data-difficulty="Silver I"],
.difficulty[data-difficulty="Silver II"],
.difficulty[data-difficulty="Silver III"],
.difficulty[data-difficulty="Silver IV"],
.difficulty[data-difficulty="Silver V"] {
    color: #435f7a;
}

.difficulty[data-difficulty="Gold I"],
.difficulty[data-difficulty="Gold II"],
.difficulty[data-difficulty="Gold III"],
.difficulty[data-difficulty="Gold IV"],
.difficulty[data-difficulty="Gold V"] {
    color: #ec9a00;
}

.difficulty[data-difficulty="Platinum I"],
.difficulty[data-difficulty="Platinum II"],
.difficulty[data-difficulty="Platinum III"],
.difficulty[data-difficulty="Platinum IV"],
.difficulty[data-difficulty="Platinum V"] {
    color: #57bb8a;
}

.difficulty[data-difficulty="Diamond I"],
.difficulty[data-difficulty="Diamond II"],
.difficulty[data-difficulty="Diamond III"],
.difficulty[data-difficulty="Diamond IV"],
.difficulty[data-difficulty="Diamond V"] {
    color: #00b4fc;
}

.difficulty[data-difficulty="Ruby I"],
.difficulty[data-difficulty="Ruby II"],
.difficulty[data-difficulty="Ruby III"],
.difficulty[data-difficulty="Ruby IV"],
.difficulty[data-difficulty="Ruby V"] {
    color: #ff0062;
}

/* Tags */

.problem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.problem-tags-center {
    justify-content: center;
    margin-top: 10px;
}

.problem-tag {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #f7f7f7;
    color: #444;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

/* Home */

.home-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.home-title {
    margin: 0 0 10px;
    font-size: 28px;
}

.home-description {
    margin: 0;
    color: var(--color-muted);
    line-height: 1.7;
}

.home-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.home-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    padding: 20px;
    text-align: center;
}

.stat-value {
    margin-bottom: 6px;
    color: var(--color-strong);
    font-size: 30px;
    font-weight: 900;
}

.stat-label {
    color: var(--color-muted);
    font-size: 14px;
}

.home-discovery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
    gap: 18px;
    margin-bottom: 18px;
    align-items: start;
}

.home-discovery h2 {
    margin: 0 0 18px;
    font-size: 22px;
}

.home-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0 12px;
    margin-bottom: 18px;
}

.home-section-heading h2 {
    margin: 0;
}

.home-section-heading > a {
    font-size: 13px;
}

.home-search-controls {
    display: flex;
    gap: 8px;
}

.home-search-controls input {
    min-width: 0;
    width: 100%;
}

.home-search-controls button {
    flex-shrink: 0;
}

.home-explore h3 {
    margin: 18px 0 12px;
    font-size: 17px;
}

.home-difficulty-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8em), 1fr));
    gap: 8px;
}

.home-difficulty-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    font-size: 13px;
}

.home-problem-table .col-id {
    width: 64px;
}

/* Problem list */

.problem-spoiler {
    color: var(--color-text);
    font-size: 13px;
    font-weight: 400;
    min-width: 0;
}

.problem-spoiler > summary {
    cursor: pointer;
    width: fit-content;
    max-width: 100%;
    padding: 4px 0;
    white-space: nowrap;
}

.problem-spoiler .problem-tags {
    justify-content: inherit;
    white-space: normal;
}

.problem-spoiler .problem-tag {
    flex: 0 0 auto;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.problem-tags-center > .problem-spoiler {
    display: inline-block;
    text-align: left;
}

.problem-list-title {
    display: grid;
    gap: 6px;
}

.problem-list-heading {
    min-width: 0;
}

.problem-list-table .problem-list-heading .problem-title {
    display: inline;
}

.problem-personal-badge,
.problem-property-badge {
    display: inline-block;
    margin-inline-end: 4px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.problem-personal-badge.is-solved {
    color: var(--color-accepted);
    background: #dcfce7;
}

.problem-personal-badge.is-unsolved,
.problem-property-badge {
    color: #475569;
    background: #f1f5f9;
}

.problem-list-table tbody td {
    vertical-align: top;
}

.problem-list-table .problem-spoiler > summary {
    padding-block: 0;
}

.problem-list-table .col-problem-stat {
    width: 86px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.problem-list-mobile-stats {
    display: none;
}

.problem-table {
    table-layout: fixed;
}

.problem-table .col-difficulty {
    width: 132px;
    white-space: nowrap;
}

.home-problem-table .col-difficulty {
    width: 7.5em;
}

.home-problem-table .difficulty {
    overflow-wrap: anywhere;
}

.home-problem-table {
    min-width: 0;
}

.problem-title {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.col-id {
    width: 90px;
    text-align: center;
}

.problem-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.submission-search-form {
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.search-field {
    display: flex;
    flex: 1 1 180px;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    font-weight: 800;
}

.search-field .problem-search-input {
    width: 100%;
}

.submission-search-form .problem-search-reset {
    padding: 9px 0;
}

.problem-search-input {
    width: 320px;
    max-width: 100%;
    padding: 7px 10px;
    font-size: 14px;
}

.problem-search-reset {
    color: var(--color-muted);
    font-size: 14px;
}

/* Problem detail */

.problem-card {
    margin-bottom: 18px;
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--color-muted);
}

.problem-header {
    max-width: 900px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 22px;
    margin: 0 auto 28px;
}

.problem-number {
    margin: 0 0 4px;
    color: var(--color-muted);
    font-size: 14px;
}

.problem-title-main {
    margin: 0 0 12px;
    font-size: 30px;
    overflow-wrap: anywhere;
}

.problem-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 14px;
}

.problem-page-actions .back-link {
    margin: 0;
}

.problem-limit {
    display: flex;
    justify-content: center;
    gap: 24px;
    color: #444;
    font-size: 14px;
}

.problem-body {
    max-width: 900px;
    margin: 0 auto;
}

.problem-section {
    margin: 30px 0;
}

.problem-section:first-child {
    margin-top: 0;
}

.problem-section h2 {
    margin: 0 0 12px;
    font-size: var(--section-title-size);
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: 6px;
}

.official-editorial > summary {
    min-height: 44px;
    cursor: pointer;
    list-style: none;
}

.official-editorial > summary::-webkit-details-marker {
    display: none;
}

.official-editorial-summary h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0;
    padding: 8px 0;
}

.official-editorial-summary h2::before {
    content: "▸";
    display: inline-block;
    flex: 0 0 auto;
    transition: transform 0.15s ease;
}

.official-editorial[open] .official-editorial-summary h2::before {
    transform: rotate(90deg);
}

.official-editorial-summary-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: #666;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.official-editorial-state-open {
    display: none;
}

.official-editorial[open] .official-editorial-state-closed {
    display: none;
}

.official-editorial[open] .official-editorial-state-open {
    display: inline;
}

.official-editorial > summary:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.official-editorial-content {
    padding-top: 18px;
}

.editorial-implementations {
    min-width: 0;
    margin-top: 24px;
}

.editorial-language-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 18px;
    padding: 4px;
}

.editorial-language-tabs a {
    flex: 0 0 auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 2px solid transparent;
    color: var(--color-text);
    text-decoration: none;
}

.editorial-language-tabs a[aria-selected="true"] {
    border-bottom-color: currentColor;
    font-weight: 700;
}

.editorial-language-tabs a:focus-visible,
.editorial-language-panel:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.editorial-language-panel[hidden] { display: none; }
.editorial-language-panel { scroll-margin-top: 24px; }
.editorial-tabs-ready .editorial-language-heading { margin-top: 0; }

.problem-text {
    color: var(--color-text);
    line-height: 1.85;
    font-size: 16px;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.problem-text p {
    margin: 0 0 18px;
}

.problem-statement-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 16px auto;
}

.problem-statement-image-missing {
    color: var(--color-muted);
    font-size: 0.9em;
}

.problem-text code {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--radius-control);
    background: #f1f3f5;
    color: var(--color-text);
    font-family: Consolas, Monaco, monospace;
    font-size: 0.88em;
    line-height: 1.45;
    vertical-align: baseline;
}

.problem-text pre {
    padding: 12px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    overflow-x: auto;
}

.sample-block {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.sample-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sample-column .sample-box {
    flex: 1;
    margin-bottom: 0;
}

.sample-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--color-border-light);
    margin-bottom: 12px;
    padding-bottom: 6px;
}

.sample-title-row h2 {
    margin: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.sample-box {
    min-height: 88px;
    margin: 0 0 16px;
    padding: 12px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-x: auto;
}

.copy-button:hover {
    background: #f0f0f0;
}

.copy-button.copied {
    background: #eeeeee;
    color: #111;
    font-weight: 800;
}

/* Submission */

.submission-table {
    min-width: 1010px;
    table-layout: fixed;
}

.submission-table th,
.submission-table td {
    white-space: nowrap;
}

.submission-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.submission-table td.col-status {
    white-space: normal;
    line-height: 1.4;
}

.submission-table .col-id,
.submission-table .col-problem,
.submission-table .col-lang,
.submission-table .col-time,
.submission-table .col-memory,
.submission-table .col-len {
    text-align: center;
}

.col-problem {
    width: 90px;
}

.submission-table .col-user {
    width: 150px;
}

.submission-share-link {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.col-lang {
    width: 100px;
}

.col-status {
    width: 180px;
}

.col-time {
    width: 100px;
}

.col-memory {
    width: 120px;
}

.col-len {
    width: 100px;
}

.col-created {
    width: 180px;
}

.status {
    font-weight: 800;
    font-size: 13px;
}

.verification-fingerprint {
    overflow-wrap: anywhere;
}

.verification-page h2 {
    overflow-wrap: anywhere;
}

.verification-table {
    min-width: 600px;
}

.submission-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin-top: 16px;
}

.submission-meta > div {
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 10px 12px;
    background: #fafafa;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-control);
}

.meta-label {
    display: inline-block;
    min-width: 82px;
    color: var(--color-muted);
    font-weight: 800;
}

.submission-meta a {
    color: var(--color-link);
    font-weight: 800;
    line-height: 1.4;
    text-decoration: none;
}

.source-code {
    margin: 0;
    padding: 14px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-x: auto;
}

.source-code-textarea {
    display: none;
}

.submission-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* Pagination */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: #fff;
    color: #444;
}

.pagination a:hover {
    background: #f5f5f5;
    text-decoration: none;
}

.pagination .page-info {
    color: #555;
}

/* Error page */

.error-card {
    max-width: 720px;
    margin: 72px auto;
    padding: 42px 36px;
    text-align: center;
}

.error-code {
    margin-bottom: 14px;
    color: var(--color-primary);
    font-size: 72px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -2px;
}

.error-title {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 800;
    color: var(--color-text);
}

.error-message {
    margin: 0 auto 28px;
    max-width: 480px;
    color: var(--color-muted);
    font-size: 16px;
    line-height: 1.7;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.error-message-card h2 {
    margin: 0 0 12px;
    font-size: 20px;
}

.judge-error-message {
    margin: 0;
    padding: 14px;
    background: #111;
    color: #f1f1f1;
    border-radius: var(--radius-control);
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Info / Contributor */

.guide-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--color-border);
}

.guide-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    border-bottom: 2px solid transparent;
}

.guide-nav a[aria-current="page"] {
    font-weight: 700;
    border-bottom-color: var(--color-text);
}

.guide-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0 20px;
    margin: -6px 0 18px;
}

.guide-topics a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.guide-result-table th:first-child {
    width: 30%;
}

.guide-page .info-card a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.guide-content section + section {
    margin-top: 24px;
}

.guide-page .guide-content p {
    margin-bottom: 10px;
}

.guide-page .guide-content section > :last-child {
    margin-bottom: 0;
}

.info-card h2 {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 22px;
}

.info-card h3 {
    margin: 18px 0 8px;
    font-size: 17px;
}

.info-card p {
    margin: 0 0 14px;
    line-height: 1.7;
}

.info-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.info-list code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f3f5;
    font-family: Consolas, Monaco, monospace;
}

.contributor-description {
    margin: 0 0 18px;
    color: var(--color-muted);
    line-height: 1.7;
}

.contributor-guide-card {
    margin-top: 0;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.contributor-guide-header,
.contribute-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.contributor-guide-header h2,
.info-card .contribute-section-header h2 {
    margin: 0;
    padding: 0;
    border: 0;
}

.contributor-guide-header > a,
.contribute-section-header > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: 100%;
}

.contributor-guide-access {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    gap: 8px 18px;
    padding: 12px 0;
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
}

.contributor-guide-access h3,
.contributor-guide-access p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.contributor-guide-access h3 {
    color: var(--color-strong);
}

.contributor-guide-access p {
    color: var(--color-muted);
}

.contributor-guide-steps {
    margin: 18px 0 20px;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--color-border-light);
}

.contributor-guide-step {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 24px;
    padding: 16px 0;
    border-top: 1px solid var(--color-border-light);
}

.contributor-guide-step:first-child {
    border-top: 0;
}

.contributor-guide-step-heading {
    display: flex;
    flex: 1 1 190px;
    min-width: 0;
    align-items: flex-start;
    gap: 8px;
}

.contributor-guide-step-heading > div {
    min-width: 0;
}

.contributor-guide-step-number {
    flex: 0 0 24px;
    width: 24px;
    padding-top: 3px;
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.contributor-guide-step h3 {
    margin: 0;
    color: var(--color-strong);
    font-size: 16px;
    line-height: 1.5;
}

.contributor-guide-step-tabs {
    display: block;
    margin-top: 3px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
}

.contributor-guide-step-body {
    flex: 3 1 490px;
    min-width: 0;
}

.contributor-guide-step p,
.contributor-guide-note p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.contributor-guide-step p + p,
.contributor-guide-note p + p {
    margin-top: 7px;
}

.contributor-guide-details {
    margin: 9px 0 0;
    padding-left: 19px;
    font-size: 14px;
    line-height: 1.7;
}

.contributor-guide-details li + li {
    margin-top: 7px;
}

.contributor-guide-card code,
.contribute-page .info-list code {
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--color-code-bg);
    font-family: Consolas, Monaco, monospace;
    font-size: 0.95em;
    word-break: normal;
}

.contributor-guide-card a:not(.button-primary-link) {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.contributor-guide-related {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.contributor-guide-note {
    min-width: 0;
    padding-top: 13px;
    border-top: 1px solid var(--color-border-light);
}

.contributor-guide-note h3 {
    margin: 0 0 7px;
    font-size: 15px;
}

.contribute-detail-list li + li,
.statement-conventions-card .info-list li + li {
    margin-top: 6px;
}

.contribute-section-header {
    margin-bottom: 12px;
}

.problem-convention-default {
    color: var(--color-strong);
}

.info-card .convention-required {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-left: 3px solid var(--color-text);
    background: var(--color-code-bg);
    font-size: 14px;
}

.statement-convention-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.statement-convention-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.contribute-page [id^="statement-"],
.contribute-page #contributor-guide-title,
.contribute-page #polygon-packages,
.contribute-page #problem-conventions {
    scroll-margin-top: 16px;
}

@media (max-width: 800px) {
    .contributor-guide-access {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .contributor-guide-step-heading,
    .contributor-guide-step-body {
        flex-basis: 100%;
    }

    .contributor-guide-related {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .contribute-section-header {
        align-items: flex-start;
    }
}

/* Language picker */

.language-picker {
    position: relative;
    min-width: 180px;
}

.language-search {
    width: 220px;
    padding: 7px 10px;
}

.language-options {
    display: none;
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    width: 220px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.language-options.open {
    display: block;
}

.language-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    background: #fff;
    color: var(--color-text);
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}

.language-option:hover,
.language-option.selected {
    background: #f1f3f5;
    font-weight: 800;
}

.submit-card .language-option[hidden] {
    display: none;
}

.submit-card .language-option.active {
    outline: 2px solid var(--color-text);
    outline-offset: -2px;
}

.language-no-results {
    margin: 0;
    padding: 8px 10px;
    color: var(--color-muted);
}

/* Notice */

.notice,
.notice-box {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: #fafafa;
}

.notice-box strong {
    display: block;
    margin-bottom: 8px;
}

.notice-box p {
    margin: 0;
    line-height: 1.7;
}

.invocation-success {
    border-color: #b7e4c7;
    background: #effaf2;
}

.invocation-failure {
    border-color: #ffc9c9;
    background: #fff5f5;
}

.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
}

/* User profile */

.profile-card,
.profile-problem-card {
    margin-inline: auto;
}

.profile-top {
    display: block;
    margin-bottom: 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: #111;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.profile-main {
    min-width: 0;
}

.profile-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.15;
    font-weight: 900;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
}

.profile-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.profile-admin-badge {
    font-size: 12px;
}

.profile-description {
    margin-top: 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fbfbfb;
}

.profile-description-heading {
    margin: 0 0 8px;
    color: #444;
    font-size: 14px;
    font-weight: 800;
}

.profile-description-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.profile-description-editor {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border-light);
}

.profile-description-edit-trigger {
    width: fit-content;
    color: #355070;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.profile-description-edit-trigger:hover {
    text-decoration: underline;
}

.profile-description-form {
    margin: 10px 0 0;
}

.profile-description-input {
    width: 100%;
    min-height: 96px;
    resize: vertical;
}

.profile-description-help {
    margin: 6px 0 0;
    color: var(--color-muted);
    font-size: 12px;
}

.profile-description-actions {
    margin-top: 10px;
    text-align: right;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.profile-stat {
    display: block;
    padding: 17px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: #fafafa;
    text-align: center;
}

.profile-stat-link:hover,
.profile-stat-link:focus-visible {
    background: #f4f4f4;
    border-color: var(--color-control-border);
    text-decoration: none;
}

.profile-stat-link:hover .profile-stat-label,
.profile-stat-link:focus-visible .profile-stat-label {
    text-decoration: underline;
}

.profile-stat-value {
    margin-bottom: 6px;
    color: var(--color-strong);
    font-size: 25px;
    font-weight: 900;
    line-height: 1;
}

.profile-stat-label {
    color: var(--color-muted);
    font-size: 13px;
}

.profile-result-section {
    margin-top: 14px;
}

.profile-result-title {
    margin: 0 0 8px;
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 800;
}

.profile-result-stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.profile-result-stats li {
    min-width: 0;
}

.profile-result-stat {
    display: flex;
    height: 100%;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    text-align: center;
}

.profile-result-stat strong {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 900;
}

.profile-result-value {
    color: inherit;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.profile-problem-count {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.profile-problem-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.profile-problem-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-panel);
    background: #fbfbfb;
    color: var(--color-text);
}

.profile-problem-item:hover {
    background: #f4f4f4;
    text-decoration: none;
}

.profile-problem-id {
    color: #355070;
    font-weight: 900;
    text-align: center;
}

.profile-problem-title {
    color: var(--color-strong);
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
}

.profile-history-back,
.profile-history-page-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 6px;
    font-weight: 800;
}

.profile-history-back {
    max-width: 100%;
    margin-bottom: 8px;
    color: var(--color-muted);
}

.profile-history-back > span:first-child {
    flex: 0 0 auto;
}

.profile-history-back > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.profile-history-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--color-border-light);
}

.profile-history-heading h1 {
    margin: 0;
    font-size: 22px;
}

.profile-history-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 9px;
    border-top: 1px solid var(--color-border-light);
}

.profile-history-pagination .profile-history-page-link:last-child {
    margin-left: auto;
}

/* Profile language section */

.profile-content {
    padding-top: 14px;
    min-width: 0;
}

.profile-language-content {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

#language-title {
    scroll-margin-top: 24px;
}

.profile-language-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    padding: 6px 0 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--color-border-light);
}

.profile-language-chart {
    position: relative;
    flex: 0 1 180px;
    width: 180px;
    max-width: 100%;
    margin-inline: auto;
    aspect-ratio: 1;
}

.profile-language-chart svg {
    display: block;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.profile-language-track,
.profile-language-slice {
    fill: none;
    stroke-width: 12;
}

.profile-language-track { stroke: var(--color-border-light); }
.profile-language-slice { stroke: var(--language-color); }
.profile-language-summary [data-color="0"] { --language-color: #355070; }
.profile-language-summary [data-color="1"] { --language-color: #637e5b; }
.profile-language-summary [data-color="2"] { --language-color: #a56b37; }
.profile-language-summary [data-color="3"] { --language-color: #7c6894; }
.profile-language-summary [data-color="4"] { --language-color: #397c83; }
.profile-language-summary [data-color="5"] { --language-color: #ab6070; }
.profile-language-summary [data-color="6"] { --language-color: #867b43; }
.profile-language-summary [data-color="7"] { --language-color: #64748b; }

.profile-language-total {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 35px;
    text-align: center;
}

.profile-language-total strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 25px;
    font-variant-numeric: tabular-nums;
}

.profile-language-total span,
.profile-language-note {
    color: var(--color-muted);
    font-size: 13px;
}

.profile-language-breakdown { flex: 1 1 300px; min-width: 0; }
.profile-language-breakdown h3 { margin: 0 0 10px; font-size: 15px; }
.profile-language-note { margin: 12px 0 0; }
.profile-language-legend { list-style: none; margin: 0; padding: 0; }

.profile-language-legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto 56px;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
}

.profile-language-key { width: 10px; height: 10px; border-radius: 50%; background: var(--language-color); }
.profile-language-label { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.profile-language-count,
.profile-language-share { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.profile-language-table-wrap {
    overflow-x: auto;
    contain: paint;
}

.profile-language-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #fff;
}

.profile-language-table th,
.profile-language-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--color-border-light);
    text-align: right;
    white-space: nowrap;
}

.table-scroll > .profile-language-table th,
.table-scroll > .profile-language-table td {
    display: table-cell;
    width: auto;
}

.profile-language-table td {
    font-variant-numeric: tabular-nums;
}

.profile-language-table .verdict {
    min-width: 54px;
}

.profile-language-table th:not(.verdict) {
    background: var(--color-table-head);
    color: var(--color-strong);
}

.profile-language-table th {
    font-size: 13px;
    font-weight: 900;
}

.profile-language-table th:first-child,
.profile-language-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    background: #fff;
    box-shadow: 1px 0 0 var(--color-border-light);
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

.profile-language-table thead th:first-child {
    z-index: 2;
    background: var(--color-table-head);
}

.profile-language-table tbody th {
    background: #fff;
    font-size: 15px;
}

.profile-language-table tbody tr:hover th,
.profile-language-table tbody tr:hover td:not(.verdict) {
    background: #fafafa;
}

.profile-language-name {
    color: var(--color-strong);
    font-weight: 900;
}

/* Shared verdict surface. Unknown/missing codes intentionally remain neutral. */
.status,
.verdict,
.info-table .verdict {
    --verdict-text: #475569;
    --verdict-background: #F1F5F9;
    color: var(--verdict-text);
    background: var(--verdict-background);
}

.verdict[data-verdict="AC"],
.status-accepted {
    --verdict-text: #15803D;
    --verdict-background: #DCFCE7;
}

.verdict[data-verdict="WA"],
.status-wrong_answer {
    --verdict-text: #B91C1C;
    --verdict-background: #FEE2E2;
}

.verdict[data-verdict="TLE"],
.status-time_limit_exceeded {
    --verdict-text: #C2410C;
    --verdict-background: #FFEDD5;
}

.verdict[data-verdict="MLE"],
.status-memory_limit_exceeded {
    --verdict-text: #9333EA;
    --verdict-background: #F3E8FF;
}

.verdict[data-verdict="RTE"],
.status-runtime_error {
    --verdict-text: #BE185D;
    --verdict-background: #FCE7F3;
}

.verdict[data-verdict="CE"],
.status-compile_error {
    --verdict-text: #1D4ED8;
    --verdict-background: #DBEAFE;
}

.verdict[data-verdict="SE"],
.status-system_error {
    --verdict-text: #475569;
    --verdict-background: #F1F5F9;
}

/* Dense result rows use the table surface; text still comes from the shared palette. */
.status.submission-status {
    background: transparent;
}

.status-waiting,
.status-running {
    --verdict-text: var(--color-pending);
    --verdict-background: transparent;
}

/* Responsive */

@media (max-width: 800px) {
    .home-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-actions {
        width: 100%;
        flex-direction: column;
    }

    .home-stats {
        grid-template-columns: 1fr;
    }

    .problem-limit {
        flex-direction: column;
        gap: 6px;
    }

    .submission-table {
        font-size: 13px;
    }

    .submission-table th,
    .submission-table td {
        padding: 8px 6px;
    }

    .submission-meta {
        grid-template-columns: 1fr;
    }

    .profile-card,
    .profile-problem-card {
        max-width: none;
    }

    .profile-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-result-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}

/* Problem filter */

.problem-filter-panel {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: #fafafa;
}

.problem-filter-summary {
    color: var(--color-strong);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.problem-filter-form {
    margin-top: 14px;
}

.problem-title-search {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}

.problem-title-search label {
    flex: 1;
    min-width: 0;
}

.problem-title-search input,
.problem-filter-row select {
    width: 100%;
}

.problem-filter-panel[open] .problem-filter-summary {
    margin-bottom: 14px;
}

.problem-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.problem-filter-row label,
.problem-title-search label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #444;
    font-size: 14px;
    font-weight: 800;
}

.problem-state-options,
.problem-sort-direction,
.problem-property-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.problem-state-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7em), 1fr));
    align-self: start;
}

.problem-sort-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.problem-sort-controls > label {
    flex-basis: 100%;
}

.problem-sort-controls select {
    width: auto;
    flex: 1 1 110px;
}

.problem-state-options legend,
.problem-property-options legend,
.problem-sort-controls > label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 800;
}

.problem-state-options label,
.problem-sort-direction label,
.problem-property-options label {
    flex-direction: row;
    align-items: center;
    cursor: pointer;
}

.problem-state-options:disabled label {
    color: var(--color-muted);
    cursor: default;
}

.problem-state-options label {
    min-height: var(--control-height);
    justify-content: center;
    padding: 6px 10px;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
}

.problem-state-options label:has(input:checked) {
    background: var(--color-code-bg);
    border-color: var(--color-primary);
}

.problem-sort-direction {
    margin: 0;
}

.problem-property-options {
    margin-bottom: 14px;
}

.problem-filter-row .problem-search-input {
    width: 100%;
}

.problem-difficulty-filter {
    margin-top: 8px;
}

.problem-filter-label {
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
    font-weight: 800;
}

.problem-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

@media (max-width: 800px) {
    .problem-filter-row {
        grid-template-columns: 1fr;
    }

    .difficulty-check-grid {
        gap: 6px;
    }
}

/* Ranking */

.ranking-card {
    max-width: 1100px;
    margin: 0 auto;
}

.ranking-card .source-title-row {
    margin-bottom: 16px;
}

.ranking-card .contributor-description {
    margin-bottom: 22px;
}

.ranking-table-wrap {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}

.ranking-table th,
.ranking-table td {
    padding: 13px 10px;
    vertical-align: middle;
    white-space: nowrap;
    font-size: 14px;
}

.ranking-table th {
    background: var(--color-table-head);
    color: var(--color-strong);
    font-size: 14px;
    font-weight: 900;
}

.ranking-table tbody tr:hover td {
    background: #fafafa;
}

.ranking-table th:nth-child(1),
.ranking-table td:nth-child(1) {
    width: 58px;
    text-align: right;
}

.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2) {
    width: 190px;
    text-align: left;
}

.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3) {
    width: auto;
    min-width: 320px;
    text-align: left;
}

.ranking-table th:nth-child(4),
.ranking-table td:nth-child(4) {
    width: 92px;
    text-align: right;
}

.ranking-table th:nth-child(5),
.ranking-table td:nth-child(5) {
    width: 78px;
    text-align: right;
}

.ranking-table th:nth-child(6),
.ranking-table td:nth-child(6) {
    width: 78px;
    text-align: right;
}

.ranking-table th:nth-child(7),
.ranking-table td:nth-child(7) {
    width: 92px;
    text-align: right;
}

.ranking-rank {
    color: var(--color-strong);
    font-size: 20px;
    font-weight: 900;
}

.ranking-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    color: var(--color-strong);
    font-weight: 900;
}

.ranking-user:hover {
    text-decoration: none;
}

.ranking-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #111;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.ranking-status-message {
    overflow: hidden;
    color: #4b5563;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

.ranking-solved {
    color: var(--color-link);
    font-weight: 900;
}

.ranking-table td:nth-child(5),
.ranking-table td:nth-child(6),
.ranking-table td:nth-child(7) {
    color: var(--color-strong);
    font-variant-numeric: tabular-nums;
}

.ranking-table td:nth-child(7) {
    font-size: 14px;
}

@media (max-width: 800px) {
    .ranking-table {
        min-width: 760px;
    }

    .ranking-table th,
    .ranking-table td {
        padding: 11px 8px;
        font-size: 13px;
    }

    .ranking-table th:nth-child(1),
    .ranking-table td:nth-child(1) {
        width: 50px;
    }

    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2) {
        width: 160px;
    }

    .ranking-table th:nth-child(3),
    .ranking-table td:nth-child(3) {
        min-width: 220px;
    }

    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4) {
        width: 80px;
    }

    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5),
    .ranking-table th:nth-child(6),
    .ranking-table td:nth-child(6) {
        width: 66px;
    }

    .ranking-table th:nth-child(7),
    .ranking-table td:nth-child(7) {
        width: 82px;
    }

    .ranking-avatar {
        width: 30px;
        height: 30px;
    }
}

.submit-card #sourceCode {
    min-height: 430px;
}

.problem-center {
    margin: 16px 0 18px;
    text-align: center;
}

.problem-center code {
    margin: 0 auto;
}

.problem-list {
    margin: 10px 0 18px 24px;
    padding: 0;
    line-height: 1.75;
}

.problem-list li {
    margin: 5px 0;
}

.submit-card .form-row {
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.submit-card .form-row label {
    min-width: 42px;
    width: 42px;
    font-weight: 900;
}

.submit-card .language-picker {
    width: 220px;
    min-width: 220px;
}

.submit-card .language-search {
    width: 220px;
}

.pagination .pagination-page {
    min-width: 34px;
    padding: 6px 9px;
    text-align: center;
}

.pagination .pagination-page.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
    font-weight: 800;
}

.pagination .pagination-page.active:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

.pagination-ellipsis {
    padding: 0 3px;
    color: var(--color-muted);
}

/* Operational observations reuse cards/actions; long release IDs wrap on narrow screens. */
.operations-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.operations-topline { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; margin-bottom: 18px; }
.operations-topline > .card { margin: 0; }
.operations-page h2 { margin-top: 0; }
.operations-page .operations-alert h3 { margin: 0; }
.operations-metrics dt { color: var(--color-muted); }
.operations-metrics dd { margin: 8px 0 0; font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.operations-value { font-weight: 700; }
.operations-overview { border-left: 4px solid var(--color-muted); }
.operations-overview[data-state="NORMAL"] { border-left-color: #15803d; }
.operations-overview[data-state="DELAYED"] { border-left-color: #a55b00; }
.operations-overview[data-state="INTERRUPTED"] { border-left-color: #b91c1c; }
.operations-disclosure > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.operations-disclosure > .card { border: 0; padding: 16px 0 0; margin: 0; }
.operations-page time, .operations-page .notice { overflow-wrap: anywhere; }

.operations-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
    gap: 16px 24px;
}

.operations-summary dt {
    color: var(--color-muted);
    margin-bottom: 4px;
}

.operations-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.operations-worker + .operations-worker,
.operations-alert + .operations-alert {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
