:root {
    --space-red: #9b2236;
    --panel-bg: rgba(14, 18, 24, 0.88);
    --panel-border: rgba(100, 115, 129, 0.42);
    --panel-highlight: rgba(255, 255, 255, 0.08);
    --button-base: #465146;
    --button-hover: #575a57;
    --button-active: #3e6c45;
    --button-caution: #ab3232;
    --text-main: #d8e1ea;
    --text-muted: #9aa8b6;
    --scrollbar-track: rgba(5, 9, 14, 0.92);
    --scrollbar-track-border: rgba(88, 104, 120, 0.18);
    --scrollbar-thumb: rgba(74, 92, 105, 0.88);
    --scrollbar-thumb-hover: rgba(95, 120, 138, 0.94);
    --scrollbar-thumb-active: rgba(117, 151, 173, 0.96);
    --grid-line: rgba(170, 208, 255, 0.18);
    --grid-line-strong: rgba(216, 225, 234, 0.32);
    --backdrop-opacity: 0.75;
    font-family: "Noto Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-main);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: 0.78rem;
    height: 0.78rem;
}

*::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(9, 14, 21, 0.96), var(--scrollbar-track));
    box-shadow: inset 0 0 0 1px var(--scrollbar-track-border);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(96, 115, 127, 0.92), var(--scrollbar-thumb));
    border: 2px solid var(--scrollbar-track);
    border-radius: 999px;
    min-height: 2.4rem;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(118, 145, 162, 0.96), var(--scrollbar-thumb-hover));
}

*::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, rgba(136, 170, 191, 0.98), var(--scrollbar-thumb-active));
}

*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
    background: #03060b;
}

body {
    color: var(--text-main);
}

button,
input {
    font: inherit;
}

.app-shell {
    position: relative;
    min-height: 100vh;
    background: #03060b;
}

.space-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-position: center;
    background-repeat: repeat;
    opacity: var(--backdrop-opacity);
    will-change: transform;
}

.space-layer-base {
    background-image: url('/planner-assets/Resources/Textures/Parallaxes/layer1.png');
    background-size: 480px 480px;
    animation: drift-base 80s linear infinite;
}

.space-layer-nebula {
    background-image: url('/planner-assets/Resources/Textures/Parallaxes/KettleParallaxBG.png');
    background-size: 1024px 1024px;
    mix-blend-mode: screen;
    opacity: calc(var(--backdrop-opacity) * 0.28);
    animation: drift-nebula 150s linear infinite;
}

.space-layer-stars {
    background-image: radial-gradient(circle at center, rgba(29, 40, 58, 0.1), rgba(0, 0, 0, 0.7));
    opacity: 0.9;
}

.hud-left {
    position: absolute;
    z-index: 30;
    display: flex;
    flex-direction: column;
    top: 1rem;
    left: 0.75rem;
    gap: 1rem;
}

.hud-rail {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.55rem;
    background: rgba(8, 12, 17, 0.84);
    border: 1px solid rgba(108, 122, 136, 0.38);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}

.hud-button {
    width: 3.5rem;
    height: 3.5rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    background: linear-gradient(180deg, rgba(83, 91, 92, 0.94), rgba(48, 54, 56, 0.94));
    color: #d9dedf;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.35);
    padding: 0.35rem 0.2rem;
}

.hud-button img {
    width: 1.2rem;
    height: 1.2rem;
    object-fit: contain;
    image-rendering: pixelated;
}

.hud-button span {
    font-size: 0.68rem;
    color: #b8c2c8;
}

.hud-button:hover,
.hud-button:focus-visible {
    background: linear-gradient(180deg, rgba(98, 106, 108, 0.98), rgba(57, 64, 66, 0.98));
}

.hud-button.is-active {
    background: linear-gradient(180deg, rgba(24, 112, 76, 0.98), rgba(38, 71, 50, 0.98));
}

.viewport-wrap {
    position: relative;
    z-index: 10;
    height: 100vh;
    padding: 1rem 1rem 1rem 30rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}

.status-block,
.overlay-panel,
.dock-panel,
.auth-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}

