: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-primary: #444444;
    --color-primary-hover: #222222;

    --color-accepted: #009b72;
    --color-error: #e03131;
    --color-warning: #e67700;
    --color-purple: #7048e8;
    --color-pending: #8a6d3b;
    --color-system: #666666;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: Arial, "Noto Sans KR", sans-serif;
    font-size: 15px;
}

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

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

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

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

.page-title {
    margin: 0 0 18px;
    font-size: 26px;
}

.empty {
    padding: 40px 0;
    text-align: center;
    color: #777;
}

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

/* 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;
    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;
    align-items: center;
    gap: 20px;
}

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

.nav a {
    color: var(--color-muted);
    padding-bottom: 4px;
}

.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;
}

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

.login-button {
    padding: 7px 11px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    color: var(--color-text);
    font-weight: 800;
}

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

.user-link {
    color: var(--color-strong);
    font-weight: 800;
}

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

.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 {
    padding: 6px 9px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    color: var(--color-muted);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

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

/* Buttons */

.button-primary,
.button-primary-link,
.button-secondary-link {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

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

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

.button-secondary-link {
    border: 1px solid var(--color-border);
    background: #f8f9fa;
    color: #222;
}

.button-secondary-link:hover {
    background: #e9ecef;
    color: #111;
    text-decoration: none;
}

.button-secondary-link:disabled,
button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Common form */

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

.form-row label {
    min-width: 90px;
    font-weight: 800;
}

.form-help {
    margin: 6px 0 0;
    color: #777;
    font-size: 13px;
    line-height: 1.5;
}

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

input,
select,
textarea {
    border: 1px solid #ccc;
    border-radius: 5px;
}

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

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

.request-small-select {
    min-width: 150px;
}

.code-input {
    width: 100%;
    min-height: 360px;
    padding: 12px;
    resize: vertical;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.5;
}

.submit-actions {
    margin-top: 12px;
    text-align: right;
}

/* 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;
}

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

.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: 32px;
}

.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: 6px;
    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;
}

/* Problem list */

.problem-title {
    font-weight: 700;
}

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

.col-solved {
    width: 56px;
    text-align: center;
}

.col-tags {
    width: 500px;
}

.solved-mark {
    color: var(--color-accepted);
    font-weight: 900;
    font-size: 16px;
}

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

.problem-search-input {
    width: 320px;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    font-size: 14px;
}

.problem-difficulty-select {
    width: 180px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    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 {
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 18px;
    margin-bottom: 22px;
}

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

.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: 28px 0;
}

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

.problem-text {
    line-height: 1.75;
    font-size: 16px;
    word-break: keep-all;
}

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

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

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

.sample-block {
    margin-bottom: 24px;
}

.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 {
    margin: 0 0 16px;
    padding: 12px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-x: auto;
}

.copy-button {
    flex-shrink: 0;
    padding: 4px 9px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #ffffff;
    color: #444;
    font-size: 12px;
    cursor: pointer;
}

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

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

/* Submission */

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

.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;
}

.col-lang {
    width: 100px;
}

.col-status {
    width: 160px;
}

.col-time {
    width: 100px;
}

.col-memory {
    width: 120px;
}

.col-len {
    width: 100px;
}

.col-created {
    width: 180px;
}

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

.status-accepted {
    color: var(--color-accepted);
}

.status-wrong_answer,
.status-runtime_error,
.status-compile_error,
.status-time_limit_exceeded,
.status-memory_limit_exceeded {
    color: var(--color-error);
}

.status-waiting,
.status-running {
    color: var(--color-pending);
}

.status-system_error {
    color: var(--color-system);
}

.submission-detail-card {
    margin-bottom: 18px;
}

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

.submission-meta > div {
    padding: 10px 12px;
    background: #fafafa;
    border: 1px solid var(--color-border-light);
    border-radius: 5px;
}

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

.submission-meta a {
    color: #1f4f7a;
    font-weight: 800;
    line-height: 1.4;
    text-decoration: none;
}

.source-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;
}

.source-title-row h1,
.source-title-row h2 {
    margin: 0;
}

.source-code {
    margin: 0;
    padding: 14px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    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;
    align-items: center;
    gap: 8px;
}

@media (max-width: 700px) {
    .source-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .submission-page-actions {
        width: 100%;
    }

    .submission-page-actions .button-secondary-link {
        width: 100%;
        text-align: center;
    }
}

/* CodeMirror */

.CodeMirror {
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.5;
}

.CodeMirror-focused {
    border-color: #999;
}

