/* =========================================================
   V24 PLATFORM HARDENING
========================================================= */
:where(button, .tool-button, .primary-button, .system-tab, .title-selector, a, input, textarea, select):focus { outline: none; }
:where(button, .tool-button, .primary-button, .system-tab, .title-selector, a):focus-visible {
    outline: none;
    border-color: var(--app-focus) !important;
    box-shadow: 0 0 0 2px var(--app-focus-soft), var(--app-shadow-soft);
}
:where(input, textarea, select):focus-visible {
    outline: none;
    border-color: var(--app-focus) !important;
    box-shadow: 0 0 0 2px var(--app-focus-soft);
}
body { user-select: none; -webkit-user-select: none; }
input, textarea, select, [contenteditable="true"], .entity-description, .conversation-messages, .ai-response-output, .tooltip-section {
    user-select: text;
    -webkit-user-select: text;
}
button, .tool-button, .primary-button, .system-tab, .card-list-item, .link-card, .entity-link, .tracking-chip, .dice-chip {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
#map-viewport, #map-world, .hotspot.dragging, .ui-card.dragging, .settlement-panel.dragging, .map-controls.dragging { touch-action: none; }
@media (pointer: coarse) {
    button, .tool-button, .primary-button, .system-tab { min-height: var(--app-touch-target); min-width: var(--app-touch-target); }
    .card-list-item.compact-card-list-item { min-height: 52px; height: 52px; }
    .compact-list-row { min-height: 50px; height: 50px; }
}
@media (hover: none) {
    .ui-card li:hover, .card-list-item.compact-card-list-item:hover, .link-card:hover, .entity-link:hover, .hotspot:hover { transform: none; }
}
* { scroll-behavior: auto; }
.ui-card, .entity-modal, .system-modal, .dice-modal, .export-shell, .section-block, .card-list-item, .hotspot { contain: layout paint; }
.entity-modal-body, .modal-content, .system-content, .dice-content, .conversation-messages, .ai-response-output, .ui-card ul {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.entity-details > .section-block > h3, .modal-details > .section-block > h3,
.entity-details > details.section-block > summary, .modal-details > details.section-block > summary {
    position: sticky;
    top: var(--section-sticky-top);
    z-index: 2;
    backdrop-filter: none;
}
.editor-checkbox, .system-toggle-row {
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    background: rgba(0,0,0,0.12);
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}
.editor-checkbox + .editor-checkbox, .system-toggle-row + .system-toggle-row { margin-top: 8px; }
.editor-checkbox input[type="checkbox"], .system-toggle-row input[type="checkbox"] {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}
.editor-checkbox span, .system-toggle-row span {
    color: var(--text-soft);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.editor-checkbox::after, .system-toggle-row::after {
    content: "OFF";
    width: 58px;
    min-width: 58px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    color: var(--text-muted);
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), rgba(0,0,0,0.24);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    box-sizing: border-box;
}
.editor-checkbox:has(input[type="checkbox"]:checked)::after, .system-toggle-row:has(input[type="checkbox"]:checked)::after {
    content: "ON";
    justify-content: flex-start;
    color: #102015;
    border-color: rgba(76,255,154,0.46);
    background: linear-gradient(180deg, rgba(122,255,174,0.96), rgba(49,186,99,0.82));
}
.editor-checkbox:focus-within, .system-toggle-row:focus-within { border-color: var(--app-focus); box-shadow: 0 0 0 2px var(--app-focus-soft); }
.appearance-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .appearance-settings-grid { grid-template-columns: 1fr; } }
.theme-light .ui-card, .theme-light .settlement-panel, .theme-light .entity-modal, .theme-light .system-modal, .theme-light .dice-modal, .theme-light .export-shell, .theme-light .section-block {
    background: linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.42)), var(--panel-surface);
    color: var(--text);
}
.theme-light #map-viewport { background: #0b0f13; }
.style-fantasy { --app-radius-panel: 26px; --app-radius-control: 999px; }
.style-tactical { --app-radius-panel: 14px; --app-radius-control: 8px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 1ms !important; }
    .hotspot-pulse { animation: none !important; }
}
:root[data-reduced-motion="on"] *, :root[data-reduced-motion="on"] *::before, :root[data-reduced-motion="on"] *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
}
:root[data-reduced-motion="on"] .hotspot-pulse { animation: none !important; }
.hotspot { width: var(--hotspot-size-runtime, 28px); height: var(--hotspot-size-runtime, 28px); }