.status-block {
    padding: 0.7rem 0.9rem;
    min-width: 0;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.status-label,
.dock-kicker,
.panel-heading-row h2,
.toggle-row span,
label span {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.status-value {
    margin-top: 0.2rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-access-status {
    position: relative;
    clip-path: none;
    z-index: 25;
}

.quick-access-shell {
    position: relative;
    margin-top: 0.2rem;
}

.quick-access-input {
    width: 100%;
    min-height: 2rem;
    margin: 0;
    position: relative;
    z-index: 2;
}

.quick-access-inline-autocomplete {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.7rem;
    font-size: 0.9rem;
    line-height: 1.2;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    z-index: 3;
}

.quick-access-inline-autocomplete.hidden {
    display: none;
}

.quick-access-inline-prefix {
    color: transparent;
}

.quick-access-inline-suffix {
    color: rgba(212, 227, 240, 0.45);
}

.quick-access-results {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: min(24rem, 55vh);
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid rgba(122, 167, 201, 0.28);
    background: rgba(5, 12, 19, 0.97);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.48);
}

.quick-access-results.hidden {
    display: none;
}

.quick-access-option {
    appearance: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 21, 34, 0.85);
    color: var(--text-main);
    text-align: left;
    width: 100%;
    padding: 0.45rem 0.55rem;
    cursor: pointer;
}

.quick-access-option:hover,
.quick-access-option:focus-visible,
.quick-access-option.is-active {
    border-color: rgba(115, 190, 255, 0.58);
    background: rgba(17, 33, 52, 0.92);
}

.quick-access-option-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.quick-access-option-title {
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-access-option-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-access-option-kind {
    font-size: 0.68rem;
    color: var(--accent-soft);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: 0 0 auto;
}

.quick-access-empty {
    padding: 0.55rem 0.6rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.viewport-panel {
    position: relative;
    flex: 1;
    border: 1px solid rgba(83, 97, 115, 0.38);
    background: rgba(0, 0, 0, 0.14);
    overflow: hidden;
    isolation: isolate;
}

#planner-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    position: relative;
    z-index: 1;
}

#planner-canvas.is-panning {
    cursor: grabbing;
}

.viewport-overlay {
    position: absolute;
    z-index: 15;
}

.top-right-overlay {
    top: 1rem;
    right: 1rem;
}

.bottom-right-overlay {
    right: 1rem;
    bottom: 1rem;
}

.bottom-left-overlay {
    left: 1rem;
    bottom: 1rem;
}

.storage-side-tab {
    position: absolute;
    z-index: 18;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    border: 1px solid var(--panel-border);
    border-right: 0;
    background: rgba(14, 18, 24, 0.94);
    color: var(--text-main);
    padding: 0.8rem 0.45rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.74rem;
    cursor: pointer;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.storage-side-tab:hover,
.storage-side-tab:focus-visible {
    background: rgba(24, 30, 39, 0.98);
}

.storage-side-tab[aria-expanded="true"] {
    background: rgba(38, 71, 50, 0.98);
}

.storage-side-panel {
    position: absolute;
    z-index: 19;
    top: 0.75rem;
    right: 1rem;
    bottom: 4.9rem;
    width: min(24rem, calc(100% - 2rem));
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}

.storage-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem 0.75rem;
    border-bottom: 1px solid var(--panel-highlight);
}

.storage-panel-header h2 {
    margin: 0.15rem 0 0;
    font-size: 1.15rem;
}

.storage-panel-sections {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
}

.storage-section {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(3, 6, 10, 0.72);
    padding: 0.65rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.storage-section.is-collapsed {
    gap: 0;
}

.storage-section-header {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: flex-start;
    text-align: left;
    cursor: pointer;
}

.storage-section-header:hover {
    color: var(--text-main);
}

.storage-section-header:focus-visible {
    outline: 1px solid rgba(80, 171, 121, 0.62);
    outline-offset: 2px;
}

.storage-section-header-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.storage-section-header-side {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.storage-section-title {
    margin: 0;
    display: block;
    font-size: 0.9rem;
    line-height: 1.2;
}

.storage-section-meta {
    color: var(--text-muted);
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.storage-section-copy {
    color: var(--text-muted);
    display: block;
    font-size: 0.72rem;
}

.storage-section-caret {
    width: 0.85rem;
    height: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.storage-section-caret::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-0.05rem) rotate(45deg);
    transition: transform 120ms ease;
}

.storage-section-header.is-collapsed .storage-section-caret::before {
    transform: rotate(-45deg);
}

.storage-section-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.storage-section-body[hidden] {
    display: none;
}

.storage-grid-shell {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.storage-grid-label,
.storage-item-list-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
}

.storage-grid {
    display: grid;
    gap: 0.2rem;
    align-content: start;
    background: rgba(8, 12, 17, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.35rem;
}

.storage-grid-cell {
    min-width: 0;
    min-height: 1.5rem;
    border: 1px solid rgba(119, 137, 152, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

.storage-grid-item {
    position: relative;
    z-index: 1;
    border: 1px solid rgba(80, 171, 121, 0.62);
    background: rgba(17, 29, 23, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.storage-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.storage-item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.35rem;
}

.storage-item-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 12, 17, 0.84);
    padding: 0.35rem 0.45rem;
    display: flex;
    flex-direction: row;
    gap: 0.4rem;
    align-items: center;
    text-align: left;
    min-height: 0;
}

.storage-item-thumb {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    object-fit: contain;
    image-rendering: pixelated;
}

.storage-item-name {
    font-size: 0.72rem;
    line-height: 1.2;
    min-width: 0;
}

.compact-panel,
.hint-panel {
    padding: 0.8rem 1rem;
    min-width: 15rem;
}

.tile-inspector-panel {
    padding: 0.8rem 1rem;
    width: min(24rem, calc(100vw - 11rem));
    max-height: 12rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.tile-inspector-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
}

.tile-inspector-kicker {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.tile-inspector-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow: auto;
    min-height: 0;
    color: var(--text-main);
    font-size: 0.9rem;
}

.tile-inspector-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tile-inspector-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.tile-inspector-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.tile-inspector-name {
    text-align: right;
}

.overlay-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

.overlay-row:last-child {
    margin-bottom: 0;
}

.overlay-actions {
    display: flex;
    justify-content: flex-end;
}

.mini-action,
.panel-action,
.auth-tab,
.dock-close {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--button-base);
    color: var(--text-main);
    padding: 0.5rem 0.8rem;
    cursor: pointer;
}

.mini-action:hover,
.panel-action:hover,
.auth-tab:hover,
.dock-close:hover,
.mini-action:focus-visible,
.panel-action:focus-visible,
.auth-tab:focus-visible,
.dock-close:focus-visible {
    background: var(--button-hover);
}

.panel-action.primary,
.auth-tab.is-active {
    background: var(--button-active);
}

.panel-action.caution {
    background: var(--button-caution);
}

.dock-panel {
    position: absolute;
    z-index: 25;
    top: 1rem;
    left: 6.5rem;
    bottom: 1rem;
    width: 22rem;
    display: flex;
    flex-direction: column;
    transition: width 160ms ease, opacity 160ms ease;
}

.dock-panel.is-collapsed {
    width: 0;
    opacity: 0;
    pointer-events: none;
}

.dock-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem 0.75rem;
    border-bottom: 1px solid var(--panel-highlight);
}

.dock-header h1 {
    margin: 0.15rem 0 0;
    font-size: 1.2rem;
}

.dock-body {
    display: none;
    flex: 1;
    overflow: hidden;
    padding: 1rem;
    gap: 1rem;
}

.dock-body.is-visible {
    display: flex;
    flex-direction: column;
}

.dock-body[data-panel-body="projects"] {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dock-body[data-panel-body="character"] {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dock-body[data-panel-body="projects"] .panel-section {
    flex: 0 0 auto;
    min-height: 0;
}

.dock-body[data-panel-body="character"] .panel-section {
    flex: 0 0 auto;
    min-height: 0;
}

.dock-body[data-panel-body="projects"] .panel-section.grow {
    flex: 1 0 auto;
    min-height: 12rem;
}

.dock-body[data-panel-body="character"] .panel-section.grow {
    flex: 1 0 auto;
    min-height: 16rem;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.panel-section.grow {
    flex: 1;
    min-height: 0;
}

.panel-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.panel-heading-row h2 {
    margin: 0;
}

.form-grid {
    display: grid;
    gap: 0.75rem;
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(4, 7, 12, 0.8);
    color: var(--text-main);
    padding: 0.6rem 0.7rem;
}

input[type="range"] {
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.list-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow: auto;
    min-height: 0;
}

.compact-template-list {
    max-height: 15rem;
}

.list-item,
.palette-card,
.info-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(3, 6, 10, 0.72);
    padding: 0.75rem;
}

.list-item {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.list-item.is-active {
    border-color: rgba(80, 171, 121, 0.62);
    background: rgba(17, 29, 23, 0.76);
}

.item-title-row,
.item-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.item-meta-row {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.category-tab {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 11, 18, 0.84);
    color: var(--text-main);
    padding: 0.45rem 0.7rem;
    cursor: pointer;
}

.category-tab.is-active {
    background: var(--button-active);
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.6rem;
    overflow: auto;
    min-height: 0;
    align-content: start;
}

.palette-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    align-items: center;
    text-align: center;
    cursor: pointer;
    min-height: 8rem;
}

.palette-card:hover,
.palette-card.is-active {
    border-color: rgba(77, 171, 123, 0.7);
    background: rgba(17, 29, 23, 0.84);
}

.palette-preview {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    object-fit: contain;
}

.palette-card-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

.palette-card-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.recipe-detail-view {
    position: absolute;
    inset: 0;
    z-index: 24;
    padding: 1.15rem;
    background:
        linear-gradient(180deg, rgba(7, 13, 20, 0.95), rgba(4, 8, 13, 0.97)),
        radial-gradient(circle at top right, rgba(74, 133, 184, 0.14), transparent 32%),
        radial-gradient(circle at bottom left, rgba(80, 171, 121, 0.12), transparent 28%);
    overflow: auto;
}

.recipe-detail-shell {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-height: 100%;
}

.recipe-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.recipe-detail-header h2 {
    margin: 0.15rem 0 0;
    font-size: 1.55rem;
}

.recipe-detail-lead {
    margin: 0.65rem 0 0;
    max-width: 52rem;
    line-height: 1.6;
    color: var(--text-main);
}

.recipe-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
    gap: 0.85rem;
    align-content: start;
}

.recipe-detail-card {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.recipe-formula-grid,
.recipe-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.recipe-ingredient-block,
.recipe-profile-block {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.recipe-ingredient-list,
.recipe-effect-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.recipe-ingredient-row,
.recipe-effect-row {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: flex-start;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.recipe-ingredient-row:last-child,
.recipe-effect-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.recipe-ingredient-main,
.recipe-effect-main {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.recipe-ingredient-name,
.recipe-effect-name {
    font-weight: 700;
}

.recipe-ingredient-link {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    color: #dfeafb;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.recipe-ingredient-link:hover,
.recipe-ingredient-link:focus-visible {
    color: #ffffff;
    text-decoration: underline;
}

.recipe-ingredient-meta,
.recipe-effect-meta,
.recipe-list-callout,
.recipe-small-copy {
    color: var(--text-muted);
    font-size: 0.77rem;
    line-height: 1.35;
}

.recipe-ingredient-amount,
.recipe-effect-amount {
    font-weight: 700;
    white-space: nowrap;
}

.recipe-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.recipe-tag {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 11, 18, 0.84);
    color: var(--text-main);
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
}

.recipe-quote {
    margin: 0;
    padding-left: 0.85rem;
    border-left: 3px solid rgba(107, 179, 255, 0.72);
    color: #dfeafb;
    font-style: italic;
    line-height: 1.6;
}

.recipe-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.65rem;
}

.recipe-stat {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(3, 6, 10, 0.72);
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.recipe-stat-value {
    font-size: 1.02rem;
    font-weight: 700;
}

.recipe-color-block {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    align-items: flex-end;
    flex: 0 0 auto;
}

.recipe-detail-actions {
    display: flex;
    justify-content: flex-end;
}

.recipe-color-swatch {
    width: 3rem;
    height: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24);
}

.recipe-calculator-card {
    grid-column: 1 / -1;
}

.recipe-calculator-controls,
.recipe-calculator-grid,
.recipe-calculator-stat-grid {
    display: grid;
    gap: 0.75rem;
}

.recipe-calculator-controls,
.recipe-calculator-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.recipe-calculator-grid {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.recipe-calculator-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.79rem;
    line-height: 1.45;
}

.recipe-empty-state {
    margin: auto 0;
}

.recipe-list-use {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.recipe-list-score {
    font-size: 0.78rem;
    color: #b7e1c1;
}

.research-list-item {
    gap: 0.55rem;
}

.research-list-header {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
}

.research-list-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 auto;
}

.research-list-icon-shell {
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid color-mix(in srgb, var(--research-accent) 48%, rgba(255, 255, 255, 0.14));
    background: rgba(3, 6, 10, 0.72);
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
}

.research-list-icon {
    width: 1.65rem;
    height: 1.65rem;
    image-rendering: pixelated;
    object-fit: contain;
}

.research-list-icon-fallback {
    color: #f4f8fd;
    font-size: 0.95rem;
    font-weight: 700;
}

.research-list-discipline {
    font-weight: 700;
}

.research-list-unlocks {
    color: var(--text-muted);
    font-size: 0.77rem;
    line-height: 1.4;
}

.research-list-unlocks-label {
    color: var(--text-main);
    font-weight: 700;
}

.research-detail-shell .recipe-detail-grid {
    align-items: start;
}

.research-icon-block {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    align-items: flex-end;
    flex: 0 0 auto;
}

.research-tech-icon {
    width: 4rem;
    height: 4rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(3, 6, 10, 0.72);
    image-rendering: pixelated;
    object-fit: contain;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.research-tech-icon-fallback {
    display: grid;
    place-items: center;
    color: #f4f8fd;
    font-size: 1.45rem;
    font-weight: 700;
}

.research-discipline-chip {
    font-weight: 700;
}

.research-tree-card {
    grid-column: 1 / -1;
}

.research-tree {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.research-tree-parents {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: flex-start;
}

.research-tree-node-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: min(100%, 15rem);
    padding-left: 1rem;
}

.research-tree-node-group::before {
    content: "";
    position: absolute;
    left: 0.35rem;
    top: 0;
    bottom: 0.4rem;
    width: 1px;
    background: linear-gradient(180deg, rgba(109, 177, 255, 0.45), rgba(109, 177, 255, 0));
}

.research-tree-node {
    appearance: none;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 11, 18, 0.84);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    cursor: pointer;
}

.research-tree-node:hover,
.research-tree-node:focus-visible,
.research-link-button:hover,
.research-link-button:focus-visible {
    border-color: rgba(109, 177, 255, 0.45);
    background: rgba(10, 18, 28, 0.92);
}

.research-tree-node.is-selected {
    border-color: rgba(126, 205, 72, 0.68);
    box-shadow: 0 0 0 1px rgba(126, 205, 72, 0.2);
}

.research-tree-node-title,
.research-link-title {
    font-weight: 700;
}

.research-tree-node-meta,
.research-link-meta,
.research-empty-note {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.research-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.65rem;
}

.research-unlock-row {
    align-items: center;
}

.research-link-button {
    appearance: none;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    align-items: flex-start;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 11, 18, 0.84);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    cursor: pointer;
}

.toggle-row {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
}

.help-copy p {
    margin: 0 0 0.8rem;
    color: var(--text-main);
    line-height: 1.45;
}

.help-copy p:last-child {
    margin-bottom: 0;
}

.welcome-modal {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(2, 6, 10, 0.72);
    backdrop-filter: blur(8px);
}

#tutorial-modal {
    background: rgba(2, 6, 10, 0.22);
    backdrop-filter: none;
}

.tutorial-card {
    position: fixed;
    width: min(30rem, calc(100vw - 2rem));
    max-height: min(38rem, calc(100vh - 2rem));
    z-index: 42;
    transition: top 200ms ease, right 200ms ease, bottom 200ms ease, left 200ms ease, transform 200ms ease;
}

.tutorial-card.tutorial-card-pos-top-left {
    top: 1rem;
    left: 1rem;
    right: auto;
    bottom: auto;
}

.tutorial-card.tutorial-card-pos-top-right {
    top: 1rem;
    right: 1rem;
    left: auto;
    bottom: auto;
}

.tutorial-card.tutorial-card-pos-bottom-left {
    bottom: 1rem;
    left: 1rem;
    top: auto;
    right: auto;
}

.tutorial-card.tutorial-card-pos-bottom-right {
    bottom: 1rem;
    right: 1rem;
    top: auto;
    left: auto;
}

.tutorial-spotlight {
    position: fixed;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    z-index: 41;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(212, 240, 255, 0.34) 0%,
        rgba(148, 206, 236, 0.22) 35%,
        rgba(94, 147, 178, 0.1) 56%,
        rgba(0, 0, 0, 0) 74%);
    transition: opacity 160ms ease, left 220ms ease, top 220ms ease, width 220ms ease, height 220ms ease;
}

.tutorial-spotlight.is-visible {
    opacity: 1;
}

.welcome-modal[hidden] {
    display: none !important;
}

.welcome-card {
    position: relative;
    width: min(56rem, calc(100vw - 5rem));
    max-height: min(42rem, calc(100vh - 3rem));
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(14, 18, 24, 0.97), rgba(7, 11, 16, 0.97));
    border: 1px solid var(--panel-border);
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.welcome-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, rgba(80, 171, 121, 0.95), rgba(107, 179, 255, 0.75));
}

.welcome-card.warning-card::before {
    background: linear-gradient(180deg, rgba(214, 154, 69, 0.96), rgba(107, 179, 255, 0.72));
}

.welcome-card.census-card::before {
    background: linear-gradient(180deg, rgba(87, 171, 209, 0.96), rgba(102, 214, 150, 0.78));
}

.welcome-card.credits-card::before {
    background: linear-gradient(180deg, rgba(203, 177, 94, 0.96), rgba(107, 179, 255, 0.72));
}

.welcome-card.tutorial-card::before {
    background: linear-gradient(180deg, rgba(87, 171, 209, 0.96), rgba(102, 214, 150, 0.78));
}

.tutorial-body {
    animation: tutorial-fade-in 220ms ease;
}

.tutorial-progress {
    display: inline-block;
    width: fit-content;
    padding: 0.12rem 0.42rem;
    border: 1px solid rgba(120, 183, 213, 0.42);
    background: rgba(46, 89, 109, 0.35);
    color: rgba(213, 239, 252, 0.95);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tutorial-step-title {
    margin: 0;
    color: rgba(236, 246, 255, 0.98);
    font-size: 1.18rem;
}

.tutorial-actions {
    gap: 0.5rem;
}

.tutorial-target-active {
    position: relative;
    z-index: 45;
    box-shadow: 0 0 0 2px rgba(109, 186, 225, 0.96), 0 0 0 8px rgba(109, 186, 225, 0.24), 0 0 24px rgba(103, 205, 157, 0.38);
    animation: tutorial-target-pulse 1.2s ease-in-out infinite;
}

@keyframes tutorial-target-pulse {
    0% { box-shadow: 0 0 0 2px rgba(109, 186, 225, 0.9), 0 0 0 6px rgba(109, 186, 225, 0.28), 0 0 20px rgba(103, 205, 157, 0.35); }
    50% { box-shadow: 0 0 0 2px rgba(109, 186, 225, 0.9), 0 0 0 9px rgba(109, 186, 225, 0.2), 0 0 28px rgba(103, 205, 157, 0.45); }
    100% { box-shadow: 0 0 0 2px rgba(109, 186, 225, 0.9), 0 0 0 6px rgba(109, 186, 225, 0.28), 0 0 20px rgba(103, 205, 157, 0.35); }
}

@keyframes tutorial-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.viewer-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.viewer-stats-grid-wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.viewer-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 100%;
}

.viewer-stat-card strong {
    font-size: 1.2rem;
}

.viewer-stat-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.45;
}

.viewer-stats-recent {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.viewer-stats-recent-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.viewer-stats-recent-group + .viewer-stats-recent-group {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.viewer-stats-recent-group-title {
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.viewer-stats-recent-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.viewer-stats-recent-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.viewer-stats-recent-main {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.viewer-stats-recent-main strong {
    font-size: 0.92rem;
}

.viewer-session-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.1rem;
}

.viewer-session-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
    background: rgba(108, 193, 255, 0.12);
    border: 1px solid rgba(108, 193, 255, 0.22);
    color: var(--accent-soft);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.viewer-session-feature-line {
    color: var(--text-muted);
}

.viewer-stats-loading,
.viewer-stats-error {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.viewer-insight-grid {
    align-items: stretch;
}

.viewer-recent-card {
    grid-column: 1 / -1;
}

.viewer-story-copy {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.viewer-story-copy p {
    margin: 0;
    color: var(--text-main);
    line-height: 1.5;
}

.viewer-section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.viewer-section-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.viewer-inline-toggle {
    margin: 0;
    padding: 0.3rem 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 21, 34, 0.5);
    border-radius: 0.45rem;
}

.viewer-inline-toggle span {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.viewer-session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.welcome-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem 0.85rem 1.45rem;
    border-bottom: 1px solid var(--panel-highlight);
}

.welcome-card-header h2 {
    margin: 0.15rem 0 0;
    font-size: 1.35rem;
}

.welcome-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.15rem 1.2rem 1rem 1.45rem;
    overflow: auto;
}

.welcome-lead {
    margin: 0;
    color: var(--text-main);
    line-height: 1.6;
    font-size: 1rem;
}

.welcome-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.welcome-section-heading {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.welcome-card-block {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 100%;
}

.welcome-card-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.welcome-card-icon-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 10, 16, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.welcome-card-icon {
    width: 1.1rem;
    height: 1.1rem;
    object-fit: contain;
    image-rendering: pixelated;
}

.welcome-card-block h3 {
    margin: 0;
    font-size: 0.98rem;
}

.welcome-card-block p {
    margin: 0;
    color: var(--text-main);
    line-height: 1.5;
}

.welcome-path {
    margin-top: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(4, 7, 12, 0.82);
    padding: 0.7rem 0.8rem;
    color: #d7e8f8;
    font-family: "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    word-break: break-word;
}

.welcome-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
    padding: 0.95rem 1.2rem 1.1rem 1.45rem;
    border-top: 1px solid var(--panel-highlight);
}

.toast-region {
    position: absolute;
    z-index: 50;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.toast {
    background: rgba(12, 18, 28, 0.94);
    border: 1px solid rgba(91, 108, 122, 0.48);
    padding: 0.75rem 0.9rem;
    min-width: 14rem;
}

.hidden {
    display: none !important;
}

@keyframes drift-base {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-160px, -120px, 0); }
}

@keyframes drift-nebula {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(140px, -180px, 0); }
}

@media (max-width: 1100px) {
    .viewport-wrap {
        padding-left: 26rem;
    }

    .dock-panel {
        width: 18rem;
    }

    .status-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .recipe-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 800px) {
    .viewport-wrap {
        padding: 9rem 0.75rem 0.75rem;
    }

    .welcome-modal {
        padding: 0.75rem;
    }

    .welcome-card {
        width: 100%;
        max-height: calc(100vh - 1.5rem);
    }

    .welcome-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .viewer-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .welcome-card-actions {
        flex-direction: column;
    }

    .recipe-detail-view {
        padding: 0.85rem;
    }

    .recipe-detail-header,
    .recipe-formula-grid,
    .recipe-profile-grid {
        grid-template-columns: minmax(0, 1fr);
        flex-direction: column;
    }

    .recipe-color-block {
        align-items: flex-start;
    }

    .research-icon-block {
        align-items: flex-start;
    }

    .research-tree-parents {
        flex-direction: column;
    }

    .research-link-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .welcome-card-actions .panel-action {
        width: 100%;
    }

    .viewer-stats-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hud-left {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        gap: 0.75rem;
    }

    .hud-rail {
        flex-direction: row;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .dock-panel {
        top: 7.75rem;
        left: 0.75rem;
        right: 0.75rem;
        bottom: auto;
        width: auto;
        max-height: 46vh;
    }

    .bottom-left-overlay,
    .bottom-right-overlay {
        left: 0.75rem;
        right: 0.75rem;
    }

    .bottom-left-overlay {
        bottom: 8rem;
    }

    .bottom-right-overlay {
        bottom: 0.75rem;
    }

    .tile-inspector-panel,
    .hint-panel {
        width: auto;
        min-width: 0;
    }

    .storage-side-tab {
        top: auto;
        bottom: 12.5rem;
        right: 0.75rem;
        transform: none;
        writing-mode: horizontal-tb;
        border-right: 1px solid var(--panel-border);
        padding: 0.5rem 0.7rem;
    }

    .storage-side-panel {
        left: 0.75rem;
        right: 0.75rem;
        top: 7.75rem;
        bottom: auto;
        width: auto;
        max-height: 48vh;
    }

    .status-strip {
        display: none;
    }
}

    .muted-card {
        background: linear-gradient(180deg, rgba(21, 32, 44, 0.92), rgba(13, 20, 29, 0.88));
        color: rgba(210, 226, 240, 0.84);
    }

    .character-only-control {
        display: none;
    }

    .character-mode .character-only-control {
        display: inline-flex;
    }

    .character-mode .hud-tools {
        opacity: 0.24;
        pointer-events: none;
    }

    .character-mode .bottom-left-overlay,
    .character-mode .bottom-right-overlay,
    .character-mode .storage-side-tab,
    .character-mode .storage-side-panel {
        display: none !important;
    }

    .character-inline-note {
        padding: 0.65rem 0.8rem;
        border: 1px dashed rgba(127, 163, 192, 0.32);
        border-radius: 0.85rem;
        color: rgba(217, 231, 242, 0.78);
        font-size: 0.84rem;
    }

    .character-summary-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem 0.9rem;
        margin-top: 0.95rem;
    }

    .character-summary-grid span {
        display: block;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: rgba(155, 187, 214, 0.7);
        margin-bottom: 0.2rem;
    }

    .character-summary-grid strong {
        display: block;
        font-size: 0.95rem;
        color: rgba(244, 250, 255, 0.96);
    }

    .character-slot-board {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-areas:
            "head head eyes ears"
            "mask neck back back"
            "jumpsuit jumpsuit outer outer"
            "id belt outer outer"
            "gloves gloves shoes shoes";
        gap: 0.72rem;
    }

    .character-slot-button {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0.38rem;
        min-height: 6.2rem;
        padding: 0.8rem 0.85rem 0.9rem;
        border-radius: 1rem;
        border: 1px solid rgba(93, 130, 160, 0.36);
        background:
            linear-gradient(180deg, rgba(28, 44, 60, 0.94), rgba(13, 20, 28, 0.96)),
            radial-gradient(circle at top left, rgba(133, 192, 231, 0.16), rgba(133, 192, 231, 0));
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 14px 28px rgba(0, 0, 0, 0.28);
        color: inherit;
        text-align: left;
        cursor: pointer;
        transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    }

    .character-slot-button:hover {
        transform: translateY(-1px);
        border-color: rgba(132, 180, 216, 0.58);
        box-shadow: inset 0 0 0 1px rgba(173, 219, 255, 0.08), 0 18px 32px rgba(0, 0, 0, 0.34);
    }

    .character-slot-button.is-selected {
        border-color: rgba(166, 222, 255, 0.78);
        box-shadow: inset 0 0 0 1px rgba(211, 243, 255, 0.18), 0 18px 34px rgba(0, 0, 0, 0.36);
    }

    .character-slot-button.is-filled {
        background:
            linear-gradient(180deg, rgba(35, 54, 73, 0.96), rgba(16, 25, 36, 0.98)),
            radial-gradient(circle at top left, rgba(154, 218, 255, 0.2), rgba(154, 218, 255, 0));
    }

    .character-slot-header {
        display: flex;
        align-items: center;
        gap: 0.62rem;
        width: 100%;
    }

    .character-slot-icon-shell {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        border-radius: 0.7rem;
        background: rgba(6, 13, 19, 0.58);
        border: 1px solid rgba(133, 183, 219, 0.28);
        flex-shrink: 0;
    }

    .character-slot-icon {
        width: 1.2rem;
        height: 1.2rem;
        object-fit: contain;
    }

    .character-slot-short {
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
    }

    .character-slot-name {
        font-size: 0.88rem;
        font-weight: 700;
        color: rgba(240, 248, 255, 0.96);
    }

    .character-slot-item {
        font-size: 0.92rem;
        line-height: 1.3;
        color: rgba(228, 237, 245, 0.94);
    }

    .character-slot-meta {
        margin-top: auto;
        font-size: 0.74rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(144, 180, 206, 0.76);
    }

    .character-item-row {
        align-items: center;
    }

    .character-item-icon-shell {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 3rem;
        height: 3rem;
        margin-right: 0.9rem;
        border-radius: 0.9rem;
        border: 1px solid rgba(97, 137, 167, 0.32);
        background: radial-gradient(circle at top, rgba(143, 205, 244, 0.16), rgba(143, 205, 244, 0.02));
        flex-shrink: 0;
    }

    .character-item-icon {
        width: 2.25rem;
        height: 2.25rem;
        object-fit: contain;
        image-rendering: pixelated;
    }

    .character-item-icon-fallback {
        font-size: 1rem;
        font-weight: 800;
        color: rgba(241, 248, 255, 0.92);
    }

    .character-item-meta,
    .character-extra-meta {
        margin-top: 0.18rem;
        font-size: 0.75rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: rgba(150, 185, 208, 0.72);
    }

    /* Small card grid display for catalog */
    .character-item-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
        gap: 0.65rem;
        overflow: auto;
        padding: 0.35rem 0;
    }

    .character-item-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 0.35rem;
        padding: 0.6rem 0.5rem;
        border-radius: 0.8rem;
        border: 1px solid rgba(97, 137, 167, 0.28);
        background: rgba(3, 6, 10, 0.72);
        cursor: pointer;
        transition: all 120ms ease;
    }

    .character-item-card:hover {
        border-color: rgba(132, 180, 216, 0.48);
        background: rgba(10, 15, 22, 0.84);
        transform: translateY(-2px);
    }

    .character-item-card.is-active {
        border-color: rgba(80, 171, 121, 0.72);
        background: rgba(17, 29, 23, 0.88);
        box-shadow: inset 0 0 0 1px rgba(80, 171, 121, 0.3);
    }

    .character-item-box-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 3.2rem;
        border-radius: 0.6rem;
        background: rgba(5, 10, 15, 0.64);
        border: 1px solid rgba(107, 153, 183, 0.16);
    }

    .character-item-box-img {
        width: 2.5rem;
        height: 2.5rem;
        object-fit: contain;
        image-rendering: pixelated;
    }

    .character-item-box-name {
        font-size: 0.72rem;
        font-weight: 600;
        text-align: center;
        color: rgba(230, 240, 250, 0.88);
        line-height: 1.2;
        word-break: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .character-extras-list {
        display: grid;
        gap: 0.55rem;
    }

    .character-extra-row {
        padding: 0.6rem 0.7rem;
        border-radius: 0.8rem;
        background: rgba(7, 12, 18, 0.34);
        border: 1px solid rgba(117, 155, 182, 0.16);
    }

    .character-extra-main {
        display: block;
        color: rgba(238, 246, 255, 0.94);
        font-weight: 600;
    }

    .character-detail-shell .recipe-detail-column {
        gap: 1rem;
    }

    @media (max-width: 980px) {
        .character-slot-board {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            grid-template-areas:
                "head eyes"
                "mask ears"
                "neck back"
                "jumpsuit outer"
                "id belt"
                "gloves shoes";
        }
    }

.feedback-popup {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1200;
    max-width: min(30rem, calc(100vw - 2rem));
    animation: feedback-pulse 2.8s ease-in-out infinite;
}

.feedback-popup-card {
    background:
        linear-gradient(135deg, rgba(58, 95, 69, 0.18), rgba(22, 30, 39, 0.08) 38%, rgba(14, 18, 24, 0.88) 75%),
        var(--panel-bg);
    border: 1px solid rgba(129, 170, 139, 0.42);
    border-left: 3px solid rgba(143, 201, 156, 0.9);
    border-radius: 0.35rem;
    padding: 0.72rem 0.78rem;
    box-shadow: 0 0.55rem 1.4rem rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(133, 177, 145, 0.24), 0 0 1.1rem rgba(99, 156, 118, 0.24);
}

.feedback-popup-kicker {
    display: inline-block;
    margin-bottom: 0.26rem;
    padding: 0.1rem 0.35rem;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    color: rgba(205, 231, 214, 0.95);
    background: rgba(86, 126, 96, 0.35);
    border: 1px solid rgba(129, 170, 139, 0.48);
    border-radius: 0.22rem;
}

.feedback-popup-title {
    font-size: 1.01rem;
    font-weight: 700;
    color: rgba(237, 248, 242, 0.98);
    margin-bottom: 0.18rem;
}

.feedback-popup-copy {
    color: rgba(192, 210, 199, 0.95);
    font-size: 0.8rem;
    margin-bottom: 0.45rem;
}

.feedback-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.feedback-fast-badge {
    display: inline-block;
    padding: 0.08rem 0.34rem;
    font-size: 0.66rem;
    font-weight: 700;
    color: rgba(225, 244, 231, 0.96);
    background: rgba(92, 136, 104, 0.42);
    border: 1px solid rgba(136, 178, 146, 0.52);
    border-radius: 0.2rem;
    white-space: nowrap;
}

.feedback-progress-text {
    font-size: 0.73rem;
    color: rgba(190, 214, 197, 0.95);
    text-align: right;
}

.feedback-progress-track {
    height: 0.24rem;
    width: 100%;
    border-radius: 999px;
    background: rgba(32, 45, 37, 0.7);
    border: 1px solid rgba(109, 147, 119, 0.45);
    overflow: hidden;
    margin-bottom: 0.45rem;
}

.feedback-progress-fill {
    height: 100%;
    width: 18%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(116, 176, 130, 0.9), rgba(181, 225, 190, 0.88));
    transition: width 180ms ease;
}

