:root {
    --bg: #0b1020;
    --panel: rgba(255, 255, 255, 0.08);
    --panel2: rgba(255, 255, 255, 0.12);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.7);
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans JP", sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 700px at 20% 15%, rgba(110, 160, 255, 0.22), transparent 60%),
        radial-gradient(900px 650px at 80% 20%, rgba(255, 140, 200, 0.18), transparent 60%),
        radial-gradient(1000px 800px at 50% 90%, rgba(120, 255, 220, 0.12), transparent 65%),
        var(--bg);
    min-height: 100vh;
    overflow: hidden;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 14px;
    z-index: 10;
    backdrop-filter: blur(10px);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.0));
}

.topbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

label {
    color: var(--muted);
    font-size: 13px;
}

button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    outline: none;
}

select {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    outline: none;
}

option {
    color: var(--bg);
}

button {
    cursor: pointer;
}

button:hover {
    background: rgba(255, 255, 255, 0.12);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.status {
    color: var(--muted);
    font-size: 13px;
    padding-left: 4px;
}

/* Layout */
.layout {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr min(420px, 40vw);
    gap: 12px;
    padding: 68px 12px 12px 12px;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        padding-top: 74px;
    }

    .side {
        max-height: 44vh;
    }
}

/* Stage */
#stage {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.hint {
    position: absolute;
    left: 12px;
    bottom: 12px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    user-select: none;
    pointer-events: none;
}

/* Bubble */
.bubble {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(120px 80px at 30% 30%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.07));
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.30);
    cursor: pointer;
    user-select: none;
    transform: translateZ(0);
    animation: floaty var(--floatDur) ease-in-out infinite alternate;
    will-change: transform, opacity;
}

.bubble:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: radial-gradient(140px 90px at 30% 30%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.09));
}

.bubble:active {
    transform: scale(0.98);
}

.bubble .t {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bubble .meta {
    position: absolute;
    bottom: -18px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0.9;
    white-space: nowrap;
    pointer-events: none;
}

@keyframes floaty {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(var(--floatX), var(--floatY), 0);
    }
}

/* Side panel */
.side {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panelBody {
    padding: 12px;
    overflow: auto;
    min-height: 0;
}

.detailTitle {
    margin: 0 0 6px 0;
    font-size: 18px;
    line-height: 1.25;
    color: var(--text);
}

.detailRow {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.07);
    font-size: 12px;
    color: var(--muted);
}

.link {
    color: rgba(180, 215, 255, 0.95);
    text-decoration: none;
    border-bottom: 1px dashed rgba(180, 215, 255, 0.45);
}

.link:hover {
    border-bottom-style: solid;
}

.extract {
    color: rgba(255, 255, 255, 0.86);
    font-size: 14px;
    line-height: 1.65;
    margin: 0;
    white-space: pre-wrap;
}

.thumb {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 14px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.historyList {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.historyList h3 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.historyItem {
    padding: 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    margin-bottom: 8px;
}

.historyItem .ht {
    font-size: 13px;
    font-weight: 650;
    margin: 0 0 6px 0;
}

.historyItem .hs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
}

.detailDialog {
    width: 90vw;
    background-color: var(--bg);
    border: var(--border);
    border-radius: 10px;
}