  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body { font-family: -apple-system, system-ui, "Segoe UI", sans-serif; max-width: 1200px; margin: 0 auto; padding: 16px; color: #1f2328; }
  h1 { font-size: 18px; margin: 0; }

  .top-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 16px; border-bottom: 1px solid #d0d7de; margin-bottom: 20px; }
  .user-info { font-size: 14px; color: #57606a; display: flex; gap: 8px; align-items: center; }
  .user-info b { color: #1f2328; font-weight: 600; }
  .user-info b.admin { color: #cf222e; }
  #call-duration { font-family: ui-monospace, "SF Mono", Consolas, monospace; color: #1a7f37; font-weight: 600; }
  #fullscreen-time { display: none; }
  body.is-fullscreen #fullscreen-time { display: block; position: fixed; top: 16px; left: 16px; z-index: 60; background: rgba(0,0,0,0.55); color: #fff; padding: 6px 14px; border-radius: 18px; font-family: ui-monospace, monospace; font-size: 14px; font-weight: 600; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .link-btn { background: none; color: #0969da; border: none; padding: 4px 8px; font-size: 13px; cursor: pointer; }
  .link-btn:hover { background: #ddf4ff; border-radius: 4px; }

  input, button { padding: 8px 12px; font-size: 16px; border-radius: 6px; border: 1px solid #d0d7de; font-family: inherit; }
  button { cursor: pointer; background: #1f6feb; color: #fff; border-color: #1f6feb; font-weight: 500; }
  button:disabled { background: #aaa; border-color: #aaa; cursor: not-allowed; }

  #dial-section { max-width: 420px; margin: 0 auto; }
  .phone-display { font-family: -apple-system, "SF Pro Display", system-ui, sans-serif; font-size: 38px; font-weight: 300; text-align: center; padding: 30px 20px 16px; margin-bottom: 16px; letter-spacing: 1px; min-height: 88px; display: flex; align-items: center; justify-content: center; word-break: break-all; color: #1f2328; }
  .phone-display.empty { color: #8b949e; font-size: 15px; letter-spacing: 0; font-weight: 400; }

  .dial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 320px; margin: 0 auto 18px; }
  .dial-key { aspect-ratio: 1; background: #e8e9ec; color: #1f2328; border: none; border-radius: 50%; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background 0.08s; font-family: -apple-system, "SF Pro Display", system-ui, sans-serif; }
  .dial-key:hover { background: #d8dade; }
  .dial-key:active { background: #c0c3c9; }
  .dial-key:disabled { opacity: 0.4; cursor: not-allowed; }
  .dial-key:disabled:hover { background: #e8e9ec; }
  .dial-key .digit { font-size: 32px; font-weight: 400; line-height: 1; }
  .dial-key .letters { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: #57606a; margin-top: 4px; height: 12px; text-transform: uppercase; }
  .dial-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 320px; margin: 0 auto; align-items: center; justify-items: center; }
  .dial-actions .call { aspect-ratio: 1; width: 100%; max-width: 76px; background: #34c759; border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; padding: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform 0.08s, background 0.08s; }
  .dial-actions .call:hover { background: #2db84f; }
  .dial-actions .call:active { transform: scale(0.92); }
  .dial-actions .call:disabled { background: #b5bac1; cursor: not-allowed; }
  .dial-actions .backspace { background: transparent; border: none; color: #1f2328; width: 56px; height: 56px; border-radius: 50%; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background 0.08s, opacity 0.15s; }
  .dial-actions .backspace:hover { background: rgba(0,0,0,0.06); }
  .dial-actions .backspace:active { background: rgba(0,0,0,0.12); }
  .dial-actions .backspace:disabled { opacity: 0; pointer-events: none; }

  #admin-section { max-width: 600px; margin: 0 auto; }
  .section-title { font-size: 16px; margin: 0 0 16px; color: #57606a; }
  .room-list-empty { text-align: center; padding: 40px 20px; color: #57606a; background: #f6f8fa; border: 1px dashed #d0d7de; border-radius: 8px; }
  .room-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #f6f8fa; border: 1px solid #d0d7de; border-radius: 8px; margin-bottom: 8px; gap: 12px; }
  .room-item .room-info { flex: 1; min-width: 0; }
  .room-name { font-weight: 600; font-size: 16px; font-family: ui-monospace, monospace; }
  .room-occupants { font-size: 13px; color: #57606a; margin-top: 4px; word-break: break-all; }
  .room-join { background: #1a7f37; border-color: #1a7f37; padding: 6px 18px; font-size: 14px; white-space: nowrap; }
  .room-close { background: #cf222e; border-color: #cf222e; padding: 6px 18px; font-size: 14px; white-space: nowrap; }
  .room-actions { display: flex; gap: 6px; flex-shrink: 0; }

  /* === Video call view === */
  .videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; padding-bottom: 96px; }
  .video-box { background: #000; border-radius: 12px; overflow: hidden; position: relative; aspect-ratio: 16/9; animation: popin 0.35s cubic-bezier(.22,1,.36,1); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .video-box.admin-box { outline: 2px solid #cf222e; }
  .video-box.creator-box { outline: 2px solid #d4a72c; }
  .label.creator { background: #d4a72c; }
  .video-box.hidden-peer { display: none; }
  .video-box.fullscreen-main { cursor: zoom-out; }
  video { width: 100%; height: 100%; object-fit: cover; background: #000; pointer-events: none; }
  .label { position: absolute; bottom: 8px; left: 8px; color: #fff; font-size: 13px; background: rgba(0,0,0,0.55); padding: 3px 10px; border-radius: 6px; pointer-events: none; }
  .label.admin { background: #cf222e; }
  .kick-btn { position: absolute; top: 8px; right: 8px; background: #cf222e; border: 1px solid #cf222e; color: #fff; padding: 4px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 500; opacity: 0.9; }
  .kick-btn:hover { opacity: 1; }
  .waiting { grid-column: 1 / -1; padding: 60px 20px; text-align: center; color: #57606a; font-size: 14px; background: #f6f8fa; border: 1px dashed #d0d7de; border-radius: 8px; }
  @keyframes popin { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

  /* Fullscreen mode: clicked tile fills screen, others as PiP overlays */
  body.is-fullscreen { background: #000; max-width: none; padding: 0; margin: 0; }
  body.is-fullscreen .top-bar { display: none; }
  body.is-fullscreen #call-section { padding: 0; }
  body.is-fullscreen .videos { padding: 0; display: block; }
  body.is-fullscreen .video-box { position: fixed; width: 140px; aspect-ratio: 1/1; right: 16px; bottom: 110px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.45); z-index: 50; margin: 0; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
  body.is-fullscreen .video-box.fullscreen-main { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; border: none; border-radius: 0; aspect-ratio: auto; box-shadow: none; }
  body.is-fullscreen .video-box.hidden-peer { display: none; }
  body.is-fullscreen .video-box.pip-slot-1 { bottom: 262px; }
  body.is-fullscreen .video-box.pip-slot-2 { bottom: 414px; }
  body.is-fullscreen .video-box.pip-slot-3 { bottom: 566px; }
  body.is-fullscreen .video-box.pip-slot-4 { bottom: 718px; }
  body.is-fullscreen .video-box.pip-slot-5 { bottom: 870px; }
  body.is-fullscreen .video-box.pip-slot-6 { bottom: 1022px; }
  body.is-fullscreen .video-box.pip-slot-7 { bottom: 1174px; }
  body.is-fullscreen .video-box.pip-slot-8 { bottom: 1326px; }
  body.is-fullscreen .video-box.pip-slot-9 { bottom: 1478px; }
  body.is-fullscreen .video-box.pip-slot-10 { bottom: 1630px; }
  body.is-fullscreen .video-box.pip-slot-11 { bottom: 1782px; }
  body.is-fullscreen .video-box.pip-slot-12 { bottom: 1934px; }
  body.is-fullscreen .video-box.pip-slot-13 { bottom: 2086px; }
  body.is-fullscreen .video-box.pip-slot-14 { bottom: 2238px; }
  body.is-fullscreen .video-box.pip-slot-15 { bottom: 2390px; }
  body.is-fullscreen .video-box.pip-slot-16 { bottom: 2542px; }
  body.is-fullscreen .video-box.pip-slot-17 { bottom: 2694px; }
  body.is-fullscreen .video-box.pip-slot-18 { bottom: 2846px; }
  body.is-fullscreen .video-box.pip-slot-19 { bottom: 2998px; }
  @media (max-width: 600px) {
    body.is-fullscreen .video-box { width: 110px; bottom: 100px; }
    body.is-fullscreen .video-box.pip-slot-1 { bottom: 222px; }
    body.is-fullscreen .video-box.pip-slot-2 { bottom: 344px; }
    body.is-fullscreen .video-box.pip-slot-3 { bottom: 466px; }
    body.is-fullscreen .video-box.pip-slot-4 { bottom: 588px; }
    body.is-fullscreen .video-box.pip-slot-5 { bottom: 710px; }
    body.is-fullscreen .video-box.pip-slot-6 { bottom: 832px; }
    body.is-fullscreen .video-box.pip-slot-7 { bottom: 954px; }
    body.is-fullscreen .video-box.pip-slot-8 { bottom: 1076px; }
    body.is-fullscreen .video-box.pip-slot-9 { bottom: 1198px; }
    body.is-fullscreen .video-box.pip-slot-10 { bottom: 1320px; }
    body.is-fullscreen .video-box.pip-slot-11 { bottom: 1442px; }
    body.is-fullscreen .video-box.pip-slot-12 { bottom: 1564px; }
    body.is-fullscreen .video-box.pip-slot-13 { bottom: 1686px; }
    body.is-fullscreen .video-box.pip-slot-14 { bottom: 1808px; }
    body.is-fullscreen .video-box.pip-slot-15 { bottom: 1930px; }
    body.is-fullscreen .video-box.pip-slot-16 { bottom: 2052px; }
    body.is-fullscreen .video-box.pip-slot-17 { bottom: 2174px; }
    body.is-fullscreen .video-box.pip-slot-18 { bottom: 2296px; }
    body.is-fullscreen .video-box.pip-slot-19 { bottom: 2418px; }
  }

  /* === Floating control bar === */
  .control-bar { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; background: rgba(28,33,40,0.92); padding: 10px 14px; border-radius: 40px; box-shadow: 0 6px 24px rgba(0,0,0,0.35); z-index: 100; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .ctrl-btn { width: 52px; height: 52px; border-radius: 50%; border: none; background: rgba(255,255,255,0.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: background 0.15s, transform 0.08s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .ctrl-btn:hover { background: rgba(255,255,255,0.22); }
  .ctrl-btn:active { transform: scale(0.94); }
  .ctrl-btn.off { background: #cf222e; }
  .ctrl-btn.off:hover { background: #a40e26; }
  .ctrl-btn.hangup { background: #cf222e; }
  .ctrl-btn.hangup:hover { background: #a40e26; }
  .ctrl-btn .icon-active { display: block; }
  .ctrl-btn .icon-muted { display: none; }
  .ctrl-btn.off .icon-active { display: none; }
  .ctrl-btn.off .icon-muted { display: block; }

  #dial-section, #call-section, #admin-section { display: none; }
  body.phase-dial #dial-section { display: block; }
  body.phase-call #call-section { display: block; }
  body.phase-admin-lobby #admin-section { display: block; }
  body.phase-call #change-name,
  body.phase-admin-lobby #change-name { display: none; }
  body:not(.phase-call) .control-bar { display: none; }

  dialog.modal { border: none; border-radius: 12px; padding: 24px; max-width: 380px; width: 90%; box-shadow: 0 8px 24px rgba(0,0,0,0.2); font-family: inherit; color: #1f2328; }
  dialog.modal::backdrop { background: rgba(0,0,0,0.45); }
  dialog.modal h2 { font-size: 18px; margin: 0 0 8px; }
  dialog.modal p { color: #57606a; margin: 0 0 16px; font-size: 14px; }
  dialog.modal input { width: 100%; margin-bottom: 12px; }
  dialog.modal form > button { display: block; margin: 0 auto; min-width: 140px; }
  dialog.modal .modal-buttons { display: flex; gap: 8px; justify-content: center; }
  dialog.modal .modal-buttons button { flex: 0 0 auto; min-width: 110px; }
  dialog.modal button.secondary { background: #f6f8fa; color: #1f2328; border-color: #d0d7de; }
  dialog.modal .err { color: #cf222e; font-size: 13px; margin: 0 0 12px; min-height: 18px; }
  .install-steps { padding-left: 20px; margin: 12px 0 16px; line-height: 1.9; }
  .install-steps li { font-size: 14px; color: #1f2328; }
  .install-steps strong { color: #1a7f37; font-weight: 600; }
  .inline-icon { display: inline-flex; vertical-align: middle; margin: 0 4px; color: #0969da; }
  .install-illust { display: flex; justify-content: center; margin: 12px 0; }
  .install-illust img { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
  .setup-row { margin-bottom: 14px; }
  .setup-row label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: #1f2328; user-select: none; }
  .setup-row label input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }
  .setup-row > input[type="password"], .setup-row > input[type="number"] { margin-top: 8px; margin-bottom: 0; }
  .lock-btn { background: none; border: none; cursor: pointer; padding: 0 4px; font-size: inherit; line-height: 1; color: inherit; vertical-align: baseline; }
  .lock-btn:hover { opacity: 0.6; }
  .password-display { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 28px; font-weight: 600; text-align: center; padding: 16px; margin: 8px 0 20px; background: #f6f8fa; border-radius: 8px; letter-spacing: 4px; color: #1f2328; }
