[data-faction="intruder"] { --insignia: url('./assets/gogh.svg'); --faction-ink: #dac2fa; }
[data-faction="defender"] { --insignia: url('./assets/monet.svg'); --faction-ink: #fff0d4; }
[data-faction]::before {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  margin-inline-end: .32em;
  background: var(--insignia) center/contain no-repeat;
  vertical-align: -.35em;
  content: '';
}
[data-faction] { color: var(--faction-ink); }
[data-title-insignia]::before {
  content: '';
  display:inline-block;
  width:1.35em;
  height:1.35em;
  margin-inline-end:.25em;
  vertical-align:-.29em;
  background:var(--faction-ink,#a6f2ec);
  mask:var(--title-mask) center / contain no-repeat;
}
[data-title-insignia="patrol"]{--title-mask:url('./assets/title-patrol.svg')}
[data-title-insignia="trace"]{--title-mask:url('./assets/title-trace.svg')}
[data-title-insignia="relay"]{--title-mask:url('./assets/title-relay.svg')}
[data-title-insignia="border"]{--title-mask:url('./assets/title-border.svg')}
[data-title-insignia="signal"]{--title-mask:url('./assets/title-signal.svg')}
[data-title-insignia="command"]{--title-mask:url('./assets/title-command.svg')}
[data-title-insignia="legacy"]{--title-mask:url('./assets/title-legacy.svg')}
button[data-faction] { white-space: nowrap; }
#kicker[data-faction]::before, #field-faction[data-faction]::before, #room-faction[data-faction]::before { width: 1.9em; height: 1.9em; vertical-align: -.55em; }

#app[data-side="intruder"] #world { border-top: 2px solid #755599; }
#app[data-side="defender"] #world { border-top: 2px solid #dfbb76; }
#field-faction[data-faction], #room-faction[data-faction] { color: var(--faction-ink); }
/* Keep each organization's name inside its emblem discernible on HOME. */
@media (orientation:portrait){
  :is(#home-panel,#practice-panel) .faction-preferences [data-faction]::before{width:3.6em;height:3.6em}
}
@media (orientation:landscape) and (max-height:450px){
  :is(#home-panel,#practice-panel) .faction-preferences [data-faction]::before{width:4em;height:4em}
}

/* HOME icons and layout use the existing allowlisted stylesheet. */
/* Small, labelled HOME icons: keep their buttons at accessible touch size. */
#wardrobe-toggle::before,#shop-wardrobe::before,#record-toggle::before,#account-toggle::before,#pose-toggle::before,#result-pose::before{
  content:'';display:inline-block;width:1.35em;height:1.35em;vertical-align:-.28em;margin-inline-end:.24em;background:center/contain no-repeat;
}
#wardrobe-toggle::before,#shop-wardrobe::before{background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYThkY2U3IiBzdHJva2Utd2lkdGg9IjEuOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNOS44IDYuM2EyLjIgMi4yIDAgMSAxIDQuNCAwYzAgMS4yLS43IDEuOC0yLjIgMi43djEuNCIvPjxwYXRoIGQ9Im0xMiAxMC40LTkgNS43Yy0uOS42LS41IDIuMS43IDIuMWgxNi42YzEuMiAwIDEuNi0xLjUuNy0yLjF6Ii8+PC9nPjwvc3ZnPgo=')}
#record-toggle::before{background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYThkY2U3IiBzdHJva2Utd2lkdGg9IjEuOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNNCAyMGgxNk02IDE3di01aDN2NU0xMSAxN1Y3aDN2MTBNMTYgMTdWNGgzdjEzIi8+PHBhdGggZD0ibTUgOCA0LTMgNCAxIDUtMyIvPjwvZz48L3N2Zz4K')}
#account-toggle::before{background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYThkY2U3IiBzdHJva2Utd2lkdGg9IjEuOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjgiIHI9IjMuNSIvPjxwYXRoIGQ9Ik01LjUgMTlhNi41IDYuNSAwIDAgMSAxMyAwIi8+PGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIG9wYWNpdHk9Ii43Ii8+PC9nPjwvc3ZnPgo=')}
#pose-toggle::before,#result-pose::before{background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYThkY2U3IiBzdHJva2Utd2lkdGg9IjEuOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjQuNCIgcj0iMi4xIi8+PHBhdGggZD0ibTcgOSA1LTEuNEwxNiA5bDMtM003IDkgNSAxM203LTUuNHY2LjdtMCAwLTMuNiA1LjhtMy42LTUuOCAzLjggNS44Ii8+PHBhdGggZD0iTTIwIDIuNXYyTTE5IDMuNWgyIiBvcGFjaXR5PSIuNyIvPjwvZz48L3N2Zz4K')}
#home-panel #wardrobe-toggle,#home-panel #record-toggle,#home-panel #account-toggle,#home-panel #pose-toggle,#result-pose{min-width:44px;min-height:44px}

/* Short portrait viewports reserve room for the 3D floor while keeping 44px targets. */
@media (orientation:portrait) and (max-height:740px){
 :is(#home-panel,#practice-panel) .faction-preferences [data-faction]::before{width:2em;height:2em}
}
/* The account label and icon fit narrow cells without clipping or shrinking the touch target. */
#home-panel #account-toggle::before{display:block;width:13px;height:13px;margin:0 auto 1px}

.operation-verdict {
  --verdict-accent: #c3d7ee;
  --verdict-glow: #91a9cc;
  --verdict-corner: 12px;
  color: #f8f6ff;
  clip-path: polygon(0 0,calc(100% - var(--verdict-corner)) 0,100% var(--verdict-corner),
    100% 100%,var(--verdict-corner) 100%,0 calc(100% - var(--verdict-corner)));
}
.operation-verdict[data-tone="intruder"] { --verdict-accent: #e2c5ff; --verdict-glow: #ae73ef; }
.operation-verdict[data-tone="defender"] { --verdict-accent: #ffe0a3; --verdict-glow: #dcaa53; }
.operation-verdict-heading { display:flex; align-items:center; gap:.65rem; }
.operation-verdict-insignia {
  width:var(--verdict-mark-size,2.4rem); aspect-ratio:1; flex:none; display:grid; place-items:center;
  border-inline-end:1px solid color-mix(in srgb,var(--verdict-accent) 38%,transparent);
  padding-inline-end:.35rem;
}
.operation-verdict-insignia[data-faction]::before {
  width:100%; height:100%; margin:0;
  filter:drop-shadow(0 0 6px color-mix(in srgb,var(--verdict-glow) 50%,transparent));
}
.operation-verdict-winner {
  display:block; color:var(--verdict-accent);
  font:650 .67rem/1.3 system-ui,sans-serif; letter-spacing:.095em; white-space:nowrap;
}
.operation-verdict-title { margin:0; font-weight:800; line-height:1.08; letter-spacing:.12em; }

[data-title-faction="GOGH"]{--rank-badge:url("./assets/gogh.svg");--rank-color:#e4c5ff;}
[data-title-faction="MONET"]{--rank-badge:url("./assets/monet.svg");--rank-color:#fff0cb;}
[data-title-insignia="milestone"]{--rank-trim:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%3E%3Cpath%20d%3D%22M15%2070V32L39%2020M85%2070V32L61%2020M30%2082l20%2010%2020-10%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%224%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");}
[data-title-insignia="elite"]{--rank-trim:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%3E%3Cpath%20d%3D%22M49%2015l4-8%204%208%209%201-6%206%201%208-8-4-9%204%202-8-7-6z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M40%2090C14%2081%2010%2060%2016%2036m45%2054c26-9%2030-30%2024-54%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%226%22%20stroke-dasharray%3D%223%205%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");}
[data-title-insignia="command-crown"]{--rank-trim:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%3E%3Cpath%20d%3D%22M30%2014l11%208%209-15%209%2015%2011-8-6%2023H36z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M37%2089C14%2083%208%2061%2014%2037m49%2052c23-6%2029-28%2023-52%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%227%22%20stroke-dasharray%3D%224%205%22%20stroke-linecap%3D%22round%22%2F%3E%3Cpath%20d%3D%22m42%2084%208%208%208-8%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%2F%3E%3C%2Fsvg%3E");}
[data-title-insignia="champion"]{--rank-trim:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%3E%3Cpath%20d%3D%22m50%203%208%2012%2013-3-5%2016-16%207-16-7-5-16%2013%203z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M36%2091C12%2086%207%2064%2012%2043m52%2048c24-5%2029-27%2024-48%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%227%22%20stroke-dasharray%3D%224%205%22%20stroke-linecap%3D%22round%22%2F%3E%3Cpath%20d%3D%22m33%2082-17%2013%2013-3%201%208%2017-13m20-5%2017%2013-13-3-1%208-17-13%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E");}
[data-title-insignia][data-title-faction]::before {
  mask:none; width:1.65em;height:1.65em;
  background:var(--rank-trim) center/contain no-repeat,var(--rank-badge) center 62%/69% no-repeat;
  filter:drop-shadow(0 0 .17em color-mix(in srgb,var(--rank-color) 68%,transparent));
}
[data-title-insignia="collection"]::before {
  mask:none;
  border-radius:32%;
  box-shadow:0 0 0 1px currentColor,0 0 .34em #050914d9;
  background:var(--collection-badge) center/cover no-repeat,var(--insignia,none) center/contain no-repeat;
}
