*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --ncp-bg: #09090b;
    --ncp-surface: #111114;
    --ncp-surface-2: #18181b;
    --ncp-line: rgba(244, 244, 245, 0.12);
    --ncp-line-strong: rgba(251, 191, 36, 0.28);
    --ncp-text: #f4f4f5;
    --ncp-muted: #a1a1aa;
    --ncp-soft: #71717a;
    --ncp-rose: #f43f5e;
    --ncp-rose-dark: #9f1239;
    --ncp-amber: #fbbf24;
    --ncp-green: #34d399;
    --ncp-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ncp-serif: "Playfair Display", Georgia, serif;
}

html {
    background: var(--ncp-bg);
}

body.ncp-page {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background:
        linear-gradient(135deg, rgba(244, 63, 94, 0.12), transparent 34%),
        linear-gradient(315deg, rgba(251, 191, 36, 0.08), transparent 32%),
        var(--ncp-bg);
    color: var(--ncp-text);
    font-family: var(--ncp-font);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.ncp-page [hidden] {
    display: none !important;
}

button,
a {
    font: inherit;
}

button {
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

svg {
    display: block;
    width: 1.2em;
    height: 1.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ncp-app {
    min-height: 100vh;
    min-height: 100svh;
    isolation: isolate;
}

.ncp-app::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, transparent, black 18%, black 80%, transparent);
}

.ncp-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: calc(0.9rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.9rem max(1rem, env(safe-area-inset-left));
    background: rgba(9, 9, 11, 0.74);
    border-bottom: 1px solid var(--ncp-line);
    backdrop-filter: blur(18px);
}

.ncp-brand {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    color: var(--ncp-text);
    font-size: 0.95rem;
}

.ncp-back-button,
.ncp-secondary-action,
.ncp-primary-action {
    border-radius: 8px;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
    touch-action: manipulation;
}

.ncp-back-button:hover,
.ncp-secondary-action:hover {
    color: var(--ncp-text);
    border-color: rgba(244, 244, 245, 0.22);
    background: rgba(255, 255, 255, 0.075);
}

.ncp-back-button:active,
.ncp-secondary-action:active,
.ncp-primary-action:active,
.ncp-choice-button:active,
.ncp-suit-button:active {
    transform: translateY(1px) scale(0.99);
}

.ncp-view {
    display: none;
    min-height: 100vh;
    min-height: 100svh;
}

.ncp-view-active {
    display: block;
}

.ncp-selector-view.ncp-view-active {
    display: flex;
    align-items: center;
    padding: calc(5.7rem + env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.ncp-selector-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 2.5rem;
    align-items: center;
}

.ncp-kicker {
    margin: 0 0 0.85rem;
    color: var(--ncp-amber);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.ncp-selector-copy h1,
.ncp-reading-shell h1,
.ncp-outro-shell h1 {
    margin: 0;
    max-width: 12ch;
    color: var(--ncp-text);
    font-family: var(--ncp-serif);
    font-size: 4.4rem;
    line-height: 0.96;
    font-weight: 600;
}

.ncp-lede {
    max-width: 34rem;
    margin: 0.65rem 0 0;
    color: var(--ncp-muted);
    font-size: 1.05rem;
}

.ncp-byline {
    margin: 1rem 0 0;
    color: #fef3c7;
    font-family: var(--ncp-serif);
    font-size: 1.2rem;
    font-style: italic;
}

.ncp-mini-deck {
    position: relative;
    width: 13.5rem;
    height: 10.25rem;
    margin-top: 2rem;
}

.ncp-mini-card {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    width: 5.8rem;
    aspect-ratio: 2.5 / 3.5;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.02)),
        #18181b;
    box-shadow: 0 1.4rem 3rem rgba(0, 0, 0, 0.34);
    color: var(--ncp-amber);
    font-family: var(--ncp-serif);
    font-size: 2rem;
}

.ncp-mini-card-b {
    left: 4.1rem;
    top: 1.8rem;
    color: var(--ncp-rose);
    transform: rotate(5deg);
}

.ncp-mini-card-c {
    left: 7.2rem;
    top: 0;
    color: var(--ncp-green);
    transform: rotate(10deg);
}

.ncp-picker-panel {
    position: relative;
    overflow: hidden;
    padding: 1.15rem;
    border: 1px solid var(--ncp-line);
    border-radius: 8px;
    background:
        radial-gradient(circle at 18% 0%, rgba(251, 191, 36, 0.09), transparent 32%),
        radial-gradient(circle at 100% 100%, rgba(244, 63, 94, 0.11), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.082), rgba(255, 255, 255, 0.026)),
        rgba(15, 15, 18, 0.86);
    box-shadow: 0 1.8rem 4rem rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ncp-picker-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 28%, transparent 70%, rgba(251, 191, 36, 0.08));
    opacity: 0.8;
}

