/* PHOJ UI foundation: one semantic palette, readable rich text, passive feedback.
   Owns paint only. Never changes layout, fonts, source/editor metrics, sprites,
   verdict colors, permissions, content or native form/navigation behavior. */
html.ph8670-ui {
  --ph8670-canvas:#f5f7fb; --ph8670-surface:#fff; --ph8670-soft:#f2f6fb;
  --ph8670-raised:#f8fafd; --ph8670-edge:#d8e2ee; --ph8670-ink:#24384f;
  --ph8670-muted:#5b6f86; --ph8670-heading:#203c5b; --ph8670-gold:#946b2e;
  --ph8670-link:#235fa5; --ph8670-focus:#357cc9; --ph8670-code-bg:#f3f6fa;
  --ph8670-code-ink:#23384f; --ph8670-success:#227255; --ph8670-warning:#855b22; --ph8670-danger:#a93d4d;
  --ph8670-shadow:0 4px 10px #16345408,0 12px 28px #1634540d;
}
html.theme--dark.ph8670-ui {
  color-scheme:dark;
  --ph8670-canvas:#11151c; --ph8670-surface:#1a202a; --ph8670-soft:#222b36;
  --ph8670-raised:#283442; --ph8670-edge:#3c4a5b; --ph8670-ink:#e3e8ef;
  --ph8670-muted:#b2bdcc; --ph8670-heading:#e5c78f; --ph8670-gold:#e5c78f;
  --ph8670-link:#a9cdfb; --ph8670-focus:#daba80; --ph8670-code-bg:#151c26;
  --ph8670-code-ink:#e5edf7; --ph8670-success:#9ad9ba; --ph8670-warning:#edcc8a; --ph8670-danger:#f1aeb8;
  --ph8670-shadow:0 4px 10px #0000001a,0 12px 28px #00000029;
  --ph844-page:var(--ph8670-canvas); --ph844-panel:var(--ph8670-surface);
  --ph844-raised:var(--ph8670-soft); --ph844-border:var(--ph8670-edge);
  --ph844-text:var(--ph8670-ink); --ph844-muted:var(--ph8670-muted); --ph844-link:var(--ph8670-link);
  --ph8550-focus:var(--ph8670-focus); --ph8550-hover:var(--ph8670-soft);
  --ph8550-press:var(--ph8670-raised); --ph8550-shadow:var(--ph8670-shadow);
}
/* Component aliases are set at their owners, not by repainting descendants. */
html.theme--dark.ph8670-ui.ph8550-design-system .ph8540-browse {
  --pb-ink:var(--ph8670-ink); --pb-muted:var(--ph8670-muted); --pb-line:var(--ph8670-edge);
  --pb-surface:var(--ph8670-surface); --pb-soft:var(--ph8670-soft);
  --pb-accent:var(--ph8670-link); --pb-heading:var(--ph8670-heading); --pb-hero:var(--ph8670-soft);
  --pb-green:var(--ph8670-success); --pb-green-soft:#213a31; --pb-shadow:var(--ph8670-shadow);
}
html.theme--dark.ph8670-ui.ph8550-design-system .ph8560-profile {
  --pp-bg:var(--ph8670-surface); --pp-soft:var(--ph8670-soft); --pp-line:var(--ph8670-edge);
  --pp-text:var(--ph8670-ink); --pp-muted:var(--ph8670-muted); --pp-blue:var(--ph8670-link);
  --pp-gold:var(--ph8670-heading); --pp-shadow:var(--ph8670-shadow);
}
html.theme--dark.ph8670-ui.ph8550-design-system .ph8550-contest-workspace {
  --pc-ink:var(--ph8670-ink); --pc-muted:var(--ph8670-muted); --pc-line:var(--ph8670-edge);
  --pc-surface:var(--ph8670-surface); --pc-soft:var(--ph8670-soft); --pc-accent:var(--ph8670-link);
}
html.theme--dark.ph8670-ui.ph8550-design-system .ph8520-training {
  --ph8520-ink:var(--ph8670-heading); --ph8520-muted:var(--ph8670-muted);
  --ph8520-border:var(--ph8670-edge); --ph8520-fill:var(--ph8670-soft); --ph8520-accent:var(--ph8670-link);
}
html.theme--dark.ph8670-ui.ph8550-design-system .ph8530-contest-manager {
  --cm-ink:var(--ph8670-ink); --cm-title:var(--ph8670-heading); --cm-muted:var(--ph8670-muted);
  --cm-line:var(--ph8670-edge); --cm-surface:var(--ph8670-surface); --cm-fill:var(--ph8670-soft);
  --cm-accent:var(--ph8670-link); --cm-accent-fill:var(--ph8670-raised);
}
html.theme--dark.ph8670-ui.ph8550-design-system :is(.ph8503-contest-hub,.ph8503-contest-manager) {
  --ph8503-ink:var(--ph8670-ink); --ph8503-muted:var(--ph8670-muted); --ph8503-line:var(--ph8670-edge);
  --ph8503-surface:var(--ph8670-surface); --ph8503-soft:var(--ph8670-soft);
  --ph8503-blue:var(--ph8670-link); --ph8503-gold:var(--ph8670-heading);
}
html.theme--dark.ph8670-ui.ph8570-economy {
  --ph8570-bg:var(--ph8670-surface); --ph8570-soft:var(--ph8670-soft);
  --ph8570-line:var(--ph8670-edge); --ph8570-text:var(--ph8670-ink);
  --ph8570-muted:var(--ph8670-muted); --ph8570-blue:var(--ph8670-link); --ph8570-gold:var(--ph8670-heading);
}
/* Native shell and surfaces; no blanket descendant color/font rule. */
html.theme--dark.ph8670-ui.ph8550-design-system body,
html.theme--dark.ph8670-ui.ph8550-design-system body :is(#panel,.main) {
  background:var(--ph8670-canvas)!important; color:var(--ph8670-ink)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body :is(.section,.section.side,.section__body,.dialog__content,.dropdown-target.menu,.tether-drop-content) {
  background-color:var(--ph8670-surface)!important; border-color:var(--ph8670-edge)!important; color:var(--ph8670-ink)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body :is(.section__header,.section__footer) {
  background-color:var(--ph8670-surface)!important; border-color:var(--ph8670-edge)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body :is(.nav.ph84944-nav,.header--mobile,.footer) {
  background:var(--ph8670-surface)!important; border-color:var(--ph8670-edge)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .nav.ph84944-nav :is(.ph84944-nav-main,.ph84944-nav-secondary,.nav__list) { background-color:transparent!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body :is(.section__title,.problem-content h1,.problem-content h2,.problem-content h3,.problem-content h4) { color:var(--ph8670-heading)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body :is(.section__body.typo,.problem-content,.editor-preview,.editor-preview-side) {
  background-color:var(--ph8670-surface)!important; color:var(--ph8670-ink)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.supplementary,.section__header .supplementary) { color:var(--ph8670-muted)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .menu__link:not(.danger):not(.warning):not(.success) { color:var(--ph8670-ink)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .menu__link:not(.disabled):hover { background-color:var(--ph8670-soft)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .menu__link:is(.active,.is-active,.highlight,[aria-current=page]) {
  background:var(--ph8670-soft)!important; color:var(--ph8670-link)!important;
  box-shadow:inset 3px 0 var(--ph8670-focus);
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main blockquote.note {
  background:var(--ph8670-soft)!important; color:var(--ph8670-ink)!important; border-color:var(--ph8670-edge)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main blockquote.note::before,
html.theme--dark.ph8670-ui.ph8550-design-system body .main blockquote.note a { color:var(--ph8670-link)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .ph8500-settings-page .ph8501-online-shortcut {
  background:color-mix(in srgb,var(--ph8670-success) 12%,var(--ph8670-surface))!important;
  color:var(--ph8670-success)!important; border-color:color-mix(in srgb,var(--ph8670-success) 40%,var(--ph8670-edge))!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.data-table,.ph8550-native-table) :is(th,td) {
  background-color:var(--ph8670-surface)!important; border-color:var(--ph8670-edge)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.data-table,.ph8550-native-table) th { background-color:var(--ph8670-soft)!important; color:var(--ph8670-muted)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.data-table,.ph8550-native-table) tbody tr:hover>td { background-color:var(--ph8670-soft)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.richmedia) table :is(th,td):not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *)) {
  background-color:var(--ph8670-surface)!important; border-color:var(--ph8670-edge)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.richmedia) table th:not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *)) { background-color:var(--ph8670-soft)!important; }
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.richmedia) blockquote {
  background:var(--ph8670-soft)!important; border-color:var(--ph8670-edge)!important; color:var(--ph8670-ink)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]),textarea,select):not(:is(.monaco-editor *,.monaco-diff-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,.ph846-submit-editor *,.ph84933-code-editor *,.ph84934-code-native-source,[data-ph84933-input],.ph8412-submit-code-input,.ph8412-submit-code-stage *,[name=code],[name=source],[data-ph-no-theme],[data-ph-no-theme] *)) {
  background-color:var(--ph8670-soft)!important; border-color:var(--ph8670-edge)!important; color:var(--ph8670-ink)!important;
}
/* Rich text: neutral inline code; one continuous pre surface in every layout.
   Prism token colors, real source editors and KaTeX remain independent. */
html.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.richmedia,.markdown-body,.editor-preview,.editor-preview-side) pre:not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,.ph846-submit-editor *,.ph84933-code-editor *,.ph8412-submit-code-stage *,[data-ph-no-theme] *)) {
  background:var(--ph8670-code-bg)!important; color:var(--ph8670-code-ink)!important;
  border-color:var(--ph8670-edge)!important; text-shadow:none!important;
}
html.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.richmedia,.markdown-body,.editor-preview,.editor-preview-side) pre>code:not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,[data-ph-no-theme] *)) {
  background:transparent!important; color:inherit!important; text-shadow:none!important; box-shadow:none!important;
}
html.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.richmedia,.markdown-body) code:not(:is(pre code,.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,.katex *,.MathJax *,mjx-container *,[data-ph-no-theme] *)) {
  background-color:var(--ph8670-soft)!important; color:var(--ph8670-link)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main :is(.problem-content,.typo,.editor-preview,.editor-preview-side) .sample {
  background:var(--ph8670-surface)!important; color:var(--ph8670-ink)!important; border-color:var(--ph8670-edge)!important;
}
html.theme--dark.ph8670-ui.ph8550-design-system body .main .ph84960-sample-copy {
  background:var(--ph8670-soft)!important; color:var(--ph8670-ink)!important; border-color:var(--ph8670-edge)!important;
}
html.ph8670-ui.ph8550-design-system body .main .ph84960-sample-copy.is-copied { color:var(--ph8670-success)!important; border-color:var(--ph8670-success)!important; }
html.ph8670-ui.ph8550-design-system body .main .ph84960-sample-copy.is-error { color:var(--ph8670-danger)!important; border-color:var(--ph8670-danger)!important; }
/* Shared interaction language, all destinations. No injected spans or handlers.
   Sprite/text effects on configurable navbar slots are intentionally untouched. */
html.ph8670-ui.ph8550-design-system body :is(.main,.dialog,.dropdown,.footer)
  :is(.button,button:not(.star):not(.star-toggle),.menu__link,summary,[role=button]):not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,[data-ph-no-feedback],[data-ph-no-feedback] *)) {
  transition-property:background-color,border-color,box-shadow,color,opacity,transform!important;
  transition-duration:180ms!important; transition-timing-function:cubic-bezier(.2,.7,.2,1)!important;
}
html.ph8670-ui.ph8550-design-system body :is(.main,.dialog,.dropdown,.footer)
  :is(a,button,input,select,textarea,summary,[role=button]):focus-visible:not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,[data-ph-no-feedback] *)) {
  outline:2px solid var(--ph8670-focus)!important; outline-offset:3px;
}
html.ph8670-ui.ph8550-design-system body .main :is(.button,button:not(.star):not(.star-toggle)):active:not(:disabled):not([aria-disabled=true]):not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,[data-ph-no-feedback] *)) {
  transform:translateY(1px); box-shadow:inset 0 2px 5px #00000020!important;
}
html.ph8670-ui.ph8550-design-system body :is(.ph8540-training-card,.ph8540-group-card,.ph8540-continue-card,.ph8540-subgroup-card,.ph8540-live-card,.ph8600-learning-card,.ph8570-currency-card,.ph8640-mail-row) {
  transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;
}
@media(hover:hover) and (pointer:fine) {
  html.ph8670-ui.ph8550-design-system body .main :is(.button,button:not(.star):not(.star-toggle)):hover:not(:active):not(:disabled):not([aria-disabled=true]):not(:is(.monaco-editor *,.CodeMirror *,.cm-editor *,.ace_editor *,[data-ph-no-feedback] *)) {
    box-shadow:0 0 0 2px color-mix(in srgb,var(--ph8670-focus) 14%,transparent),var(--ph8670-shadow);
  }
  html.ph8670-ui.ph8550-design-system body :is(.ph8540-training-card,.ph8540-group-card,.ph8540-continue-card,.ph8540-subgroup-card,.ph8540-live-card,.ph8600-learning-card,.ph8570-currency-card,.ph8640-mail-row):hover {
    transform:translateY(-2px); box-shadow:var(--ph8670-shadow);
  }
}
html.ph8670-ui.ph8550-design-system body .ph8550-click-ring {
  border-color:var(--ph8670-focus); background:color-mix(in srgb,var(--ph8670-focus) 10%,transparent);
  box-shadow:0 0 0 4px color-mix(in srgb,var(--ph8670-focus) 7%,transparent);
}
@media(prefers-reduced-motion:reduce) {
  html.ph8670-ui.ph8550-design-system body :is(.main,.dialog,.dropdown,.footer)
    :is(.button,button,.menu__link,summary,[role=button],.ph8540-training-card,.ph8540-group-card,.ph8540-continue-card,.ph8540-subgroup-card,.ph8540-live-card,.ph8600-learning-card,.ph8570-currency-card,.ph8640-mail-row) {
    transition:none!important; animation:none!important;
  }
}


