* { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      background: #0f0f1a;
      color: #e0e0f0;
      font-family: 'Segoe UI', system-ui, sans-serif;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    header {
      background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
      border-bottom: 1px solid #2a2a4a;
      padding: 16px 24px;
      display: flex;
      align-items: center;
      gap: 12px;
    }

    header h1 {
      font-size: 18px;
      font-weight: 600;
      color: #a78bfa;
    }

    .badge {
      background: #7c3aed22;
      border: 1px solid #7c3aed66;
      color: #a78bfa;
      font-size: 11px;
      padding: 2px 8px;
      border-radius: 12px;
    }

    .main {
      display: grid;
      grid-template-columns: 320px 1fr;
      flex: 1;
      overflow: hidden;
    }

    /* ===== サイドバー ===== */
    .sidebar {
      background: #13131f;
      border-right: 1px solid #2a2a4a;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 16px;
      overflow-y: auto;
    }

    .section-title {
      font-size: 11px;
      font-weight: 700;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      margin-bottom: 8px;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    label {
      font-size: 13px;
      color: #9ca3af;
    }

    input {
      background: #1e1e30;
      border: 1px solid #2a2a4a;
      border-radius: 8px;
      color: #e0e0f0;
      padding: 10px 12px;
      font-size: 13px;
      outline: none;
      transition: border-color 0.2s;
      width: 100%;
    }

    input:focus {
      border-color: #7c3aed;
    }

    input::placeholder { color: #4b5563; }

    button {
      border: none;
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 600;
      padding: 11px 16px;
      transition: all 0.2s;
      width: 100%;
    }

    button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    .btn-primary {
      background: linear-gradient(135deg, #7c3aed, #6d28d9);
      color: white;
      box-shadow: 0 2px 12px #7c3aed44;
    }

    .btn-primary:not(:disabled):hover {
      background: linear-gradient(135deg, #8b5cf6, #7c3aed);
      box-shadow: 0 4px 20px #7c3aed66;
      transform: translateY(-1px);
    }

    .btn-danger {
      background: linear-gradient(135deg, #dc2626, #b91c1c);
      color: white;
    }

    .btn-danger:not(:disabled):hover {
      background: linear-gradient(135deg, #ef4444, #dc2626);
    }

    .status-row {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      background: #1e1e30;
      border-radius: 8px;
      padding: 10px 12px;
    }

    .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #374151;
      flex-shrink: 0;
      transition: background 0.3s;
    }

    .dot.green { background: #10b981; box-shadow: 0 0 6px #10b981; }
    .dot.yellow { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: pulse 1s infinite; }
    .dot.red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.4; }
    }

    .info-card {
      background: #1e1e30;
      border: 1px solid #2a2a4a;
      border-radius: 8px;
      padding: 12px;
    }

    .info-card p {
      font-size: 12px;
      color: #6b7280;
      margin-bottom: 4px;
    }

    .info-card span {
      font-size: 12px;
      color: #a78bfa;
      font-family: monospace;
      word-break: break-all;
    }

    /* ===== ビデオエリア ===== */
    .video-area {
      background: #0a0a14;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .video-grid {
      flex: 1;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 16px;
      padding: 20px;
      overflow-y: auto;
      align-content: start;
    }

    .video-container {
      background: #13131f;
      border: 1px solid #2a2a4a;
      border-radius: 12px;
      overflow: hidden;
      position: relative;
      aspect-ratio: 16/9;
    }

    .video-container video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .video-label {
      position: absolute;
      bottom: 10px;
      left: 10px;
      background: #000000aa;
      backdrop-filter: blur(4px);
      color: white;
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 20px;
    }

    .video-placeholder {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #374151;
      font-size: 48px;
    }

    /* ===== ログ ===== */
    .log-panel {
      height: 180px;
      background: #13131f;
      border-top: 1px solid #2a2a4a;
      display: flex;
      flex-direction: column;
    }

    .log-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 16px;
      border-bottom: 1px solid #1e1e30;
    }

    .log-header span {
      font-size: 12px;
      font-weight: 600;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .log-clear {
      background: none;
      border: none;
      color: #4b5563;
      font-size: 11px;
      cursor: pointer;
      padding: 2px 6px;
      border-radius: 4px;
      width: auto;
      transition: color 0.2s;
    }

    .log-clear:hover { color: #9ca3af; }

    #log {
      flex: 1;
      overflow-y: auto;
      padding: 8px 16px;
      font-family: 'Consolas', 'Courier New', monospace;
      font-size: 12px;
      line-height: 1.6;
    }

    .log-entry {
      display: flex;
      gap: 8px;
    }

    .log-time { color: #4b5563; flex-shrink: 0; }
    .log-info { color: #60a5fa; }
    .log-ok { color: #34d399; }
    .log-warn { color: #fbbf24; }
    .log-error { color: #f87171; }
    .log-msg { color: #d1d5db; }

    .divider {
      border: none;
      border-top: 1px solid #2a2a4a;
      margin: 8px 0;
    }

    #remoteVideosWrapper {
      display: contents;
    }

    /* ===== レスポンシブ対応 ===== */
    @media (max-width: 768px) {
      .main {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
      }
      .sidebar {
        border-right: none;
        border-bottom: 1px solid #2a2a4a;
      }
      .video-area {
        overflow: visible;
      }
      .log-panel {
        height: 250px;
      }
      .video-grid {
        grid-template-columns: 1fr;
      }
    }