.rating {
    display: flex;
    gap: 0.6rem;
    margin: 0 0 0.45rem;
}

.rating-button {
    background: rgba(10, 15, 20, 0.4);
    border: 1px solid rgba(129, 170, 139, 0.42);
    font-size: 1.15rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.22rem 0.55rem;
    border-radius: 0.3rem;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.rating-button:hover {
    background: rgba(76, 113, 86, 0.34);
    border-color: rgba(161, 205, 173, 0.72);
    transform: translateY(-1px);
}

.rating-button.selected {
    background: rgba(86, 133, 95, 0.78);
    border-color: rgba(184, 224, 194, 0.9);
}

#feedback-comment {
    width: 100%;
    min-height: 3.4rem;
    max-height: 7rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(129, 170, 139, 0.4);
    color: var(--text-main);
    padding: 0.45rem;
    border-radius: 0.28rem;
    resize: vertical;
    margin-bottom: 0.45rem;
}

#feedback-comment:focus {
    outline: none;
    border-color: rgba(176, 217, 187, 0.86);
    box-shadow: 0 0 0 1px rgba(176, 217, 187, 0.3);
}

.feedback-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.feedback-actions .panel-action {
    border-radius: 0.3rem;
    padding: 0.35rem 0.55rem;
}

.feedback-actions .panel-action.primary {
    box-shadow: 0 0 0 1px rgba(164, 208, 176, 0.45);
}

