:root {
    color-scheme: dark;
}
* {
    box-sizing: border-box;
}
html, body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg, #070910);
    color: var(--text, #fff);
    overflow-x: hidden;
}
body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 15%, rgba(255,255,255,.12), transparent 26rem),
        radial-gradient(circle at 20% 80%, rgba(207,32,48,.16), transparent 24rem),
        var(--bg, #070910);
}
a {
    color: inherit;
}
.site-header,
.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}
.site-header {
    padding: 24px 0 10px;
}
.brand {
    display: flex;
    gap: 16px;
    align-items: center;
}
.logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
}
h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 3.2rem);
    letter-spacing: -.04em;
}
.brand p {
    margin: 4px 0 0;
    opacity: .72;
}
.app {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}
.control-panel,
.meta-box,
.empty-box {
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--accent, #cf2030), white 18%);
    background: rgba(255,255,255,.06);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.24);
    backdrop-filter: blur(12px);
}
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.hint {
    opacity: .92;
}
.buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
button {
    border: 1px solid color-mix(in srgb, var(--accent, #cf2030), white 22%);
    color: var(--text, #fff);
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent, #cf2030), white 12%), var(--accent, #cf2030));
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0,0,0,.28);
}
button:hover {
    filter: brightness(1.08);
}
.stage {
    position: relative;
    height: min(74vh, 720px);
    min-height: 470px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,.13);
    background:
        linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.025)),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,.16), transparent 27rem);
    box-shadow: inset 0 0 90px rgba(0,0,0,.42), 0 24px 80px rgba(0,0,0,.36);
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.stage:active {
    cursor: grabbing;
}
.stage::before {
    content: "";
    position: absolute;
    inset: auto 12% 9% 12%;
    height: 36px;
    background: radial-gradient(ellipse, rgba(0,0,0,.48), transparent 70%);
    filter: blur(8px);
    pointer-events: none;
}
.scene {
    width: 1px;
    height: 1px;
    transform-style: preserve-3d;
    perspective: 1350px;
    perspective-origin: 50% 45%;
}
.ring {
    position: relative;
    width: 1px;
    height: 1px;
    transform-style: preserve-3d;
    will-change: transform;
}
.card {
    position: absolute;
    left: calc(var(--card-w) / -2);
    top: calc(var(--card-h) / -2);
    width: var(--card-w);
    height: var(--card-h);
    transform-style: preserve-3d;
    transform: rotateY(var(--angle)) translateZ(var(--radius));
}
.face {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.35);
    box-shadow: 0 18px 40px rgba(0,0,0,.36);
    background: rgba(255,255,255,.08);
    backface-visibility: hidden;
}
.face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.front {
    transform: translateZ(1px);
}
.back {
    transform: rotateY(180deg) translateZ(1px);
    filter: brightness(.62) saturate(.85);
}
.back img {
    transform: scaleX(-1);
}
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: linear-gradient(90deg, rgba(0,0,0,.32), transparent 45%, rgba(255,255,255,.08));
    transform: translateZ(2px);
    pointer-events: none;
}
.meta-box {
    opacity: .82;
    font-size: .95rem;
}
.empty-box {
    min-height: 240px;
    display: grid;
    place-items: center;
    text-align: center;
}
code {
    background: rgba(255,255,255,.1);
    padding: 2px 7px;
    border-radius: 8px;
}
.site-footer {
    padding: 22px 0 30px;
    display: flex;
    justify-content: center;
    gap: 10px;
    opacity: .7;
    flex-wrap: wrap;
}
@media (max-width: 760px) {
    .stage {
        min-height: 430px;
    }
    .control-panel {
        align-items: stretch;
    }
    .buttons, button {
        width: 100%;
    }
}
