@charset "UTF-8";

:root {
    --bg-top: #0f2c4f;
    --bg-bottom: #021326;
    --panel: #0b1f38;
    --panel-strong: rgba(12, 56, 110, 0.25);
    --accent: #53b7ff;
    --accent-strong: #2a9bff;
    --text: #e6f3ff;
    --muted: #8fb2d3;
    --glow: rgba(83, 183, 255, 0.25);
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

body.page {
    margin: 0;
    font-family: "Segoe UI", "Noto Sans JP", sans-serif;
    background: radial-gradient(circle at 30% 20%, rgba(63, 147, 255, 0.15), transparent 35%),
                radial-gradient(circle at 80% 0%, rgba(9, 201, 255, 0.2), transparent 30%),
                linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: rgba(0, 10, 28, 0.6);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
}

.content {
    padding: 20px;
    display: grid;
    gap: 20px;
}

.card {
    background: linear-gradient(145deg, rgba(16, 42, 79, 0.9), rgba(6, 20, 38, 0.9));
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(83, 183, 255, 0.06);
}

.info-card {
    border-left: 4px solid var(--accent);
}

.steps {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.6;
}

.note {
    margin-top: 12px;
    color: var(--muted);
}

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

.room-list .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.room-list .actions .button {
    min-width: 72px;
    text-align: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #f4f9ff;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 25px rgba(83, 183, 255, 0.3);
    transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(83, 183, 255, 0.35);
    filter: brightness(1.03);
}

.button.secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    box-shadow: none;
}

.button.small {
    padding: 7px 12px;
    font-size: 0.9rem;
}

input, textarea, select {
    width: 100%;
    margin-bottom: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 10, 24, 0.7);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(83, 183, 255, 0.1);
}

textarea {
    min-height: 120px;
}

.chat {
    display: grid;
    gap: 16px;
    max-width: 880px;
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    position: relative;
    overflow: visible;
}

.message.ai {
    background: rgba(83, 183, 255, 0.08);
    border-color: rgba(83, 183, 255, 0.2);
    box-shadow: 0 0 0 1px rgba(83, 183, 255, 0.08);
}

.meta {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
}

.message.user::before {
    content: "";
    position: absolute;
    inset: 0;
    border-left: 3px solid rgba(83, 183, 255, 0.35);
    opacity: 0.7;
    pointer-events: none;
}

.message.ai::before {
    content: "";
    position: absolute;
    inset: 0;
    border-left: 3px solid rgba(156, 214, 255, 0.6);
    opacity: 0.8;
    pointer-events: none;
}

.card form textarea {
    font-size: 1rem;
}

.card form button {
    width: 100%;
}

.content > .chat {
    padding: 18px;
    background: rgba(6, 20, 38, 0.4);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.topbar h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.room-list a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(5, 22, 42, 0.5);
    border: 1px solid var(--border);
    transition: transform 0.12s ease, border-color 0.2s ease;
}

.room-list a:hover {
    transform: translateY(-1px);
    border-color: rgba(83, 183, 255, 0.4);
}

.content {
    max-width: 1080px;
    margin: 0 auto;
}

.content-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-areas: "main sidebar";
    align-items: start;
    gap: 24px;
}

.main-panel {
    display: grid;
    gap: 20px;
    grid-area: main;
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
    grid-area: sidebar;
    min-width: 220px;
}

.sidebar-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: rgba(6, 20, 38, 0.9);
    border-bottom: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1rem;
}

.sidebar-header .icon-button {
    padding: 4px 8px;
}

.participant-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.participant-list li {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(6, 20, 38, 0.5);
    border: 1px solid var(--border);
}

.participant-name {
    display: block;
    font-weight: 600;
}

.participant-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid transparent;
    margin-top: 6px;
}

.status-ready {
    background: rgba(83, 183, 255, 0.2);
    border-color: rgba(83, 183, 255, 0.5);
    color: var(--text);
}

.status-wait {
    background: rgba(8, 20, 38, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--muted);
}

.send-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
}

.send-locked {
    filter: grayscale(1);
    opacity: 0.65;
}

