:root {
    --bg: #f3f6f8;
    --card: #ffffff;
    --ink: #15202b;
    --muted: #5b6b7c;
    --line: #d7e0ea;
    --primary: #0b6e99;
    --primary-ink: #fff;
    --danger: #b42318;
    --ok: #067647;
    --warn: #b54708;
    --shadow: 0 10px 30px rgba(21, 32, 43, 0.08);
    font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(11,110,153,.12), transparent 40%),
        linear-gradient(180deg, #eef5f8, var(--bg));
    min-height: 100vh;
}
a { color: var(--primary); }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,.7);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.topbar-actions { display: flex; gap: .75rem; align-items: center; }
.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow);
}
.login-card { max-width: 460px; margin: 2rem auto; }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: .9rem; }
label { display: grid; gap: .35rem; font-size: .92rem; }
input, select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .7rem .8rem;
    font: inherit;
    background: #fff;
}
.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: .65rem 1.1rem;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.badge {
    display: inline-block;
    margin-left: .4rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: #d9eff8;
    color: var(--primary);
    font-size: .75rem;
}
.badge.warn { background: #fff1e0; color: var(--warn); }
.alert {
    border-radius: 12px;
    padding: .8rem 1rem;
    margin: 1rem 0;
}
.alert.error { background: #fee4e2; color: #7a271a; }
.alert.ok { background: #dcfae6; color: var(--ok); }
.hint {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
    font-size: .92rem;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.list { padding-left: 1.1rem; }
.incoming {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--line);
}
.video-stage {
    position: relative;
    margin-top: 1rem;
    background: #0f1720;
    border-radius: 16px;
    overflow: hidden;
    min-height: 420px;
    aspect-ratio: 16 / 10;
}
.video-tile {
    background: #0f1720;
    color: #fff;
    overflow: hidden;
    position: relative;
}
.video-remote {
    position: absolute;
    inset: 0;
}
.video-remote video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111827;
    display: block;
}
.video-local {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    width: min(28%, 220px);
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    z-index: 2;
    background: #111827;
}
.video-local video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
}
.video-tile span {
    position: absolute;
    left: .55rem;
    bottom: .55rem;
    background: rgba(0,0,0,.55);
    padding: .2rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
}
.video-local span {
    left: .4rem;
    bottom: .4rem;
    font-size: .7rem;
}
@media (max-width: 720px) {
    .video-stage {
        min-height: 320px;
        aspect-ratio: 9 / 14;
    }
    .video-local {
        width: min(34%, 140px);
        right: .75rem;
        bottom: .75rem;
    }
}
#preview {
    width: 100%;
    max-height: 320px;
    background: #111827;
    border-radius: 14px;
    margin: 1rem 0;
}
.center { text-align: center; }
.pulse {
    width: 72px;
    height: 72px;
    margin: 1.5rem auto;
    border-radius: 50%;
    background: rgba(11,110,153,.25);
    box-shadow: 0 0 0 0 rgba(11,110,153,.45);
    animation: pulse 1.6s infinite;
}
@keyframes pulse {
    70% { box-shadow: 0 0 0 28px rgba(11,110,153,0); }
    100% { box-shadow: 0 0 0 0 rgba(11,110,153,0); }
}
.toggle { display: inline-flex; gap: .45rem; align-items: center; }
code { background: #eef3f7; padding: .1rem .35rem; border-radius: 6px; }
