:root {
    --bg-color: #040507;
    --glass-bg: rgba(13, 15, 22, 0.72);
    --glass-bg-strong: rgba(16, 19, 27, 0.88);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(217, 226, 255, 0.66);
    --text-muted: rgba(217, 226, 255, 0.4);
    --accent-cyan: rgba(96, 193, 255, 0.85);
    --accent-orange: rgba(255, 170, 84, 0.88);
    --accent-pink: rgba(255, 117, 166, 0.8);
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.35);
    --lizard-shift-x: -5px;
    --lizard-shift-y: 15px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 170, 84, 0.13), transparent 28%),
        radial-gradient(circle at 82% 12%, rgba(255, 117, 166, 0.1), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(96, 193, 255, 0.18), transparent 36%),
        var(--bg-color);
    color: var(--text-primary);
    font-family: "Inter", sans-serif;
}

body {
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.app {
    width: 100%;
    min-height: 100vh;
    padding: 24px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(340px, 430px) minmax(560px, 1fr);
    gap: 24px;
    width: min(1400px, 100%);
    min-height: calc(100vh - 48px);
    margin: 0 auto;
}

.ui-layer {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 18px;
    pointer-events: auto;
}

.header {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    padding: 24px;
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        var(--glass-bg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 280px;
}

.eyebrow {
    color: var(--accent-orange);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 0.95;
}

.hint {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.counter-box {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.counter-box.bump {
    border-color: rgba(96, 193, 255, 0.4);
    background: rgba(96, 193, 255, 0.12);
    animation: counter-bounce 420ms cubic-bezier(0.24, 0.78, 0.22, 1);
}

.counter-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.counter-value {
    min-width: 40px;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: right;
}

.composer-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    background: var(--glass-bg-strong);
}

.input-label {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.custom-input {
    width: 100%;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.custom-input:focus {
    border-color: rgba(96, 193, 255, 0.56);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.custom-input::placeholder {
    color: rgba(255, 255, 255, 0.28);
}

.preset-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.preset-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.preset-note {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.preset-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preset-chip {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    touch-action: manipulation;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.preset-chip:hover {
    border-color: rgba(255, 170, 84, 0.42);
    background: rgba(255, 170, 84, 0.12);
    transform: translateY(-1px);
}

.preset-chip:focus-visible {
    outline: 2px solid rgba(96, 193, 255, 0.6);
    outline-offset: 2px;
}

.preset-chip.active {
    border-color: rgba(96, 193, 255, 0.44);
    background: rgba(96, 193, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(96, 193, 255, 0.18);
}

.combo-board {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: auto;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(96, 193, 255, 0.06), rgba(255, 255, 255, 0.02)),
        rgba(10, 14, 22, 0.78);
    box-shadow: var(--shadow-lg);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.combo-board.live {
    border-color: rgba(96, 193, 255, 0.22);
    background:
        linear-gradient(180deg, rgba(96, 193, 255, 0.12), rgba(255, 255, 255, 0.02)),
        rgba(10, 14, 22, 0.88);
}

.combo-board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.combo-board-label {
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.combo-board-state {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.combo-board-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.combo-stat {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
}

.combo-stat-label {
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.combo-stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.combo-board-hint {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.scene {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 36px;
    background:
        radial-gradient(circle at 58% 18%, rgba(255, 255, 255, 0.06), transparent 26%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
        rgba(9, 11, 17, 0.56);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.scene::before {
    content: "";
    position: absolute;
    left: 52%;
    bottom: 4px;
    z-index: 1;
    width: min(760px, 76%);
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(
        ellipse at center,
        rgba(96, 193, 255, 0.24) 0%,
        rgba(96, 193, 255, 0.08) 44%,
        transparent 76%
    );
    filter: blur(30px);
    transform: translateX(-50%);
}

.scene::after {
    content: "";
    position: absolute;
    left: 52%;
    bottom: 18px;
    z-index: 1;
    width: min(620px, 62%);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-50%);
}

.scene.hit {
    border-color: rgba(96, 193, 255, 0.2);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(96, 193, 255, 0.04);
    background:
        radial-gradient(circle at 58% 18%, rgba(255, 255, 255, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
        rgba(9, 11, 17, 0.58);
}

.scene.hit::before {
    animation: stage-glow-burst 560ms cubic-bezier(0.24, 0.78, 0.22, 1);
}

.scene.hit::after {
    animation: stage-line-burst 560ms cubic-bezier(0.24, 0.78, 0.22, 1);
}

.scene-copy {
    position: absolute;
    top: 32px;
    left: 32px;
    z-index: 2;
    max-width: 280px;
    pointer-events: none;
}

.scene-copy-label {
    margin-bottom: 10px;
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.scene-copy-title {
    margin-bottom: 10px;
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.02;
}

.scene-copy-hint {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.lizard-scaler {
    --lizard-scale: 1;
    position: absolute;
    left: calc(61% + var(--lizard-shift-x));
    bottom: calc(-12px - var(--lizard-shift-y));
    z-index: 3;
    width: 630px;
    height: 550px;
    transform: translateX(-50%) scale(var(--lizard-scale));
    transform-origin: center bottom;
}

.lizard-floater {
    position: relative;
    width: 100%;
    height: 100%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.part {
    position: absolute;
    display: block;
    user-select: none;
    pointer-events: none;
    will-change: transform;
    -webkit-user-drag: none;
}

.phone {
    bottom: 0;
    left: 210px;
    z-index: 1;
    width: 420px;
    filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.5));
}

.body {
    bottom: 35px;
    left: 0;
    z-index: 3;
    width: 430px;
    filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.3));
}

.head {
    bottom: 345px;
    left: 185px;
    z-index: 5;
    width: 225px;
    transform-origin: 48% 88%;
}

.arm {
    bottom: 317px;
    left: 200px;
    z-index: 6;
    width: 150px;
    transform-origin: 9% 52%;
}

.scene.hit .phone {
    filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.54)) brightness(1.04);
}

.speech {
    position: absolute;
    right: 24px;
    bottom: 30px;
    z-index: 12;
    min-width: 150px;
    max-width: 220px;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    background: rgba(20, 20, 25, 0.72);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: center;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.94);
    transform-origin: center center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speech.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.flash {
    display: none;
}

@keyframes counter-bounce {
    0% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.06);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes stage-glow-burst {
    0% {
        opacity: 0.92;
        filter: blur(30px);
        transform: translateX(-50%) scale(1);
    }

    42% {
        opacity: 1;
        filter: blur(24px);
        transform: translateX(-50%) scale(1.05);
    }

    100% {
        opacity: 0.92;
        filter: blur(30px);
        transform: translateX(-50%) scale(1);
    }
}

@keyframes stage-line-burst {
    0% {
        opacity: 0.42;
        transform: translateX(-50%) scaleX(0.92);
    }

    45% {
        opacity: 0.78;
        transform: translateX(-50%) scaleX(1.04);
    }

    100% {
        opacity: 0.42;
        transform: translateX(-50%) scaleX(1);
    }
}

@media (max-width: 1280px) {
    .layout {
        grid-template-columns: minmax(320px, 400px) minmax(480px, 1fr);
    }

    .scene-copy {
        max-width: 240px;
    }

    .lizard-scaler {
        --lizard-scale: 0.92;
        left: calc(63% + var(--lizard-shift-x));
    }
}

@media (max-width: 1040px) {
    .app {
        padding: 18px;
    }

    .layout {
        grid-template-columns: minmax(300px, 360px) minmax(400px, 1fr);
        gap: 18px;
    }

    .header {
        padding: 20px;
        border-radius: 26px;
    }

    .combo-board {
        padding: 16px;
        border-radius: 22px;
    }

    .scene {
        border-radius: 30px;
    }

    .scene-copy {
        top: 24px;
        left: 24px;
        max-width: 190px;
    }

    .scene-copy-title {
        font-size: 28px;
    }

    .lizard-scaler {
        --lizard-scale: 0.82;
        left: calc(64% + var(--lizard-shift-x));
        bottom: calc(-14px - var(--lizard-shift-y));
    }

    .speech {
        right: 20px;
        bottom: 24px;
    }
}

@media (max-width: 900px) {
    .app {
        padding: 14px;
    }

    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 14px;
    }

    .ui-layer {
        gap: 14px;
    }

    .header {
        gap: 16px;
        padding: 18px;
        border-radius: 24px;
    }

    .title-group {
        max-width: none;
    }

    .header-top {
        flex-direction: column;
        align-items: stretch;
    }

    .counter-box {
        align-self: flex-start;
    }

    .preset-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .combo-board {
        margin-top: 0;
    }

    .scene {
        min-height: 400px;
    }

    .scene-copy {
        top: 20px;
        left: 20px;
        max-width: 170px;
    }

    .scene::before {
        left: 50%;
        width: min(720px, 92vw);
        transform: translateX(-50%);
    }

    .scene::after {
        left: 50%;
        width: min(520px, 72vw);
        transform: translateX(-50%);
    }

    .lizard-scaler {
        --lizard-scale: 0.72;
        left: calc(50% + var(--lizard-shift-x));
        bottom: calc(-18px - var(--lizard-shift-y));
    }

    .speech {
        right: 18px;
        bottom: 22px;
    }
}

@media (max-width: 600px) {
    .app {
        padding: 10px;
    }

    .header {
        padding: 16px;
        border-radius: 22px;
    }

    .title {
        font-size: 30px;
    }

    .hint {
        font-size: 13px;
    }

    .composer-card,
    .combo-board {
        padding: 14px;
        border-radius: 20px;
    }

    .combo-board-grid {
        gap: 10px;
    }

    .combo-stat {
        padding: 12px 14px;
    }

    .combo-stat-value {
        font-size: 26px;
    }

    .custom-input {
        padding: 14px 16px;
    }

    .preset-options {
        gap: 8px;
    }

    .preset-chip {
        padding: 9px 12px;
        font-size: 12px;
    }

    .scene {
        min-height: 350px;
    }

    .scene-copy {
        max-width: 140px;
    }

    .scene-copy-title {
        font-size: 18px;
    }

    .scene-copy-hint {
        display: none;
    }

    .counter-box {
        padding: 12px 14px;
    }

    .counter-value {
        font-size: 24px;
    }

    .lizard-scaler {
        --lizard-scale: 0.58;
        left: calc(50% + var(--lizard-shift-x));
        bottom: calc(-46px - var(--lizard-shift-y));
    }

    .speech {
        right: 14px;
        bottom: 18px;
        min-width: 132px;
        max-width: 180px;
        padding: 10px 14px;
        font-size: 13px;
    }
}
