.stock-scene {
    --stock-s-ink: #1f3b31;
    --stock-s-muted: #4a675c;
    --stock-s-line: #b9cdbf;
    --stock-s-mint: #dbeed5;
    --stock-s-green: #397657;
    --stock-s-paper: #fffdf3;
    --stock-s-peach: #f8e2ce;
    display: grid;
    place-items: center;
    min-height: 226px;
    padding: 14px;
    color: var(--stock-s-ink);
    font-variant-numeric: tabular-nums;
}

.stock-scene :is(.stock-s-ownership, .stock-s-hypothesis, .stock-s-profit, .stock-s-match,
                .stock-s-trade, .stock-s-dividend, .stock-s-compare, .stock-s-ending) {
    width: min(100%, 560px);
    min-width: 0;
}

.stock-s-ownership,
.stock-s-hypothesis {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    gap: clamp(5px, 2vw, 22px);
}

.stock-s-arrow { color: var(--stock-s-green); font-size: clamp(18px, 3.5vw, 34px); }

.stock-s-shop {
    width: min(100%, 178px);
    padding-top: 10px;
    margin-top: 5px;
    animation: stock-s-arrive .42s ease-out both;
}

.stock-s-sign {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    width: 81%;
    min-height: 38px;
    margin: 0 auto -1px;
    border: 2px solid #678673;
    border-radius: 10px 10px 0 0;
    background: #fceec7;
    font-weight: 750;
    font-size: 15px;
    letter-spacing: .03em;
}

.stock-s-awning {
    position: relative;
    z-index: 1;
    height: clamp(19px, 3.9vw, 33px);
    margin-bottom: -4px;
    border: 2px solid #678673;
    border-radius: 10px 10px 7px 7px;
    background: repeating-linear-gradient(110deg, #86b38c 0 10%, #edf4dc 10% 20%);
    box-shadow: 0 3px 0 #4d705b27;
}

.stock-s-shopfront {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 10%;
    align-items: end;
    width: 92%;
    height: clamp(65px, 10vw, 97px);
    margin-inline: auto;
    padding: 13px 9% 0;
    border: 2px solid #678673;
    border-radius: 0 0 6px 6px;
    background: #fbebd3;
}

.stock-s-window {
    display: flex;
    gap: 7%;
    justify-content: center;
    align-items: end;
    align-self: start;
    height: 64%;
    padding-bottom: 3px;
    border: 2px solid #8ca89d;
    border-radius: 3px;
    background: #cce3db;
}

.stock-s-door {
    position: relative;
    align-self: stretch;
    border: 2px solid #80a194;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: #adccbf;
}

.stock-s-door::before {
    content: "";
    position: absolute;
    top: 52%;
    left: 14%;
    width: 15%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--stock-s-ink);
}

.stock-s-ground {
    height: 8px;
    margin: -1px 0 0;
    border-radius: 999px;
    background: #d0dbba;
}