.CodeMirror-gutters {
    background: #f7f7f7;
    border-right: 1px solid #ddd;
}

.CodeMirror-linenumber {
    color: #999;
}

.cm-keyword {
    color: #444;
    font-weight: 800;
}

.cm-def,
.cm-variable {
    color: #222;
}

.cm-string {
    color: #7a3e3e;
}

.cm-number {
    color: #5c5c5c;
}

.cm-comment {
    color: #888;
    font-style: italic;
}

.cm-operator {
    color: #333;
}

.CodeMirror-activeline-background {
    background: #f1f1f1;
}

.CodeMirror-matchingbracket {
    color: #111 !important;
    font-weight: 800;
    text-decoration: underline;
}

/* Pagination */

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

.pagination a {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    color: #444;
}

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

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

/* Tabs */

.tab-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-menu a {
    padding: 7px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    color: #444;
}

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

.tab-menu a.active {
    background: #111;
    color: #fff;
    border-color: #111;
}

/* 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 {
    margin-bottom: 18px;
}

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

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

/* Info / Contributor */

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

.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-card {
    max-width: 820px;
    margin: 0 auto;
}

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

.contributor-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contributor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: #fafafa;
}

.contributor-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--color-strong);
}

.contributor-role {
    margin-top: 4px;
    color: var(--color-muted);
    font-size: 14px;
}

.contributor-count {
    flex-shrink: 0;
    color: var(--color-muted);
    font-size: 14px;
    text-align: right;
}

.contributor-count span {
    color: var(--color-strong);
    font-weight: 800;
}

.contributor-guide-card {
    margin-top: 18px;
}

.contributor-guide-card > p {
    color: #444;
    line-height: 1.7;
}

.contributor-guide-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.contributor-guide-step {
    padding: 14px 16px;
    border: 1px solid #dedede;
    border-radius: 10px;
    background: #fafafa;
}

.contributor-guide-step strong {
    display: block;
    margin-bottom: 7px;
    font-size: 15px;
}

.contributor-guide-step p {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

.contributor-guide-actions {
    margin-top: 14px;
}

.contributor-table .col-problem-count {
    width: 130px;
    min-width: 130px;
    white-space: nowrap;
    text-align: center;
}

/* Language picker */

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

.language-search {
    width: 220px;
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    font-size: 14px;
}

.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: 5px;
    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;
}

/* Notice */

.notice-box {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    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;
}

/* Problem request / admin review */

.request-admin-section {
    margin-top: 26px;
}

.request-admin-section h2 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 22px;
}

.request-review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.request-review-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: #fafafa;
}

.request-review-grid strong {
    color: var(--color-muted);
}

.request-test-toolbar {
    display: flex;
    gap: 8px;
    margin: 18px 0 12px;
}

.request-hidden-field {
    display: none;
}

.request-reject-form {
    margin-top: 12px;
}

.request-admin-message {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    resize: vertical;
}

/* Polygon-style tests */

.polygon-test-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.polygon-test-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 13px 15px;
    border: 1px solid #dedede;
    border-radius: 10px;
    background: #fafafa;
}

.polygon-test-row:hover {
    background: #f5f5f5;
    border-color: #cfcfcf;
}

.polygon-test-no {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #eeeeee;
    color: #333;
    font-weight: 900;
}

.polygon-test-main {
    min-width: 0;
}

.polygon-test-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.polygon-test-title-row strong {
    font-size: 15px;
}

.test-sample-badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border: 1px solid #d5d5d5;
    border-radius: 999px;
    background: #ffffff;
    color: #666;
    font-size: 12px;
    font-weight: 800;
}

.test-sample-badge.sample {
    border-color: #9bd8aa;
    background: #effaf2;
    color: #23743a;
}

.polygon-test-content {
    overflow: hidden;
    color: #666;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.polygon-test-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.polygon-test-actions form {
    margin: 0;
}

.polygon-test-actions .button-secondary-link {
    min-width: 52px;
    padding: 8px 10px;
    text-align: center;
}

/* Modal */

.request-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.42);
}

.request-modal-backdrop[hidden] {
    display: none;
}

