* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Malgun Gothic", Arial, sans-serif;
    background: #fff;
    color: #202124;
}
main {
    max-width: 980px;
    margin: 0 auto;
    padding: 48px 28px 80px;
}
h1 { margin: 0; font-size: 30px; }
.subtitle { margin: 8px 0 34px; color: #6b7280; font-size: 14px; }
h2 { margin: 30px 0 10px; font-size: 17px; }
p, li { font-size: 14px; line-height: 1.7; }
.back { margin: 0 0 24px; font-size: 14px; }
a { color: #1f4f8a; text-decoration: none; }
a:hover { text-decoration: underline; }

.list {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    border-top: 1px solid #d8dbe2;
    border-bottom: 1px solid #d8dbe2;
}
.list th, .list td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #eceef2;
    font-size: 14px;
}
.list th { background: #f7f7f8; color: #4b5563; font-weight: 600; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: #f5f8fc; }
.num { width: 10%; }
.name { width: 32%; }
.category { width: 28%; color: #5f6368; }
.level { width: 15%; color: #5f6368; }
.status { width: 15%; color: #5f6368; }
.note {
    margin-top: 24px;
    border-left: 3px solid #c8ccd4;
    padding: 2px 0 2px 14px;
    color: #5f6368;
}

/* IDE-style problem workspace */
.practice-workspace {
    background: #f4f5f7;
    min-height: 100vh;
}
.workspace-topbar {
    height: 46px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 18px;
    border-bottom: 1px solid #d8dbe2;
    background: #fff;
    font-size: 13px;
}
.workspace-topbar a { color: #334155; }
.workspace-brand { font-weight: 700; }
#top-meta { margin-left: auto; color: #6b7280; }

.workspace {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(320px, 38%) 1fr;
    min-height: calc(100vh - 46px);
}
.problem-pane {
    background: #fff;
    border-right: 1px solid #d8dbe2;
    padding: 30px 32px 60px;
    overflow-y: auto;
}
.problem-pane h1 { font-size: 26px; }
.problem-pane .subtitle { margin-bottom: 18px; }
.problem-pane h2 { font-size: 15px; margin-top: 28px; }
.problem-meta {
    margin: 16px 0 24px;
    border-top: 1px solid #e2e5ea;
    border-bottom: 1px solid #e2e5ea;
    padding: 9px 0;
    color: #6b7280;
    font-size: 13px;
}
pre.example {
    margin: 8px 0 16px;
    padding: 10px 12px;
    background: #f7f7f8;
    border: 1px solid #e2e5ea;
    overflow-x: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
}

.editor-pane {
    min-width: 0;
    background: #1e1f22;
    color: #e8eaed;
    padding: 0 0 28px;
    overflow: hidden;
}
.file-tab {
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: #26282d;
    border-bottom: 1px solid #363940;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}
.editor-wrap {
    border-bottom: 1px solid #363940;
}
.CodeMirror {
    height: 390px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.55;
}
.CodeMirror-gutters {
    border-right: 1px solid #363940;
}
.panel-title {
    height: 34px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: #26282d;
    border-top: 1px solid #363940;
    border-bottom: 1px solid #363940;
    color: #cbd5e1;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}
.stdin-box {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border: 0;
    border-bottom: 1px solid #363940;
    padding: 11px 14px;
    background: #1e1f22;
    color: #f8fafc;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    outline: none;
}
.toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: #26282d;
    border-bottom: 1px solid #363940;
}
button {
    border: 1px solid #555b66;
    background: #33363d;
    color: #f1f5f9;
    padding: 7px 14px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
button:hover { background: #3d4149; }
button.primary { background: #2d6cdf; border-color: #2d6cdf; }
button.primary:hover { background: #245fc8; }
button:disabled { opacity: .45; cursor: default; }
.console {
    min-height: 92px;
    white-space: pre-wrap;
    padding: 12px 14px;
    background: #151619;
    color: #d7dae0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
}
.judge-console {
    min-height: 90px;
    padding: 0;
    background: #151619;
    color: #d7dae0;
}
.judge-summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #34373d;
}
.judge-summary span {
    color: #9ca3af;
    font-family: "Malgun Gothic", Arial, sans-serif;
    font-size: 12px;
}
.judge-score { font-size: 14px; }
.judge-list { display: block; }
.judge-item {
    border-bottom: 1px solid #2d3036;
}
.judge-item:last-child { border-bottom: 0; }
.judge-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    font-family: "Malgun Gothic", Arial, sans-serif;
    font-size: 13px;
}
.judge-item.is-fail .judge-item-head {
    background: #21191a;
}
.judge-details {
    padding: 4px 14px 12px;
    background: #191a1e;
}
.judge-detail-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    align-items: start;
    padding: 4px 0;
}
.judge-detail-label {
    color: #8b949e;
    font-family: "Malgun Gothic", Arial, sans-serif;
    font-size: 12px;
}
.judge-detail-row code {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #e6edf3;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
}
.pass-text { color: #7ee787; }
.fail-text { color: #ff7b72; }
.expected-value { color: #a5d6ff !important; }
.actual-value { color: #ffa198 !important; }

@media (max-width: 820px) {
    .workspace { grid-template-columns: 1fr; }
    .problem-pane { border-right: 0; border-bottom: 1px solid #d8dbe2; }
    .CodeMirror { height: 320px; }
}
@media (max-width: 640px) {
    main:not(.workspace) { padding: 32px 16px 56px; }
    .category, .status { display: none; }
    .num { width: 14%; }
    .name { width: 56%; }
    .level { width: 30%; }
    .workspace-topbar { gap: 10px; padding: 0 12px; }
    #top-meta { display: none; }
    .problem-pane { padding: 24px 18px 40px; }
}
.trace-guide {
    margin-top: 24px;
    padding: 12px 14px;
    border-left: 3px solid #8b949e;
    background: #f7f7f8;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.6;
}
.trace-mode .CodeMirror {
    background: #1b1c1f;
}
.trace-answers {
    background: #1e1f22;
}
.trace-answer-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #34373d;
}
.trace-answer-row:last-child { border-bottom: 0; }
.trace-question-number {
    color: #8b949e;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    padding-top: 3px;
}
.trace-question-body {
    display: block;
}
.trace-question-prompt {
    display: block;
    margin-bottom: 8px;
    color: #d7dae0;
    font-family: "Malgun Gothic", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.55;
}
.trace-answer-input {
    width: 100%;
    border: 1px solid #555b66;
    background: #151619;
    color: #f8fafc;
    padding: 8px 10px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    outline: none;
}
.trace-answer-input:focus { border-color: #7aa2f7; }
.trace-answer-input.is-correct { border-color: #3fb950; }
.trace-answer-input.is-wrong { border-color: #f85149; }

.problem-nav {
    display: flex;
    gap: 12px;
    margin-left: 6px;
}
.problem-nav a {
    color: #475569;
}
.rule-note {
    margin-top: 14px;
    padding: 10px 12px;
    border-left: 3px solid #94a3b8;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
}
.hint-box {
    margin-top: 22px;
    border-top: 1px solid #e2e5ea;
    padding-top: 10px;
}
.hint-box p {
    margin: 8px 0;
    padding: 9px 11px;
    background: #f7f7f8;
    border-left: 3px solid #c4b5fd;
    color: #374151;
    font-size: 13px;
}
@media (max-width: 640px) {
    .problem-nav {
        margin-left: auto;
    }
    .workspace-brand {
        display: none;
    }
}