.setting-block {
    margin-top: 14px;
}

.setting-block .label {
    margin-bottom: 6px;
}

.npc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.detail-fold {
    margin-top: 10px;
}

.detail-fold summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 16px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.1);
}

.room-meta {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--muted);
}

.npc-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.npc-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(6, 20, 38, 0.5);
}

.share-card {
    border: 1px solid rgba(83, 183, 255, 0.2);
}

.share-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.share-code {
    font-size: 1.4rem;
    letter-spacing: 0.2em;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(6, 20, 38, 0.6);
    border: 1px solid var(--border);
    width: fit-content;
}

.share-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.message-actions {
    margin-top: 12px;
    display: none;
    gap: 10px;
    background: rgba(6, 20, 38, 0.35);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.message-actions textarea {
    min-height: 70px;
}

.message-actions.open {
    display: grid;
}

.message-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}

.icon-button {
    background: rgba(6, 20, 38, 0.8);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    cursor: pointer;
}

.message-menu {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: rgba(6, 20, 38, 0.9);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    min-width: 120px;
    position: absolute;
    right: 0;
    top: 30px;
}

.message-menu.open {
    display: flex;
}

.copy-button {
    margin-left: auto;
    background: rgba(6, 20, 38, 0.8);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.78rem;
}

.message .body,
.choice-form,
.choice-form * {
    user-select: text;
}
.choice-form {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(6, 20, 38, 0.35);
    border: 1px solid var(--border);
}

.choice-form textarea {
    min-height: 90px;
}

.flag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.flag-item {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(83, 183, 255, 0.3);
    background: rgba(6, 20, 38, 0.5);
    font-size: 0.78rem;
}

.ai-segment {
    padding: 10px 12px;
    border-radius: 10px;
    margin-top: 8px;
    background: rgba(6, 20, 38, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-segment:first-child {
    margin-top: 0;
}

.ai-dialog {
    border-left: 3px solid rgba(83, 183, 255, 0.45);
}

.ai-narration {
    border-left: 3px solid rgba(156, 214, 255, 0.25);
}

.ai-speaker {
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.ai-text {
    color: var(--text);
}

.chat-nav {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    gap: 10px;
    z-index: 10;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 36px;
    border-radius: 999px;
    background: rgba(6, 20, 38, 0.9);
    color: var(--text);
    border: 1px solid rgba(83, 183, 255, 0.35);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.nav-pill:hover {
    border-color: rgba(83, 183, 255, 0.6);
}

@media (max-width: 720px) {
    .chat-nav {
        right: 10px;
        bottom: 18px;
        top: auto;
        transform: none;
    }
}

.room-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.room-list li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.loader-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 40% 30%, rgba(83, 183, 255, 0.15), transparent 32%),
                radial-gradient(circle at 70% 10%, rgba(15, 92, 215, 0.18), transparent 28%),
                #031022;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 12, 26, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-overlay.show {
    display: flex;
}

.loading-card {
    display: grid;
    gap: 12px;
    padding: 20px 26px;
    border-radius: 16px;
    background: rgba(6, 20, 38, 0.9);
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.loading-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid rgba(83, 183, 255, 0.25);
    border-top-color: rgba(83, 183, 255, 0.9);
    animation: spin 1s linear infinite;
    justify-self: center;
}

.loading-text {
    color: var(--text);
    font-size: 0.95rem;
}

.sigil {
    width: 120px;
    height: 120px;
    position: relative;
}

.sigil svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 12px rgba(83, 183, 255, 0.5));
    animation: spin 2.4s linear infinite;
}

.sigil circle {
    stroke: rgba(83, 183, 255, 0.7);
}

.sigil polygon {
    stroke: #9cd6ff;
    fill: rgba(156, 214, 255, 0.1);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        gap: 12px;
    }

    .content-split {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(80vw, 300px);
        transform: translateX(105%);
        transition: transform 0.25s ease;
        z-index: 20;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar .card {
        height: 100vh;
        border-radius: 0;
    }

    .sidebar-header {
        display: flex;
        border-radius: 0;
    }
}
