/* Shared palette for the catalog and contest room. */
:is(.ph-catalog-v6,.ph-cp){--cat-card:#fffdfa;--cat-soft:#f7f5ef;--cat-ink:#263449;--cat-muted:#586374;--cat-line:#e0d9cb;--cat-gold:#866128;--cat-teal:#216b5f;--cat-tint:#eaf5ef;--cat-shadow:0 3px 12px #2835460d}
html.theme--dark :is(.ph-catalog-v6,.ph-cp){--cat-card:#202a36;--cat-soft:#273342;--cat-ink:#f3e9d7;--cat-muted:#c0c7d1;--cat-line:#455367;--cat-gold:#efc886;--cat-teal:#a2e2ca;--cat-tint:#203d3b;--cat-shadow:0 3px 14px #0002}

/* Attempt history and contest workspace notice. */
.ph-exam-history{--rpg-paper:#fffaf0;--rpg-paper-soft:#f5eddd;--rpg-paper-raised:#fffdf7;--rpg-line:#d9c9a9;--rpg-ink:#51422f;--rpg-muted:#796b55;--rpg-heading:#624923;--rpg-link:#276c73;--rpg-metal:#b28c4e;--rpg-button:linear-gradient(#ead298,#d0ae65 55%,#b88f45);--ph8670-surface:var(--rpg-paper);--ph8670-soft:var(--rpg-paper-soft);--ph8670-ink:var(--rpg-ink);--ph8670-muted:var(--rpg-muted);--ph8670-edge:var(--rpg-line);--ph8670-heading:var(--rpg-heading);--ph8670-link:var(--rpg-link)}
html.theme--dark .ph-exam-history{--rpg-paper:#232a32;--rpg-paper-soft:#2a323c;--rpg-paper-raised:#1c252f;--rpg-line:#5e5645;--rpg-ink:#e4d8c2;--rpg-muted:#beb39d;--rpg-heading:#edcf94;--rpg-link:#9bcfc7;--rpg-metal:#a98c56;--rpg-button:linear-gradient(#cdb071,#b79752 55%,#9d7c3d)}
/* Read-only history uses ordinary paper panels, never live record sockets. */
.ph-exam-history{max-width:1180px;margin:0 auto}
.ph-history-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:12px 0 24px}
html body .ph-history-heading h1{font-size:28px;line-height:1.4;color:var(--rpg-heading);margin:7px 0}
.ph-history-heading p{margin:0;color:var(--rpg-muted);font-size:13px;overflow-wrap:anywhere}
.ph-history-heading>a{flex-shrink:0}
html body .ph-exam-history .ph8540-button{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:40px;max-width:100%;padding:9px 13px;border:1px solid var(--rpg-line);border-radius:6px;background:var(--rpg-paper-raised);color:var(--rpg-link)!important;font-size:12px;font-weight:700;line-height:1.5;white-space:normal}
.ph-exam-history .ph8540-button .ph8540-icon{display:block;width:19px;height:19px;flex:0 0 19px}
.ph-exam-history :is(a,summary):focus-visible,.ph-exam-history [tabindex]:focus-visible{outline:2px solid var(--rpg-link);outline-offset:3px}
.ph-run-notice{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 18px;margin:16px 0 20px;border:1px solid var(--rpg-line,#b8cadd);border-left:3px solid var(--rpg-link,#477a86);border-radius:6px;background:var(--rpg-paper,#f4f8fc);color:var(--rpg-ink,#29425b)}
.ph-run-notice>div{display:flex;align-items:center;gap:12px;min-width:0}
.ph-run-notice .ph8540-icon{width:23px;height:23px;flex-shrink:0;color:var(--rpg-link,#477a86)}
.ph-run-notice p{display:grid;gap:4px;margin:0;font-size:11px;line-height:1.65}
.ph-run-notice strong{font-size:12px}
.ph-run-notice> a{display:flex;align-items:center;gap:7px;flex-shrink:0;font-size:11px;font-weight:700;color:var(--rpg-link,#426780)!important}
.ph-run-notice>a .ph8540-icon{width:16px;height:16px}
.ph-history-layout{display:grid;grid-template-columns:260px minmax(0,1fr);gap:22px;align-items:start}
.ph-history-runs,.ph-history-records{min-width:0;border:1px solid var(--rpg-line);border-radius:9px;background:var(--rpg-paper);overflow:hidden;box-shadow:0 5px 18px #10233a06}
.ph-history-runs>h2{padding:17px 16px;margin:0;font-size:15px;color:var(--rpg-heading);border-bottom:1px solid var(--rpg-line)}
.ph-history-runs>a{display:flex;align-items:center;gap:9px;min-height:66px;padding:12px 15px;border-left:3px solid transparent;border-bottom:1px solid var(--rpg-line);color:var(--rpg-ink)!important}
.ph-history-runs>a[aria-current]{border-left-color:var(--rpg-link);background:var(--rpg-paper-soft)}
.ph-history-runs>a>.ph8540-icon{width:21px;height:21px;flex-shrink:0;color:var(--rpg-link)}
.ph-history-runs>a>span{display:grid;gap:6px;flex:1;min-width:0;font-size:12px}
.ph-history-runs small{font-size:10px;color:var(--rpg-muted);line-height:1.6}
.ph-history-runs>a>b{color:var(--rpg-heading);font-size:18px}
.ph-history-section-title{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap;padding:20px;border-bottom:1px solid var(--rpg-line)}
.ph-history-section-title h2{font-size:19px;color:var(--rpg-heading);margin:5px 0 0}
.ph-history-section-title>span{font-size:11px;color:var(--rpg-muted)}
.ph-history-table-wrap{overflow:auto}
.ph-history-table{width:100%;border-collapse:collapse;font-size:12px;color:var(--rpg-ink)}
.ph-history-table :is(th,td){padding:14px 13px;text-align:left;border-bottom:1px solid var(--rpg-line);vertical-align:middle;line-height:1.6}
.ph-history-table th{font-size:10px;background:var(--rpg-paper-soft);white-space:nowrap;color:var(--rpg-muted)}
.ph-history-table td:first-child{min-width:210px}
.ph-history-table td:not(:first-child){white-space:nowrap}
.ph-history-table td>a{display:grid;gap:3px;color:var(--rpg-link)!important}
.ph-history-table small{font-size:9px;color:var(--rpg-muted);overflow-wrap:anywhere}
.ph-history-empty{padding:42px 24px;text-align:center;max-width:520px;margin:auto}
.ph-history-empty>.ph8540-icon{width:40px;height:40px;color:var(--rpg-link);margin-bottom:13px}
.ph-history-empty h3{font-size:18px;color:var(--rpg-heading)}
.ph-history-empty p{font-size:12px;line-height:1.8;color:var(--rpg-muted);margin:12px 0 20px}
.ph-history-pages{display:flex;align-items:center;justify-content:center;gap:18px;flex-wrap:wrap;padding:16px;font-size:12px;color:var(--rpg-muted)}
.ph-history-pages a{min-height:38px;padding:9px;border:1px solid var(--rpg-line);border-radius:5px;color:var(--rpg-link)!important}
.ph-history-code{margin-top:22px}
.ph-history-code>pre{margin:0;border-radius:0;max-height:700px;overflow:auto}
.ph-history-code>p{padding:20px;color:var(--rpg-muted)}
.ph-history-code .toolbar{top:8px;right:10px;opacity:1}
.ph-history-code .toolbar-item>a{display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:5px 11px;border:1px solid #61758f;border-radius:5px;background:#253449;color:#e6effb;font-size:11px;line-height:1.4;box-shadow:0 2px 5px #0003;text-decoration:none}
.ph-history-revisions{padding:15px 20px;border-bottom:1px solid var(--rpg-line);color:var(--rpg-link);font-size:12px}
.ph-history-revisions a{display:block;padding:8px 0}
.ph-exam-history .section{margin-bottom:0;box-shadow:none;border:0}
.ph-exam-history #status>.section__header{display:none}
.ph-exam-history #status,.ph-exam-history #status .section__body{background:var(--rpg-paper);color:var(--rpg-ink)}
.ph-exam-history #status .ph8610-result-metrics{background:var(--rpg-line);border-color:var(--rpg-line)}
.ph-exam-history #status .ph8610-result-metrics>div{background:var(--rpg-paper-soft)}
.ph-exam-history #status .ph8610-result-metrics span,.ph-exam-history #status .ph8610-test-results>summary b{color:var(--rpg-muted)}
.ph-exam-history #status .ph8610-result-metrics strong,.ph-exam-history #status .ph8610-test-results>summary{color:var(--rpg-heading)}
.ph-exam-history #status .record_detail__table{width:100%;min-width:510px;background:var(--rpg-paper);color:var(--rpg-ink);font-size:11px}
.ph-exam-history #status .record_detail__table :is(th,td){padding:12px 14px;border-color:var(--rpg-line)}
.ph-exam-history #status .record_detail__table :is(th,.subtask td){background:var(--rpg-paper-soft)}
.ph8550-contest-workspace .ph8496-attempt-active{display:none}

@media(max-width:900px){.ph-history-layout{grid-template-columns:210px minmax(0,1fr)}}
@media(max-width:680px){.ph-exam-history{width:calc(100% - 24px)}.ph-history-layout{grid-template-columns:1fr}.ph-history-runs{max-height:300px;overflow:auto}.ph-history-heading{align-items:flex-start;flex-direction:column}.ph-history-heading h1{font-size:23px!important}.ph-run-notice{align-items:flex-start;flex-direction:column;gap:12px}.ph-history-section-title{padding:16px}.ph-history-code>pre{max-height:500px}}