@keyframes feedback-pulse {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
    100% {
        transform: translateY(0);
    }
}

.feedback-popup.hidden {
    display: none;
}

@media (max-width: 720px) {
    .feedback-popup {
        right: 0.6rem;
        bottom: 0.6rem;
        left: 0.6rem;
        max-width: none;
        animation: none;
    }

    .tutorial-card,
    .tutorial-card.tutorial-card-pos-top-left,
    .tutorial-card.tutorial-card-pos-top-right,
    .tutorial-card.tutorial-card-pos-bottom-left,
    .tutorial-card.tutorial-card-pos-bottom-right {
        top: auto;
        right: 0.6rem;
        bottom: 0.6rem;
        left: 0.6rem;
        width: auto;
        max-height: min(36rem, calc(100vh - 1.2rem));
    }
}

.feedback-section {
    margin-top: 2rem;
}

.feedback-section h3 {
    color: var(--text-main);
    margin-bottom: 1rem;
}

.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-item {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.feedback-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.feedback-rating {
    font-size: 1.5rem;
}

.feedback-source {
    color: var(--accent-soft);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.feedback-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.feedback-delete {
    margin-left: auto;
    background: var(--button-caution);
    color: var(--text-main);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.feedback-comment {
    color: var(--text-main);
}

.feedback-meta {
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.45;
    margin-bottom: 0.55rem;
}

.viewer-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.viewer-breakdown-row {
    display: flex;
    align-items: stretch;
    color: var(--text-main);
    font-size: 0.9rem;
}

.viewer-breakdown-main {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    width: 100%;
}

.viewer-breakdown-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.viewer-breakdown-row strong {
    color: var(--accent-soft);
}

.viewer-breakdown-bar {
    width: 100%;
    height: 0.42rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.viewer-breakdown-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(108, 193, 255, 0.7), rgba(164, 246, 170, 0.78));
}

@media (max-width: 1100px) {
    .viewer-stats-grid-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .viewer-stats-grid-wide {
        grid-template-columns: 1fr;
    }

    .viewer-section-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .viewer-section-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .viewer-breakdown-label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .viewer-stats-recent-item {
        flex-direction: column;
        align-items: flex-start;
    }
}