.ncp-picker[hidden] {
    display: none;
}

.ncp-picker {
    position: relative;
    z-index: 1;
}

.ncp-picker-heading {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    margin-bottom: 1.05rem;
}

.ncp-picker-heading > span,
.ncp-step-label span {
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 999px;
    color: var(--ncp-amber);
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid var(--ncp-line-strong);
    font-size: 0.82rem;
    font-weight: 700;
}

.ncp-picker-heading h2 {
    margin: 0;
    color: var(--ncp-text);
    font-size: 1.25rem;
}

.ncp-picker-heading p {
    margin: 0.15rem 0 0;
    color: var(--ncp-muted);
    font-size: 0.92rem;
}

.ncp-value-grid,
.ncp-suit-grid {
    display: grid;
    gap: 0.7rem;
}

.ncp-value-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

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

.ncp-choice-button,
.ncp-suit-button {
    min-height: 4.8rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--ncp-line);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.018)),
        rgba(9, 9, 11, 0.66);
    color: var(--ncp-text);
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease;
    touch-action: manipulation;
}

.ncp-choice-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ncp-choice-button strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 0.96rem;
    line-height: 1;
}

.ncp-value-corner {
    position: absolute;
    top: 0.52rem;
    left: 0.58rem;
    min-width: 1.15rem;
    min-height: 1.15rem;
    display: inline-grid;
    place-items: center;
    color: var(--ncp-amber);
    border-radius: 5px;
    background: rgba(251, 191, 36, 0.08);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.ncp-choice-button:hover,
.ncp-suit-button:hover,
.ncp-choice-button:focus-visible,
.ncp-suit-button:focus-visible {
    border-color: rgba(244, 63, 94, 0.62);
    background:
        linear-gradient(145deg, rgba(244, 63, 94, 0.15), rgba(251, 191, 36, 0.05)),
        rgba(244, 63, 94, 0.1);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

.ncp-suit-button {
    min-height: 10rem;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.8rem;
}

.ncp-suit-symbol {
    font-size: 4.25rem;
    line-height: 1;
}

.ncp-suit-name {
    color: var(--ncp-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.ncp-suit-red {
    color: var(--ncp-rose);
}

.ncp-suit-black {
    color: var(--ncp-text);
}

.ncp-back-button {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0 0.7rem;
    color: var(--ncp-muted);
    background: transparent;
    border: 1px solid transparent;
}

.ncp-simulator-view.ncp-view-active {
    display: flex;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding-top: calc(4.3rem + env(safe-area-inset-top));
    flex-direction: column;
    overflow: hidden;
}

.ncp-stage-copy {
    flex: 0 0 auto;
    max-height: 33vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--ncp-line);
    background: rgba(17, 17, 20, 0.8);
}

.ncp-stage-copy-inner {
    width: min(920px, 100%);
    margin: 0 auto;
    padding: 1.05rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
}

.ncp-step-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.ncp-step-label strong {
    color: var(--ncp-amber);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.ncp-stage-copy h2 {
    margin: 0 0 0.45rem;
    font-family: var(--ncp-serif);
    font-size: 1.65rem;
    line-height: 1.1;
}

.ncp-stage-copy h2:focus {
    outline: none;
}

.ncp-stage-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.ncp-target-strip {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(244, 63, 94, 0.32);
    border-radius: 8px;
    background: rgba(244, 63, 94, 0.09);
}

.ncp-target-mini {
    width: 2.5rem;
    aspect-ratio: 2.5 / 3.5;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    align-content: center;
    border-radius: 6px;
    border: 1px solid rgba(159, 18, 57, 0.35);
    background: #fffaf0;
    color: #9f1239;
    box-shadow: 0 0.5rem 1.2rem rgba(0, 0, 0, 0.24);
}

.ncp-target-mini strong {
    font-size: 0.58rem;
    line-height: 1;
}

.ncp-target-mini span {
    font-size: 1.2rem;
    line-height: 1;
}

.ncp-target-copy {
    min-width: 0;
    display: grid;
    gap: 0.04rem;
}

.ncp-target-copy > span {
    color: var(--ncp-amber);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.ncp-target-copy strong {
    overflow: hidden;
    color: var(--ncp-text);
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ncp-target-copy small {
    overflow: hidden;
    color: var(--ncp-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ncp-history-controls {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem;
    border: 1px solid var(--ncp-line);
    border-radius: 8px;
    background: rgba(9, 9, 11, 0.42);
}

.ncp-history-controls > span {
    min-width: 3.7rem;
    color: var(--ncp-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

.ncp-step-button {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    color: var(--ncp-text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ncp-line);
    cursor: pointer;
}

.ncp-step-button:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

.ncp-explanation {
    color: var(--ncp-muted);
    font-size: 0.95rem;
}

.ncp-explanation p {
    margin: 0.35rem 0 0;
}

.ncp-explanation strong,
.ncp-explanation b {
    color: var(--ncp-text);
}

.ncp-explanation mark {
    padding: 0.08rem 0.25rem;
    border-radius: 5px;
    color: var(--ncp-amber);
    background: rgba(251, 191, 36, 0.11);
}

.ncp-board-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem max(0.6rem, env(safe-area-inset-right)) 0.75rem max(0.6rem, env(safe-area-inset-left));
}

.ncp-board {
    position: relative;
    width: min(920px, 100%);
    height: 100%;
    max-height: 27rem;
    min-height: 17rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        rgba(7, 7, 9, 0.58);
    background-size: 30px 30px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.ncp-zone-label {
    position: absolute;
    left: 0.65rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--ncp-line);
    border-radius: 6px;
    background: rgba(9, 9, 11, 0.78);
    color: var(--ncp-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.ncp-zone-label span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--ncp-muted);
}

.ncp-zone-label strong {
    color: var(--ncp-text);
}

.ncp-zone-hand {
    top: 0.7rem;
}

.ncp-zone-table {
    top: 52%;
}

.ncp-zone-table span {
    background: var(--ncp-rose);
}

.ncp-cards-layer {
    position: absolute;
    inset: 0;
}

.ncp-card {
    position: absolute;
    width: clamp(40px, 12%, 82px);
    aspect-ratio: 2.5 / 3.5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03)),
        var(--ncp-surface-2);
    box-shadow: 0 0.9rem 1.6rem rgba(0, 0, 0, 0.32);
    transform: translateZ(0);
    transition:
        left 320ms cubic-bezier(0.22, 1, 0.36, 1),
        top 320ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 220ms ease,
        background 220ms ease,
        border-color 220ms ease,
        box-shadow 220ms ease;
    will-change: left, top;
}

.ncp-card-target {
    z-index: 8;
    color: #9f1239;
    background: #fffaf0;
    border-color: rgba(244, 63, 94, 0.78);
    box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.16), 0 0.9rem 2rem rgba(244, 63, 94, 0.18);
    transform: translateZ(0) scale(1.08);
}

.ncp-card-target .ncp-card-face {
    color: #9f1239;
}

.ncp-card-revealed {
    z-index: 12;
    background: #fffaf0;
    border-color: rgba(244, 63, 94, 0.95);
    box-shadow: 0 0 2.2rem rgba(244, 63, 94, 0.42);
    transform: translateZ(0) scale(1.12);
}

.ncp-card-revealed .ncp-card-face {
    color: #9f1239;
}

.ncp-card-face,
.ncp-card-back {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 8px;
}

.ncp-card-face {
    gap: 0.1rem;
    align-content: center;
    font-weight: 800;
}

.ncp-card-value {
    color: currentColor;
    font-size: 0.76rem;
}

.ncp-card-suit {
    color: currentColor;
    font-size: 2rem;
    line-height: 1;
}

.ncp-card-back {
    padding: 0.45rem;
    opacity: 0.28;
}

.ncp-card-back::before {
    content: "";
    width: 100%;
    height: 100%;
    border-radius: 5px;
    border: 1px solid rgba(244, 244, 245, 0.58);
    background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(244, 244, 245, 0.5) 3px, rgba(244, 244, 245, 0.5) 5px);
}

.ncp-card-position,
.ncp-letter-badge {
    position: absolute;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    font-weight: 800;
}

.ncp-card-position {
    top: -0.5rem;
    right: -0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    color: white;
    background: var(--ncp-rose);
    font-size: 0.65rem;
    box-shadow: 0 0 0 2px var(--ncp-bg);
}

.ncp-letter-badge {
    left: 50%;
    bottom: -1.8rem;
    width: 1.55rem;
    height: 1.55rem;
    color: #4c0519;
    background: #fff7ed;
    border: 1px solid rgba(244, 63, 94, 0.32);
    font-size: 0.78rem;
    transform: translateX(-50%);
}

.ncp-action-bar {
    flex: 0 0 auto;
    min-height: calc(5.8rem + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem max(1rem, env(safe-area-inset-right)) max(0.85rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    border-top: 1px solid var(--ncp-line);
    background: rgba(17, 17, 20, 0.92);
}

.ncp-primary-action,
.ncp-secondary-action {
    min-height: 3.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0 1.25rem;
    font-weight: 700;
}

.ncp-primary-action {
    width: min(28rem, 100%);
    color: white;
    background: linear-gradient(135deg, var(--ncp-rose), var(--ncp-rose-dark));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 1rem 2rem rgba(159, 18, 57, 0.22);
}

.ncp-primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 1.25rem 2.3rem rgba(159, 18, 57, 0.3);
}

.ncp-primary-action:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}

.ncp-secondary-action {
    color: var(--ncp-text);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--ncp-line);
}

.ncp-inline-action {
    width: auto;
}

.ncp-story-view.ncp-view-active,
.ncp-outro-view.ncp-view-active {
    display: flex;
    align-items: center;
    padding: calc(6.5rem + env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.ncp-reading-shell,
.ncp-outro-shell {
    width: min(980px, 100%);
    margin: 0 auto;
}

.ncp-reading-shell h1,
.ncp-outro-shell h1 {
    max-width: 16ch;
    font-size: 3.45rem;
}

.ncp-story-lede {
    max-width: 44rem;
    margin: 1rem 0 0;
    color: var(--ncp-muted);
    font-size: 1.02rem;
}

.ncp-story-progress {
    width: min(34rem, 100%);
    height: 0.28rem;
    margin-top: 1.25rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.ncp-story-progress span {
    display: block;
    width: 16.666%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--ncp-amber), var(--ncp-rose));
    transition: width 220ms ease;
}

.ncp-story-deck {
    position: relative;
    width: min(42rem, 100%);
    margin-top: 1.2rem;
}

.ncp-reading-block,
.ncp-outro-panel {
    border: 1px solid var(--ncp-line);
    border-radius: 8px;
    background: rgba(17, 17, 20, 0.76);
    box-shadow: 0 1.2rem 2.8rem rgba(0, 0, 0, 0.24);
}

.ncp-reading-block {
    min-height: 17rem;
    display: grid;
    align-content: center;
    padding: clamp(1.25rem, 3vw, 2rem);
}

.ncp-story-card-active {
    animation: ncpStoryIn 220ms ease both;
}

.ncp-reading-block h2 {
    margin: 0 0 0.65rem;
    color: var(--ncp-amber);
    font-family: var(--ncp-serif);
    font-size: 1.4rem;
}

.ncp-reading-block p {
    margin: 0 0 0.75rem;
    color: var(--ncp-muted);
}

.ncp-reading-block strong,
.ncp-outro-panel strong {
    color: var(--ncp-text);
}

.ncp-reading-block em {
    color: #fef3c7;
}

.ncp-reading-block p:last-child {
    margin-bottom: 0;
}

.ncp-reading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.ncp-story-controls {
    width: min(42rem, 100%);
    display: grid;
    grid-template-columns: minmax(6rem, auto) 1fr minmax(9rem, auto);
    grid-template-areas: "story-prev story-label story-next";
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.ncp-story-controls [data-action="story-prev"] {
    grid-area: story-prev;
}

.ncp-story-controls > span {
    grid-area: story-label;
    color: var(--ncp-muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-align: center;
}

.ncp-story-controls [data-action="story-next"] {
    grid-area: story-next;
}

.ncp-story-controls .ncp-primary-action,
.ncp-story-controls .ncp-secondary-action {
    width: 100%;
}

.ncp-story-controls .ncp-secondary-action:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.ncp-outro-view.ncp-view-active {
    text-align: center;
}

.ncp-outro-shell {
    max-width: 760px;
}

.ncp-outro-shell h1 {
    margin-left: auto;
    margin-right: auto;
}

.ncp-seal {
    width: 4.3rem;
    height: 4.3rem;
    display: grid;
    place-items: center;
    margin: 0 auto 1.2rem;
    color: var(--ncp-amber);
    border-radius: 999px;
    border: 1px solid var(--ncp-line-strong);
    background: rgba(251, 191, 36, 0.1);
}

.ncp-seal svg {
    width: 2rem;
    height: 2rem;
}

.ncp-outro-panel {
    margin-top: 1.35rem;
    padding: 1.25rem;
    text-align: left;
}

.ncp-outro-panel p {
    margin: 0 0 1rem;
    color: var(--ncp-muted);
    font-size: 1.05rem;
}

.ncp-outro-panel dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 0;
}

.ncp-outro-panel dl div {
    padding: 0.85rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ncp-outro-panel dt {
    color: var(--ncp-amber);
    font-weight: 800;
}

.ncp-outro-panel dd {
    margin: 0.15rem 0 0;
    color: var(--ncp-muted);
}

.ncp-noscript {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 100;
    padding: 1rem;
    color: var(--ncp-text);
    background: var(--ncp-rose-dark);
    border-radius: 8px;
    text-align: center;
}

@media (max-width: 900px) {
    .ncp-selector-shell {
        grid-template-columns: 1fr;
        gap: 1.4rem;
    }

    .ncp-selector-copy h1 {
        max-width: 11ch;
        font-size: 3.5rem;
    }

    .ncp-mini-deck {
        display: none;
    }

    .ncp-picker-panel {
        min-height: 0;
    }

}

@media (max-width: 640px) {
    .ncp-brand {
        font-size: 0.85rem;
    }

    .ncp-selector-view.ncp-view-active,
    .ncp-story-view.ncp-view-active,
    .ncp-outro-view.ncp-view-active {
        align-items: flex-start;
    }

    .ncp-selector-copy h1,
    .ncp-reading-shell h1,
    .ncp-outro-shell h1 {
        font-size: 2.7rem;
        line-height: 1;
    }

    .ncp-lede {
        font-size: 0.98rem;
    }

    .ncp-value-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .ncp-choice-button {
        min-height: 3.9rem;
        padding: 0.55rem 0.4rem;
    }

    .ncp-choice-button strong {
        font-size: 0.78rem;
    }

    .ncp-value-corner {
        top: 0.42rem;
        left: 0.45rem;
        min-width: 1rem;
        min-height: 1rem;
        font-size: 0.58rem;
    }

    .ncp-suit-button {
        min-height: 8rem;
    }

    .ncp-suit-symbol {
        font-size: 3.45rem;
    }

    .ncp-stage-copy {
        max-height: 38vh;
    }

    .ncp-stage-copy h2 {
        font-size: 1.35rem;
    }

    .ncp-history-controls {
        justify-content: center;
    }

    .ncp-history-controls > span {
        min-width: 2.8rem;
    }

    .ncp-target-mini {
        display: none;
    }

    .ncp-target-strip {
        flex: 1 1 auto;
        min-width: 0;
    }

    .ncp-explanation {
        font-size: 0.86rem;
    }

    .ncp-board {
        min-height: 14rem;
        max-height: 20rem;
    }

    .ncp-zone-label {
        font-size: 0.62rem;
    }

    .ncp-card-value {
        font-size: 0.58rem;
    }

    .ncp-card-suit {
        font-size: 1.45rem;
    }

    .ncp-card-position {
        width: 1rem;
        height: 1rem;
        font-size: 0.54rem;
    }

    .ncp-letter-badge {
        bottom: -1.35rem;
        width: 1.2rem;
        height: 1.2rem;
        font-size: 0.62rem;
    }

    .ncp-primary-action,
    .ncp-secondary-action {
        min-height: 3rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ncp-story-view.ncp-view-active {
        align-items: flex-start;
    }

    .ncp-story-deck,
    .ncp-story-controls {
        width: 100%;
    }

    .ncp-reading-block {
        min-height: 15rem;
    }

    .ncp-story-controls {
        position: sticky;
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        z-index: 20;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "story-prev story-next"
            "story-label story-label";
        gap: 0.5rem 0.6rem;
        padding: 0.55rem;
        border: 1px solid var(--ncp-line);
        border-radius: 8px;
        background: rgba(9, 9, 11, 0.9);
        box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, 0.34);
        backdrop-filter: blur(18px);
    }

    .ncp-story-controls > span {
        font-size: 0.76rem;
        line-height: 1;
    }

    .ncp-outro-panel dl {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .ncp-selector-copy h1,
    .ncp-reading-shell h1,
    .ncp-outro-shell h1 {
        font-size: 2.3rem;
    }

    .ncp-choice-button {
        min-height: 3.3rem;
    }
}

@media (max-width: 350px) {
    .ncp-stage-copy {
        max-height: 47vh;
    }

    .ncp-stage-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0.45rem;
        margin: 0.5rem 0;
    }

    .ncp-target-strip {
        width: 100%;
        padding: 0.45rem 0.55rem;
    }

    .ncp-target-copy > span {
        display: none;
    }

    .ncp-history-controls {
        width: 100%;
        justify-content: space-between;
        padding: 0.25rem;
    }

    .ncp-stage-copy h2 {
        font-size: 1.2rem;
    }

    .ncp-explanation {
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .ncp-board {
        min-height: 9.5rem;
    }

    .ncp-action-bar {
        min-height: calc(4.8rem + env(safe-area-inset-bottom));
        padding-top: 0.55rem;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .ncp-topbar {
        padding-top: calc(0.55rem + env(safe-area-inset-top));
        padding-bottom: 0.55rem;
    }

    .ncp-simulator-view.ncp-view-active {
        padding-top: calc(3.65rem + env(safe-area-inset-top));
    }

    .ncp-stage-copy {
        max-height: 34vh;
    }

    .ncp-stage-copy-inner {
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }

    .ncp-step-label {
        margin-bottom: 0.35rem;
    }

    .ncp-stage-copy h2 {
        margin-bottom: 0.25rem;
        font-size: 1.15rem;
    }

    .ncp-stage-toolbar {
        margin: 0.4rem 0;
    }

    .ncp-target-strip {
        padding: 0.35rem 0.5rem;
    }

    .ncp-target-mini {
        width: 2rem;
    }

    .ncp-target-copy strong {
        font-size: 0.86rem;
    }

    .ncp-target-copy small,
    .ncp-explanation {
        font-size: 0.76rem;
    }

    .ncp-board {
        min-height: 8.5rem;
        max-height: none;
    }

    .ncp-action-bar {
        min-height: calc(4.5rem + env(safe-area-inset-bottom));
        padding-top: 0.55rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
    }
}

@keyframes ncpStoryIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
