.sp-overlay { position: absolute; inset: 0; z-index: 3; isolation: isolate; }
.sp-overlay[hidden], .sp-controls[hidden] { display: none !important; }
.sp-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.sp-lines polygon { stroke: #bdd8c66e; fill: transparent; stroke-width: 1px; }
.sp-cell { position: absolute; appearance: none; background: transparent; border: 0; box-shadow: none; margin: 0; padding: 0; border-radius: 0; cursor: crosshair; touch-action: manipulation; color: #f0f4e9; }
.sp-cell:hover, .sp-cell:focus-visible { background: #d7ed8529; }
.sp-cell:focus-visible { outline: none; box-shadow: inset 0 0 0 3px #d7ed85; }
.sp-cell[data-owner=survivor] { background: #9dddc624; }
.sp-cell[data-owner=hunter] { background: #ff9e8c24; }
.sp-area-id, .sp-pin { position: absolute; transform: translate(-50%,-50%); pointer-events: none; user-select: none; font-family: "IBM Plex Mono", Consolas, monospace; font-weight: 700; line-height: 1; }
.sp-area-id { font-size: .85rem; background: #101d1cbe; border: 1px solid #829c8f80; border-radius: 3px; padding: .22rem .28rem; }
.sp-pin { z-index: 2; min-width: 2.12rem; min-height: 2.12rem; display: grid; place-items: center; border-radius: 100%; background: #9dddc6; border: 2px solid #172623; color: #172623; box-shadow: 0 2px 7px #071c17ad; font-size: .95rem; }
.sp-pin.is-hunter { background: #ff9e8c; }
.sp-controls { color: #f0eee4; }
.sp-controls button, .sp-gallery button, .sp-preview button, .sp-controls input { font: inherit; }
.sp-controls button, .sp-gallery button, .sp-preview button { cursor: pointer; }
.sp-controls button:disabled { cursor: default; opacity: .48; }
.sp-controls button:focus-visible, .sp-gallery :is(button,a):focus-visible, .sp-preview button:focus-visible, .sp-field:focus-visible { outline: 2px solid #d7ed85; outline-offset: 2px; }
.sp-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sp-heading h3, .sp-gallery h3, .sp-preview-header h3 { margin: 0; font-weight: 700; line-height: 1.5; }
.sp-heading h3 { font-size: 1.1rem; }
.sp-count, .sp-player-code, .sp-date { font-family: "IBM Plex Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.sp-count { font-size: .82rem; color: #b9cbbf; }
.sp-hint, .sp-note, .sp-meta, .sp-status { font-size: .85rem; line-height: 1.65; color: #b6c5ba; margin: .55rem 0 .9rem; }
.sp-roster { display: grid; gap: .375rem; }
.sp-player { display: flex; align-items: center; gap: .55rem; width: 100%; border: 1px solid #364642; border-radius: 6px; text-align: left; min-height: 41px; padding: .45rem .55rem; color: #f0eee4; background: #192523; }
.sp-player.is-active { border-color: #9eae70; background: #28342c; }
.sp-player:hover:enabled { border-color: #92a989; }
.sp-player-code { border: 1px solid #547166; border-radius: 4px; color: #a9e5ce; font-size: .77rem; min-width: 1.65rem; height: 1.65rem; display: grid; place-items: center; font-weight: 700; }
.sp-player.is-hunter .sp-player-code { color: #ffb4a6; border-color: #785d54; }
.sp-player-name { flex: 1; font-size: .9rem; overflow-wrap: anywhere; }
.sp-face { display:block; width:36px; height:36px; object-fit:contain; border-radius:5px; background:#20342d; }
.sp-pin.sp-face-pin { width:36px; height:36px; min-width:0; min-height:0; border-radius:7px; background:#20342d; border:2px solid #9dddc6; }
.sp-face-pin .sp-face { width:100%; height:100%; }
.sp-pin-code { position:absolute; right:-5px; bottom:-5px; background:#9dddc6; color:#12211d; border:1px solid #172623; border-radius:3px; padding:2px 3px; font-size:10px; }
@media (max-height:520px), (max-width:600px) { .sp-pin.sp-face-pin { width:30px; height:30px; } }
.sp-assignment { color: #b2c0b4; font-size: .75rem; white-space: nowrap; }
.sp-label { font-size: .82rem; color: #c1c9c0; display: block; margin: 1rem 0 .3rem; }
.sp-field { box-sizing: border-box; width: 100%; padding: .52rem .65rem; border: 1px solid #42504a; border-radius: 5px; color: #f0eee4; background: #15201f; }
.sp-field::placeholder { color: #99a69c; }
.sp-save, .sp-reset { width: 100%; border-radius: 5px; min-height: 40px; font-size: .9rem !important; }
.sp-save { margin-top: .65rem; border: 1px solid #d7ed85; background: #d7ed85; color: #18221d; font-weight: 700 !important; }
.sp-reset { margin-top: .35rem; border: none; background: transparent; color: #bbcabf; }
.sp-edit-target { margin: .9rem 0 0; color: #d5e5ac; font-size: .85rem; overflow-wrap: anywhere; }
.sp-copy { border: 1px solid #52634d; color: #dce5ce; }
.sp-actions a[aria-disabled="true"] { opacity: .5; }
.sp-thumbnail { color: #bac6bb; }
.sp-note { padding-top: .7rem; margin-bottom: 0; border-top: 1px solid #34413c; font-size: .78rem; }
.sp-note a { color: #c3d597; text-underline-offset: 2px; }
.sp-status:empty { display: none; }
.sp-gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,280px),1fr)); gap: 1rem; align-items: start; color:#eee; }
.sp-folder-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.sp-folder {
  display: grid; grid-template-columns: clamp(72px,7vw,110px) minmax(0,1fr) auto; align-items: center;
  gap: clamp(12px,1.3vw,20px); width: 100%; padding: 0 16px 0 0; overflow: hidden;
  text-align: start; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--paper);
}
.sp-folder:hover, .sp-folder:focus-visible { background: #222f27; border-color: #778563; }
.sp-folder-cover { align-self: stretch; min-height: 86px; position: relative; display: grid; place-items: center; overflow: hidden; background: #233129; border-right: 1px solid var(--border); }
.sp-folder-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sp-folder-label { display: grid; gap: 4px; padding-block: 10px; }
.sp-folder-label strong { font-size: 1.05rem; line-height: 1.4; overflow-wrap: anywhere; }
.sp-folder-count { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--dim); }
.sp-folder-label .sp-folder-count::before, .sp-folder-cover:empty::before {
  content: ""; width: 16px; height: 16px; background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M2.75 7V5.5c0-1 .75-1.75 1.75-1.75h5l2.3 2.5h7.7c1 0 1.75.75 1.75 1.75v10.5c0 1-.75 1.75-1.75 1.75h-15c-1 0-1.75-.75-1.75-1.75V7Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.sp-folder-cover:empty::before { width: 28px; height: 28px; }
.sp-folder::after, .sp-folder-back::before {
  content: ""; width: 7px; height: 7px; flex: none; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg);
}
.sp-folder::after { color: var(--dim); }
.sp-folder-header { grid-column: 1/-1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.sp-folder-header .sp-folder-back { min-height: 44px; gap: 8px; padding-inline: 14px; }
.sp-folder-back::before { transform: rotate(-135deg); }
.sp-folder-title { margin: 0; color: var(--paper); font-size: 1.25rem; line-height: 1.4; }
.sp-folder-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 980px) {
  .sp-folder-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .sp-folder-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .sp-folder { grid-template-columns: 78px minmax(0,1fr) auto; }
  .sp-folder-cover { min-height: 68px; }
  .sp-folder-header { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .sp-folder-header .sp-folder-back { grid-column: 1/-1; justify-self: start; }
}
.sp-empty { grid-column: 1/-1; padding: 2rem 1rem; text-align: center; border: 1px dashed #42544a; border-radius: 7px; color: #bac6bb; }
.sp-empty h3 { color: #e6eadf; font-size: 1.02rem; }
.sp-empty p { font-size: .88rem; line-height: 1.65; margin-bottom: 0; }
.sp-card { overflow: hidden; border: 1px solid #39463f; background: #192524; border-radius: 8px; }
.sp-thumbnail { display: block; width: 100%; height: 160px; background: #101917; padding: 0; border: 0; overflow:hidden; }
.sp-thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .18s ease; }
.sp-thumbnail:hover img { transform: scale(1.025); }
.sp-card-body { padding: .9rem 1rem; }
.sp-card h3 { font-size: 1rem; margin: .12rem 0; overflow-wrap: anywhere; }
.sp-meta { margin: .15rem 0 .8rem; }
.sp-date { color: #b1beaf; font-size: .75rem; }
.sp-actions, .sp-preview-header { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sp-secondary, .sp-delete { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 5px; padding: .4rem .65rem; background: #23302b; color: #e0e8d9; border: 1px solid #435147; font-size: .82rem !important; min-height: 34px; box-sizing: border-box; }
.sp-delete { color: #e7b0a6; margin-left: auto; background: transparent; border-color: transparent; }
.sp-preview { max-width: min(880px,96vw); max-height: 92vh; box-sizing: border-box; border-radius: 8px; background: #14201f; color: #f0eee4; border: 1px solid #596b5e; padding: .8rem; }
.sp-preview::backdrop { background: #060e0dd9; }
.sp-preview-header { justify-content: space-between; margin-bottom: .7rem; }
.sp-preview-header h3 { font-size: 1rem; }
.sp-preview img { display: block; max-width: 100%; max-height: 76vh; object-fit: contain; margin: 0 auto; }
@media (max-width: 600px) {
  .sp-pin { min-width: 1.75rem; min-height: 1.75rem; font-size: .8rem; }
  .sp-player, .sp-save, .sp-secondary, .sp-delete { min-height: 44px; }
  .sp-thumbnail { height: 180px; }
}