/* Shared interaction polish: compositor motion, no geometry/font changes. */
html.ph-polish-ready {
  --ph-polish-ease:cubic-bezier(.2,.75,.25,1);
  --ph-polish-gold:var(--ph8670-gold,#b78a42);
  --ph-polish-focus:var(--ph8670-focus,#357cc9);
}
html.ph-polish-ready :where(.button,.ph8600-button,.ph8560-action,.ph-dock-button,.ph-footer-choice>summary) {
  transition:background-color .18s ease,border-color .18s ease,box-shadow .22s var(--ph-polish-ease),filter .16s ease;
  -webkit-tap-highlight-color:transparent;
}
html.ph-polish-ready :where(.button,.ph8600-button,.ph8560-action,.ph-dock-button):focus-visible {
  outline:2px solid var(--ph-polish-focus);outline-offset:3px;
}
html.ph-polish-ready :where(.button,.ph8600-button,.ph8560-action,.ph-dock-button):active:not(:disabled):not([aria-disabled="true"]) {
  filter:brightness(1.06);
}
.ph8550-click-ring.ph-polish-ring {
  position:fixed;z-index:10020;pointer-events:none;width:30px;height:30px;
  margin:0;border:1px solid #dab568;border-radius:50%;background:radial-gradient(circle,#f8dda550,transparent 64%);
  box-shadow:0 0 16px #d4af6d35;animation:ph-polish-ring .5s var(--ph-polish-ease) both;
}
.ph8550-click-ring.ph-polish-ring::after {
  content:"";position:absolute;inset:8px;border:1px solid #e9cc8f80;border-radius:2px;transform:rotate(45deg);
}
@keyframes ph-polish-ring {
  from{opacity:.85;transform:translate(-50%,-50%) scale(.25)}
  to{opacity:0;transform:translate(-50%,-50%) scale(2.1)}
}
.ph-polish-aura {
  position:fixed;z-index:40;pointer-events:none;box-sizing:border-box;
  border:1px solid #d7b776;background:none;box-shadow:0 0 14px #d9b97528;
  animation:ph-polish-aura .72s ease-out both;
}
@supports (mask-composite:exclude) {
  .ph-polish-aura {
    border-color:transparent;
    background:linear-gradient(115deg,#d6b36910 12%,#ffe6a8 31%,#87d1c8 49%,#d6b36920 70%) border-box;
    background-size:280% 100%;
    mask:linear-gradient(#000 0 0) padding-box,linear-gradient(#000 0 0);
    mask-composite:exclude;
  }
}
@keyframes ph-polish-aura {
  0%{opacity:0;background-position:100% 50%}
  18%{opacity:.95}
  100%{opacity:0;background-position:0 50%}
}
@media (hover:hover) and (pointer:fine) {
  html.ph-polish-ready.ph-atmosphere-motion :where(.ph8600-learning-card,.ph8600-shortcuts>a,.ph8600-item-slot:not(.is-empty)) {
    transition:translate .24s var(--ph-polish-ease),box-shadow .24s var(--ph-polish-ease),border-color .2s ease;
  }
  html.ph-polish-ready.ph-atmosphere-motion :where(.ph8600-learning-card,.ph8600-shortcuts>a):hover {translate:0 -3px}
  html.ph-polish-ready.ph-atmosphere-motion .ph8600-item-slot:not(.is-empty):hover {translate:0 -2px}
  html.ph-polish-ready.ph-atmosphere-motion .ph-dock-button svg {transition:rotate .22s var(--ph-polish-ease),filter .22s ease}
  html.ph-polish-ready.ph-atmosphere-motion .ph-dock-button:hover svg {rotate:-5deg;filter:drop-shadow(0 0 3px #e4c38480)}
}
/* Native disclosure remains usable in browsers without intrinsic-size motion. */
@supports (interpolate-size:allow-keywords) {
  html.ph-polish-ready.ph-atmosphere-motion :where(.ph8540-my-paths,.ph8540-archive-more,.ph8560-topics-toggle)::details-content {
    interpolate-size:allow-keywords;block-size:0;overflow:clip;
    transition:block-size .28s var(--ph-polish-ease),content-visibility .28s allow-discrete;
  }
  html.ph-polish-ready.ph-atmosphere-motion :where(.ph8540-my-paths,.ph8540-archive-more,.ph8560-topics-toggle)[open]::details-content {block-size:auto}
}
/* Off-tab animation does no useful work. Foreground functional state is intact. */
html[data-ph-motion-paused="true"] *,
html[data-ph-motion-paused="true"] *::before,
html[data-ph-motion-paused="true"] *::after {animation-play-state:paused!important}
@media (prefers-reduced-motion:reduce) {
  html.ph-polish-ready :where(.button,.ph8600-button,.ph8560-action,.ph-dock-button,.ph-footer-choice>summary,.ph8600-learning-card,.ph8600-item-slot) {transition:none!important;translate:none!important}
  .ph8550-click-ring.ph-polish-ring,.ph-polish-aura {display:none!important;animation:none!important}
}
