@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

#powerRankingsView {
    --pr-bg: #17191b;
    --pr-panel: #202326;
    --pr-panel-raised: #292d30;
    --pr-line: rgba(222, 177, 80, .19);
    --pr-gold: #d5ad60;
    --pr-gold-bright: #f1d18b;
    --pr-muted: #a6a8a7;
    --pr-ink: #f0ede5;
    --pr-red: #d88979;
    --pr-green: #9bc49a;
    color: var(--pr-ink);
    font-family: 'Manrope', sans-serif;
    padding: 28px 22px 72px;
    min-height: 70vh;
}

#powerRankingsView * { box-sizing: border-box; }
#powerRankingsView button,
#powerRankingsView select { font: inherit; }
#powerRankingsView button { cursor: pointer; }

.pr-shell { max-width: 1200px; margin: 0 auto; }
.pr-masthead {
    display: flex; align-items: end; justify-content: space-between; gap: 24px;
    border-bottom: 1px solid var(--pr-line); padding: 8px 0 24px; margin-bottom: 24px;
}
.pr-kicker, .pr-eyebrow {
    color: var(--pr-gold); font: 500 11px 'DM Mono', monospace;
    letter-spacing: .16em; text-transform: uppercase;
}
.pr-title { font-size: clamp(34px, 5vw, 60px); line-height: .99; letter-spacing: -.055em; margin: 10px 0 9px; font-weight: 700; }
.pr-intro { color: var(--pr-muted); max-width: 620px; line-height: 1.6; margin: 0; font-size: 14px; }
.pr-picker { min-width: 210px; display: grid; gap: 8px; }
.pr-picker label { color: var(--pr-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .11em; }
.pr-select {
    appearance: none; background: #25282a; color: var(--pr-ink); border: 1px solid rgba(213,173,96,.45);
    border-radius: 5px; padding: 12px 38px 12px 13px; width: 100%;
    background-image: linear-gradient(45deg, transparent 50%, var(--pr-gold) 50%), linear-gradient(135deg, var(--pr-gold) 50%, transparent 50%);
    background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat;
}
.pr-progress { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin: 20px 0 30px; }
.pr-progress-unit { border: 1px solid var(--pr-line); background: rgba(31,34,36,.75); padding: 14px 16px; border-radius: 5px; }
.pr-progress-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 12px; }
.pr-progress-head strong { font-size: 13px; font-weight: 700; }
.pr-progress-head span { color: var(--pr-gold-bright); font: 12px 'DM Mono', monospace; }
.pr-progress-track { background: #101213; border-radius: 9px; height: 4px; margin-top: 11px; overflow: hidden; }
.pr-progress-fill { width: var(--progress); height: 100%; background: var(--pr-gold); border-radius: inherit; transition: transform .28s ease; transform-origin: left; }
.pr-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.pr-rail { border: 1px solid var(--pr-line); background: rgba(27,29,31,.86); border-radius: 6px; padding: 16px 12px; position: sticky; top: 14px; }
.pr-rail-title { font: 500 10px 'DM Mono', monospace; color: var(--pr-muted); text-transform: uppercase; letter-spacing: .14em; padding: 2px 8px 12px; }
.pr-round {
    width: 100%; border: 1px solid transparent; background: transparent; color: var(--pr-ink);
    display: flex; text-align: left; align-items: center; gap: 11px; padding: 11px 9px; border-radius: 4px;
    transition: background .18s ease, border-color .18s ease, transform .18s ease; margin: 2px 0;
}
.pr-round:hover:not(:disabled) { background: rgba(213,173,96,.08); transform: translateX(2px); }
.pr-round[aria-current="step"] { border-color: rgba(213,173,96,.5); background: rgba(213,173,96,.12); }
.pr-round:disabled { opacity: .42; cursor: not-allowed; }
.pr-round-index { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid #54504a; border-radius: 50%; color: var(--pr-gold); font: 11px 'DM Mono', monospace; flex: 0 0 26px; }
.pr-round-copy { flex: 1; }
.pr-round-copy strong { display: block; font-size: 12px; }
.pr-round-copy small { color: var(--pr-muted); font-size: 10px; display: block; margin-top: 2px; }
.pr-check { color: var(--pr-green); font-size: 12px; }
.pr-workspace { min-width: 0; }
.pr-panel { border: 1px solid var(--pr-line); border-radius: 6px; background: linear-gradient(145deg, rgba(37,40,42,.98), rgba(27,29,31,.98)); overflow: hidden; }
.pr-panel-head { padding: 20px 22px 16px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pr-panel-head h2 { font-size: 21px; margin: 6px 0 4px; letter-spacing: -.035em; }
.pr-panel-head p { margin: 0; color: var(--pr-muted); font-size: 12px; line-height: 1.5; }
.pr-status-pill { border: 1px solid rgba(213,173,96,.35); color: var(--pr-gold-bright); border-radius: 20px; font: 10px 'DM Mono',monospace; padding: 6px 9px; white-space: nowrap; }
.pr-card-list { padding: 8px 12px 4px; }
.pr-sort-hint { padding: 12px 22px 0; color: #9c9d9b; font-size: 11px; }
.pr-rank-card {
    position: relative; display: grid; grid-template-columns: 37px 36px 62px minmax(0,1fr); align-items: center;
    gap: 13px; min-height: 88px; border: 1px solid rgba(255,255,255,.08); background: #242729;
    padding: 10px 12px; margin: 8px 0; border-radius: 5px; transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.pr-rank-card:hover { border-color: rgba(213,173,96,.34); background: #292c2e; }
.pr-rank-card.is-dragging { opacity: .43; transform: scale(.985); }
.pr-rank-card.is-over { border-color: var(--pr-gold); }
.pr-rank-card.is-over::before { content: ''; position: absolute; top: -5px; left: 11px; right: 11px; height: 3px; background: var(--pr-gold-bright); border-radius: 2px; box-shadow: 0 0 0 3px rgba(213,173,96,.13); }
.pr-grip { color: #777b7c; cursor: grab; font: 16px 'DM Mono',monospace; user-select: none; text-align: center; }
.pr-grip:active { cursor: grabbing; }
.pr-rank-number { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(213,173,96,.36); color: var(--pr-gold-bright); border-radius: 50%; font: 13px 'DM Mono',monospace; }
.pr-art-frame { width: 62px; height: 66px; display: grid; place-items: center; position: relative; overflow: hidden; border-radius: 3px; background: #17191b; border: 1px solid rgba(255,255,255,.11); }
.pr-art { width: 100%; height: 100%; border-radius: 3px; object-fit: cover; background: #17191b; }
.pr-art-fallback { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #8e897c; font: 8px/1.4 'DM Mono',monospace; text-transform: uppercase; letter-spacing: .06em; }
.pr-art-fallback[hidden] { display: none; }
.pr-card-copy { min-width: 0; }
.pr-card-name { font-size: 13px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.pr-card-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; color: var(--pr-muted); font: 10px 'DM Mono',monospace; margin-top: 7px; }
.pr-card-meta b { color: #d2d0c8; font-weight: 400; }
.pr-card-controls { display: flex; gap: 5px; }
.pr-icon-btn {
    border: 1px solid rgba(255,255,255,.13); background: #1d2022; color: #d4d1c8; width: 32px; height: 32px; border-radius: 4px;
    display: grid; place-items: center; font-size: 15px; transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.pr-icon-btn:hover:not(:disabled), .pr-icon-btn:focus-visible { border-color: var(--pr-gold); color: var(--pr-gold-bright); background: #302c23; }
.pr-icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.pr-submit-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 15px 20px 19px; border-top: 1px solid rgba(255,255,255,.07); }
.pr-submit-note { color: var(--pr-muted); font-size: 11px; line-height: 1.45; }
.pr-primary {
    border: 1px solid #e7c77e; background: var(--pr-gold); color: #211d16; border-radius: 4px; padding: 11px 16px;
    font-size: 12px; font-weight: 800; transition: transform .16s ease, background .16s ease; white-space: nowrap;
}
.pr-primary:hover:not(:disabled) { transform: translateY(-1px); background: var(--pr-gold-bright); }
.pr-primary:disabled { opacity: .52; cursor: not-allowed; }
.pr-notice { border: 1px solid rgba(213,173,96,.26); background: rgba(213,173,96,.07); color: #ded4bc; padding: 12px 14px; font-size: 12px; border-radius: 4px; margin-bottom: 14px; line-height: 1.55; }
.pr-notice.error { border-color: rgba(216,137,121,.45); background: rgba(216,137,121,.09); color: #efc3b8; }
.pr-empty { text-align: center; border: 1px dashed rgba(213,173,96,.28); padding: 38px 20px; margin: 16px; border-radius: 5px; color: var(--pr-muted); }
.pr-empty strong { display: block; color: var(--pr-ink); margin-bottom: 8px; font-size: 14px; }
.pr-load-skeleton { height: 90px; margin: 9px 0; border-radius: 5px; background: linear-gradient(90deg,#25282a 25%,#2d3032 50%,#25282a 75%); background-size: 200% 100%; animation: pr-shimmer 1.4s ease-in-out infinite; }
@keyframes pr-shimmer { to { background-position: -200% 0; } }
.pr-results { margin-top: 28px; }
.pr-results-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 13px; gap: 15px; }
.pr-results-head h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.04em; }
.pr-result-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 3px 0 9px; scrollbar-width: thin; }
.pr-result-tab { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.12); background: #222527; color: #bbb9b2; padding: 9px 12px; border-radius: 4px; font-size: 11px; }
.pr-result-tab[aria-selected="true"] { color: var(--pr-gold-bright); border-color: rgba(213,173,96,.55); background: rgba(213,173,96,.1); }
.pr-result-panel { background: rgba(29,31,33,.94); border: 1px solid var(--pr-line); border-radius: 5px; padding: 16px; }
.pr-result-caption { color: var(--pr-muted); margin: 0 0 14px; font-size: 11px; }
.pr-comparison-list { display: grid; gap: 8px; }
.pr-compare-row { display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(125px, 1fr) minmax(150px,1.1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 4px; background: rgba(255,255,255,.018); }
.pr-compare-name { font-size: 12px; font-weight: 700; }
.pr-compare-owner { display: block; color: var(--pr-muted); font: 10px 'DM Mono',monospace; margin-top: 4px; }
.pr-stat { color: var(--pr-muted); font: 10px 'DM Mono',monospace; line-height: 1.8; }
.pr-stat b { color: var(--pr-ink); font-weight: 500; }
.pr-rank-bars { display: flex; align-items: center; gap: 3px; height: 24px; }
.pr-rank-bar { min-width: 4px; height: calc(5px + var(--bar-height)); background: rgba(213,173,96,.68); border-radius: 2px 2px 0 0; align-self: end; position: relative; }
.pr-rank-bar span { position: absolute; inset: auto 0 -13px; text-align: center; font: 8px 'DM Mono',monospace; color: #97958f; }
.pr-outlier { color: var(--pr-red); font: 10px 'DM Mono',monospace; text-align: right; }
.pr-consensus { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 9px; margin-bottom: 18px; }
.pr-consensus-card { border: 1px solid rgba(213,173,96,.2); background: #25282a; padding: 12px; border-radius: 4px; }
.pr-consensus-card strong { display: block; font-size: 12px; margin: 5px 0; }
.pr-consensus-card span { color: var(--pr-muted); font: 10px 'DM Mono',monospace; }
.pr-normalized-note { margin: 0 0 18px; padding: 11px 13px; border-left: 2px solid var(--pr-gold); background: rgba(213,173,96,.06); color: var(--pr-muted); font-size: 11px; line-height: 1.6; }
.pr-normalized-note strong { color: #e5d7b5; }
.pr-full-orders { margin-bottom: 22px; }
.pr-full-orders h3 { font-size: 15px; margin: 1px 0 5px; }
.pr-full-orders > p { margin: 0 0 11px; color: var(--pr-muted); font-size: 11px; }
.pr-orders-scroll { overflow: auto; border: 1px solid rgba(255,255,255,.09); border-radius: 4px; max-height: 560px; }
.pr-orders-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.pr-orders-table th, .pr-orders-table td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,.07); vertical-align: top; text-align: left; }
.pr-orders-table thead th { position: sticky; top: 0; z-index: 1; color: var(--pr-gold-bright); background: #25282a; font: 11px 'DM Mono',monospace; }
.pr-orders-table thead th:first-child, .pr-orders-table tbody th { width: 48px; text-align: center; color: var(--pr-muted); font: 10px 'DM Mono',monospace; }
.pr-orders-table td strong { display: block; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.pr-orders-table td small { display: block; color: var(--pr-muted); margin-top: 3px; font: 9px 'DM Mono',monospace; }
.pr-order-missing { color: #777; }
.pr-matrix-wrap { overflow-x: auto; }
.pr-matrix { border-collapse: collapse; min-width: 550px; width: 100%; font-size: 11px; }
.pr-matrix th, .pr-matrix td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: center; }
.pr-matrix th { color: var(--pr-muted); font-weight: 600; }
.pr-matrix th:first-child, .pr-matrix td:first-child { text-align: left; }
.pr-matrix td { color: #cbc7bb; }
.pr-matrix-mark { color: var(--pr-green); font-size: 15px; }
.pr-round-done { color: var(--pr-green); font-size: 11px; }
.pr-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
#powerRankingsView :focus-visible { outline: 2px solid var(--pr-gold-bright); outline-offset: 3px; }

@media (max-width: 780px) {
    #powerRankingsView { padding: 20px 14px 50px; }
    .pr-masthead { align-items: stretch; flex-direction: column; }
    .pr-picker { max-width: none; }
    .pr-layout { grid-template-columns: minmax(0, 1fr); }
    .pr-rail { position: static; padding: 12px; min-width: 0; }
    .pr-rail-title { padding-bottom: 8px; }
    .pr-rounds { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; max-width: 100%; }
    .pr-round { flex: 0 0 auto; width: auto; min-width: 145px; padding: 9px; }
    .pr-progress { grid-template-columns: 1fr; gap: 8px; }
    .pr-compare-row { grid-template-columns: minmax(100px,1fr) auto; gap: 8px; }
    .pr-compare-row .pr-rank-bars { grid-column: 1 / -1; grid-row: 2; }
    .pr-compare-row .pr-outlier { grid-column: 2; grid-row: 1; }
    .pr-compare-row .pr-stat { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .pr-title { font-size: 39px; }
    .pr-panel-head { padding: 16px 14px 13px; }
    .pr-panel-head h2 { font-size: 18px; }
    .pr-rank-card { grid-template-columns: 25px 35px 48px minmax(0,1fr); gap: 8px; padding: 8px; }
    .pr-grip { font-size: 13px; }
    .pr-rank-number { width: 28px; height: 28px; font-size: 11px; }
    .pr-art { width: 48px; height: 58px; }
    .pr-art-frame { width: 48px; height: 58px; }
    .pr-card-name { font-size: 11px; }
    .pr-card-meta { gap: 4px 8px; font-size: 9px; }
    .pr-card-controls { grid-column: 4; justify-content: flex-end; }
    .pr-icon-btn { width: 40px; height: 40px; }
    .pr-submit-row { align-items: stretch; flex-direction: column; padding: 13px 14px 15px; }
    .pr-primary { width: 100%; }
    .pr-sort-hint { padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    #powerRankingsView *, #powerRankingsView *::before, #powerRankingsView *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}