.request-modal {
    width: min(760px, 100%);
    max-height: min(760px, 90vh);
    overflow: auto;
    padding: 20px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.request-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.request-modal-header h3 {
    margin: 0;
    font-size: 22px;
}

.request-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: var(--color-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.request-modal-close:hover {
    background: #f0f0f0;
    color: var(--color-strong);
}

.request-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* Statement editor / preview */

.statement-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.statement-header-row h2 {
    margin: 0;
    font-size: 24px;
}

.statement-view-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.statement-view-actions .button-secondary-link {
    width: auto;
    min-width: 98px;
    padding: 10px 15px;
    text-align: center;
}

.statement-view-actions .active {
    background: #333;
    color: #fff;
    border-color: #333;
}

.statement-editor h3 {
    margin: 18px 0 8px;
    font-size: 17px;
}

.statement-textarea {
    width: 100%;
    min-height: 130px;
    height: 170px;
    padding: 14px;
    resize: vertical;
    line-height: 1.6;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
}

.statement-textarea.statement-main {
    min-height: 180px;
    height: 240px;
}

.statement-preview {
    max-width: 900px;
    margin: 0 auto;
    padding: 22px 26px;
    border: 1px solid #dedede;
    border-radius: 10px;
    background: #fff;
}

.statement-preview-section + .statement-preview-section {
    margin-top: 30px;
}

.statement-preview-section h3 {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eeeeee;
    color: var(--color-strong);
    font-size: 23px;
    font-weight: 900;
}

.statement-preview-content {
    color: #111;
    font-size: 16px;
    line-height: 1.85;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.statement-preview-content p {
    margin: 0 0 16px;
}

.statement-preview-content ul {
    margin: 10px 0 16px 24px;
    padding: 0;
}

.statement-preview-content li {
    margin: 5px 0;
}

.statement-preview-content code {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 5px;
    background: #f1f3f5;
    color: #111;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.88em;
    line-height: 1.45;
    vertical-align: baseline;
}

.statement-preview-content .center-block {
    margin: 14px 0 16px;
    text-align: center;
}

.statement-preview-content .center-block p {
    margin-bottom: 8px;
}

.statement-preview-content .empty {
    color: #777;
}

.admin-statement-raw pre {
    overflow: auto;
    max-height: 280px;
    padding: 14px;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fafafa;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
}

.admin-file-modal {
    width: min(920px, 100%);
}

.admin-test-file-content {
    overflow: auto;
    max-height: 60vh;
    padding: 14px;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fafafa;
    white-space: pre;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.45;
}

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

@media (max-width: 700px) {
    .statement-header-row {
        align-items: stretch;
        flex-direction: column;
    }

    .statement-view-actions {
        width: 100%;
    }

    .statement-view-actions .button-secondary-link {
        flex: 1;
        min-width: 0;
    }

    .statement-preview {
        padding: 18px 16px;
    }

    .statement-preview-content {
        font-size: 15px;
        line-height: 1.8;
    }
}

/* User profile */

.profile-card {
    max-width: 820px;
    margin: 0 auto 20px;
    padding: 22px 26px 20px;
}

.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;
}

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

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

.profile-tabs {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 24px;
    border-bottom: 1px solid var(--color-border);
}

.profile-tab {
    position: relative;
    top: 1px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    color: var(--color-muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.profile-tab:hover {
    background: #f7f7f7;
    color: var(--color-strong);
    text-decoration: none;
}

.profile-tab.active {
    background: var(--color-card);
    border-color: var(--color-border);
    color: var(--color-strong);
}

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

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

.profile-description-label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
    font-weight: 800;
}

.profile-description-input {
    width: 100%;
    min-height: 96px;
    padding: 12px;
    border: 1px solid #d6d6d6;
    border-radius: 6px;
    background: #fff;
    resize: vertical;
    line-height: 1.6;
    font-size: 14px;
}

.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: 7px;
    background: #fafafa;
    text-align: center;
}

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

.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-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.profile-result-stat {
    padding: 12px 8px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: #fbfbfb;
    text-align: center;
}

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

.profile-result-stat span {
    color: var(--color-strong);
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.profile-result-stat.accepted strong {
    color: var(--color-accepted);
}

.profile-result-stat.wrong strong,
.profile-result-stat.ce strong {
    color: var(--color-error);
}

.profile-result-stat.tle strong,
.profile-result-stat.mle strong {
    color: var(--color-warning);
}

.profile-result-stat.rte strong {
    color: var(--color-purple);
}

.profile-problem-card {
    max-width: 820px;
    margin: 0 auto 18px;
    padding: 20px;
}

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

.profile-problem-list {
    display: flex;
    flex-direction: column;
    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: 7px;
    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 {
    overflow: hidden;
    color: var(--color-strong);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile language page */

.profile-language-card {
    max-width: 920px;
    margin: 0 auto 20px;
    padding: 22px;
}

.profile-language-card h2 {
    margin: 0 0 16px;
    font-size: 24px;
}

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

.profile-language-table {
    width: 100%;
    min-width: 820px;
    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;
}

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

.profile-language-table th:first-child,
.profile-language-table td:first-child {
    text-align: left;
}

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

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

.boj-style-language-table .accepted-col {
    color: var(--color-accepted);
    font-weight: 800;
}

.boj-style-language-table .wrong-col,
.boj-style-language-table .ce-col {
    color: var(--color-error);
}

.boj-style-language-table .tle-col,
.boj-style-language-table .mle-col {
    color: var(--color-warning);
}

.boj-style-language-table .rte-col {
    color: var(--color-purple);
}

/* Responsive */

@media (max-width: 900px) {
    .request-review-grid {
        grid-template-columns: 1fr;
    }
}

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

    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .nav,
    .auth-area {
        flex-wrap: wrap;
    }

    .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,
    .profile-language-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));
    }

    .profile-tabs {
        justify-content: flex-start;
    }

    .contributor-guide-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .polygon-test-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .polygon-test-actions {
        grid-column: 2;
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .container {
        padding: 18px 12px;
    }

    .card {
        padding: 16px;
    }

    .page-title {
        font-size: 23px;
    }

    .problem-title-main {
        font-size: 25px;
    }

    .problem-search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .problem-search-input,
    .problem-difficulty-select {
        width: 100%;
    }

    .info-table th,
    .info-table td {
        display: block;
        width: 100%;
    }

    .info-table th {
        border-bottom: 0;
    }

    .error-card {
        margin: 32px auto;
        padding: 32px 22px;
    }

    .error-code {
        font-size: 56px;
    }

    .error-title {
        font-size: 24px;
    }

    .error-actions {
        flex-direction: column;
    }

    .button-primary-link,
    .button-secondary-link {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 560px) {
    .profile-card {
        padding: 18px;
    }

    .profile-header {
        align-items: flex-start;
    }

    .profile-avatar {
        width: 58px;
        height: 58px;
    }

    .profile-title {
        font-size: 22px;
    }

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

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

    .profile-problem-item {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .profile-problem-item .difficulty {
        grid-column: 2;
        justify-self: start;
    }
}

/* Problem request editor */

.request-editor-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.request-editor-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: #444;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.request-editor-tabs a:hover {
    background: #f5f5f5;
    color: #111;
    text-decoration: none;
}

.request-editor-tabs a.active {
    background: #111;
    border-color: #111;
    color: #fff;
}

.request-editor-tabs + .contributor-description {
    margin: 0 0 22px;
    padding: 12px 14px;
    border: 1px solid var(--color-border-light);
    border-radius: 7px;
    background: #fafafa;
    color: #555;
    font-size: 14px;
}

.card > form > h2,
.card > section > h2 {
    margin: 0 0 18px;
    font-size: 24px;
}

.card > form > h3,
.card > section > h3 {
    margin: 20px 0 8px;
    font-size: 17px;
}

.card > form .form-row {
    max-width: 920px;
}

.card > form .form-row input:not([type="checkbox"]),
.card > form .form-row select {
    min-width: 210px;
}

.card > form .form-row .form-help {
    margin: 0;
    color: #667085;
    font-size: 13px;
}

@media (max-width: 700px) {
    .request-editor-tabs {
        gap: 5px;
    }

    .request-editor-tabs a {
        flex: 1 1 auto;
        padding: 8px 10px;
        font-size: 13px;
    }

    .card > form .form-row {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
    }

    .card > form .form-row label {
        min-width: 0;
    }

    .card > form .form-row input:not([type="checkbox"]),
    .card > form .form-row select {
        width: 100%;
        min-width: 0;
    }
}

/* Problem filter */

.problem-filter-panel {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    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-filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

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

.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;
}

.difficulty-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.difficulty-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.difficulty-check:hover {
    background: #f1f3f5;
}

.difficulty-check input {
    width: 14px;
    height: 14px;
    margin: 0;
    padding: 0;
}

.difficulty-check:has(input:checked) {
    border-color: #333;
    background: #333;
    color: #fff;
}

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

.problem-filter-actions .button-primary {
    padding: 8px 16px;
}

@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: 14px;
}

.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: #1f4f7a;
    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;
    }
}

/* Problem detail polish */

.problem-card {
    padding: 28px 30px;
}

.problem-header {
    margin-bottom: 28px;
    padding-bottom: 22px;
}

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

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

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

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

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

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

.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 language row spacing */

.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;
}