.stock-s-cup {
    display: inline-block;
    width: 13px;
    height: 20px;
    background:
        linear-gradient(#45654f 0 3px, transparent 3px) 74% 0 / 2px 5px no-repeat,
        radial-gradient(circle at 33% 77%, #815747 0 8%, transparent 11%),
        radial-gradient(circle at 59% 89%, #815747 0 8%, transparent 11%),
        radial-gradient(circle at 71% 71%, #815747 0 8%, transparent 11%),
        linear-gradient(transparent 0 17%, #476340 17% 25%, #e1ba8f 25% 100%);
    clip-path: polygon(66% 0, 83% 0, 78% 19%, 100% 19%, 79% 100%, 21% 100%, 0 19%, 60% 19%);
}

.stock-s-shares { width: min(100%, 150px); }
.stock-s-shares-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 9px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--stock-s-muted);
}
.stock-s-shares-head strong { font-size: 19px; color: var(--stock-s-ink); }

.stock-s-equity {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 2px;
    padding: 5px;
    border: 1px solid var(--stock-s-line);
    border-radius: 7px;
    background: #fffef8;
}
.stock-s-equity i { aspect-ratio: 1; border-radius: 2px; background: #e2e9de; }
.stock-s-equity .is-yours {
    background: var(--stock-s-green);
    animation: stock-s-shares-light .45s ease-out both;
}

.stock-s-profit, .stock-s-dividend, .stock-s-trade, .stock-s-compare { display: grid; row-gap: 9px; }
.stock-s-revenue {
    display: flex;
    align-items: center;
    gap: clamp(12px, 4vw, 32px);
    padding: 10px 16px;
    border: 1px solid var(--stock-s-line);
    border-radius: 13px;
    background: var(--stock-s-paper);
}

.stock-s-sales { display: flex; gap: 9px; align-items: end; }
.stock-s-sales .stock-s-cup { width: clamp(12px, 3.4vw, 25px); height: clamp(22px, 5vw, 40px); }
.stock-s-sales i:nth-child(2) { transform: translateY(3px); }
.stock-s-revenue span, .stock-s-income-labels span, .stock-s-money-card span { color: var(--stock-s-muted); font-size: 13px; }
.stock-s-revenue strong, .stock-s-income-labels strong, .stock-s-money-card b { display: block; font-size: clamp(18px, 2.7vw, 28px); line-height: 1.2; }
.stock-s-revenue small, .stock-s-income-labels small, .stock-s-money-card small { font-size: 12px; }

.stock-s-income-result { min-width: 0; }
.stock-s-income-bar {
    display: flex;
    height: 15px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--stock-s-green);
}
.stock-s-income-bar.is-split i:first-child { width: 80%; background: #dbab8e; animation: stock-s-grow .55s ease-out both; }
.stock-s-income-bar.is-split i:last-child { flex: 1; background: var(--stock-s-green); }
.stock-s-income-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.stock-s-income-labels > div:last-child { text-align: end; }

.stock-s-dividend { justify-items: center; }
.stock-s-dividend-total {
    padding: 6px 11px;
    border: 1px solid var(--stock-s-line);
    border-radius: 999px;
    background: var(--stock-s-paper);
    font-size: 13px;
}
.stock-s-split { display: flex; width: 52%; height: 12px; margin: -9px 0; }
.stock-s-split i { flex: 1; border-bottom: 1px solid #8ca895; }
.stock-s-split i + i { border-left: 1px solid #8ca895; }
.stock-s-payouts, .stock-s-observations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.stock-s-money-card {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--stock-s-line);
    border-radius: 10px;
    background: var(--stock-s-paper);
    text-align: center;
}
.stock-s-money-card.is-payout { background: var(--stock-s-mint); }
.stock-s-money-card.is-down { border-color: #d9a786; background: var(--stock-s-peach); }
.stock-s-your-dividend, .stock-s-trade-worth {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 3px 12px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    color: #fffdf3;
    background: var(--stock-s-green);
    font-size: 13px;
    animation: stock-s-arrive .42s ease-out both;
}

.stock-s-match {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}
.stock-s-match > span { color: var(--stock-s-green); font-size: 27px; }
.stock-s-match-price {
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 3px;
    padding: 8px 13px;
    border-radius: 999px;
    background: var(--stock-s-mint);
    animation: stock-s-arrive .42s ease-out both;
}

.stock-s-plot-title { color: var(--stock-s-muted); font-size: 13px; }
.stock-s-plot {
    position: relative;
    height: 104px;
    margin: 0 11px 9px;
    border-bottom: 1px solid #829b8d;
    background: repeating-linear-gradient(0deg, transparent 0 25px, #b9cdbf81 25px 26px);
}
.stock-s-trade-rise {
    position: absolute;
    width: 74%;
    height: calc(54% + 4px);
    left: 13%;
    bottom: calc(20% - 2px);
    background: var(--stock-s-green);
    clip-path: polygon(0 91%, 100% 0, 100% 9%, 0 100%);
    animation: stock-s-trace .55s ease-out both;
}
.stock-s-trade-point { position: absolute; width: 10px; height: 10px; transform: translate(-50%, 50%); }
.stock-s-trade-point b, .stock-s-trade-point span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.stock-s-trade-point b { bottom: 12px; font-size: 14px; }
.stock-s-trade-point span { top: 12px; font-size: 11px; color: var(--stock-s-muted); }
.stock-s-trade-point i { display: block; width: 100%; height: 100%; border: 2px solid #fffdf3; border-radius: 50%; background: var(--stock-s-green); }
.stock-s-trade-point.is-first { left: 13%; bottom: 20%; }
.stock-s-trade-point.is-latest { left: 87%; bottom: 74%; animation: stock-s-point .35s .22s both; }

.stock-s-event {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 8px;
    min-height: 110px;
    width: 100%;
    padding: 6px 5px;
    border: 1px solid var(--stock-s-line);
    border-radius: 14px;
    background: var(--stock-s-paper);
    text-align: center;
    font-size: 14px;
}
.stock-s-event i { height: 42px; font-style: normal; }
.stock-s-maybe { font-size: 24px; font-weight: 750; color: var(--stock-s-green); }
.stock-s-mall {
    width: 48px;
    border: 2px solid #678673;
    border-radius: 5px 5px 2px 2px;
    background:
        linear-gradient(#547e6b 0 0) center bottom / 11px 10px no-repeat,
        repeating-linear-gradient(90deg, transparent 0 6px, #d3e6d2 6px 12px) center / 95% 60% no-repeat,
        #84a9a0;
}
.stock-s-rise-icon { font-size: 37px; line-height: 1; color: var(--stock-s-green); animation: stock-s-arrive .42s ease-out both; }

.stock-s-choices { display: flex; gap: 6px; flex-wrap: wrap; }
.stock-s-choices button {
    min-height: 37px;
    padding: 5px 10px;
    border: 1px solid #a7c2ad;
    border-radius: 8px;
    background: var(--stock-s-paper);
    color: var(--stock-s-ink);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.stock-s-choices button[aria-pressed="true"] { border-color: var(--stock-s-green); background: var(--stock-s-mint); font-weight: 700; }
.stock-s-choices button:focus-visible { outline: 2px solid var(--stock-s-green); outline-offset: 2px; }
.stock-s-result { font-size: 13px; color: var(--stock-s-muted); }

.stock-s-ending { display: grid; gap: 8px; }
.stock-s-ledger {
    width: 100%;
    border: 1px solid var(--stock-s-line);
    border-radius: 9px;
    border-spacing: 0;
    overflow: hidden;
    background: var(--stock-s-paper);
    font-size: clamp(12px, 1.65vw, 15px);
}
.stock-s-ledger caption {
    padding: 0 0 5px;
    color: var(--stock-s-muted);
    text-align: start;
    font-size: 13px;
    font-weight: 700;
}
.stock-s-ledger :is(th, td) {
    padding: 5px clamp(6px, 1.9vw, 14px);
    border-bottom: 1px solid #dfe7d9;
    text-align: end;
    white-space: nowrap;
}
.stock-s-ledger th:first-child { text-align: start; }
.stock-s-ledger thead { background: #eaf0e2; }
.stock-s-ledger-profit :is(th, td) {
    border-bottom: 0;
    background: var(--stock-s-peach);
    font-weight: 750;
}
.stock-s-ledger-total {
    color: var(--stock-s-muted);
    font-size: clamp(12px, 1.75vw, 15px);
    line-height: 1.4;
    animation: stock-s-arrive .42s ease-out both;
}
.stock-s-order { display: grid; gap: 5px; }
.stock-s-order-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(3px, 1vw, 10px);
}
.stock-s-order-card {
    display: grid;
    align-content: center;
    gap: 2px;
    align-self: stretch;
    padding: 6px 3px;
    border: 1px solid var(--stock-s-line);
    border-radius: 8px;
    background: var(--stock-s-paper);
    text-align: center;
    font-size: clamp(12px, 1.65vw, 15px);
}
.stock-s-order-card span { color: var(--stock-s-muted); font-size: 11px; }
.stock-s-order-card.is-filled {
    border-color: #88aa8e;
    background: var(--stock-s-mint);
    animation: stock-s-arrive .42s .16s ease-out both;
}
.stock-s-order-arrow { color: var(--stock-s-green); font-size: clamp(12px, 2vw, 20px); }
.stock-s-trade-swing {
    position: absolute;
    inset: 0 15%;
    animation: stock-s-reveal .58s ease-out both;
}
.stock-s-trade-swing::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--stock-s-green) 50%, #a9603b 50%);
    clip-path: polygon(0 78.5%, 50% 24.5%, 100% 51.5%, 100% 54.5%, 50% 27.5%, 0 81.5%);
}
.stock-s-plot.is-ending .is-first { left: 15%; }
.stock-s-plot.is-ending .is-peak { left: 50%; bottom: 74%; }
.stock-s-plot.is-ending .is-new-trade {
    left: 85%;
    bottom: 47%;
    animation: stock-s-point .32s .42s both;
}
.stock-s-plot.is-ending .is-new-trade i { background: #a9603b; }
.stock-s-balance {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.stock-s-balance .stock-s-money-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 11px 4px;
    animation: stock-s-arrive .42s ease-out both;
}
.stock-s-balance .stock-s-money-card:nth-child(2) { animation-delay: .08s; }
.stock-s-balance .stock-s-money-card:nth-child(3) { animation-delay: .16s; }
.stock-s-balance .stock-s-money-card span {
    display: grid;
    align-items: center;
    min-height: 2.5em;
    line-height: 1.25;
}
.stock-s-balance .stock-s-money-card b { white-space: nowrap; }
.stock-s-balance-note { margin: 3px 0 0; color: var(--stock-s-muted); font-size: 13px; text-align: center; }

@keyframes stock-s-arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes stock-s-shares-light { from { background: #e2e9de; } to { background: var(--stock-s-green); } }
@keyframes stock-s-grow { from { width: 0; } to { width: 80%; } }
@keyframes stock-s-trace {
    from { clip-path: polygon(0 91%, 0 91%, 0 100%, 0 100%); }
    to { clip-path: polygon(0 91%, 100% 0, 100% 9%, 0 100%); }
}
@keyframes stock-s-point { from { opacity: 0; } to { opacity: 1; } }
@keyframes stock-s-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }

@media (max-width: 410px) {
    .stock-scene { min-height: 200px; padding: 8px; }
    .stock-s-shares-head { line-height: 1.15; }
    .stock-s-choices button { padding-inline: 7px; }
    .stock-s-balance .stock-s-money-card span { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .stock-scene * { animation-duration: 0s !important; animation-delay: 0s !important; }
}
