:root{
  --bg:#ffffff;
  --text:#1f1f1f;
  --muted:#5f6368;
  --border:#e0e0e0;
  --shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --blue:#1a73e8;
  --blueHover:#1669d6;
  --red:#d93025;
  --green:#188038;
  --yellow:#f9ab00;
  --tileBg:#ffffff;
  --tileBorder:#dadce0;
  --controlBar:#ffffffee;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Roboto, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{color:var(--blue); text-decoration:none}
a:hover{text-decoration:underline}

#app{min-height:100%;}

.center-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.card{
  width:min(520px, 100%);
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:28px 28px 22px;
  text-align:center;
}

.logo{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  margin-bottom:18px;
}

.logo img{
  width:76px;
  height:76px;
  border-radius:18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
}

.h1{
  font-size:28px;
  font-weight:600;
  letter-spacing:.2px;
  margin:0 0 6px;
}

.sub{
  margin:0 0 22px;
  color:var(--muted);
  font-size:14px;
  line-height:1.45;
}

.btn{
  border:0;
  cursor:pointer;
  font:inherit;
  padding:12px 18px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  user-select:none;
  transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
}

.btn:active{transform: translateY(1px)}
.btn-primary{
  background:var(--blue);
  color:#fff;
  box-shadow: 0 1px 2px rgba(26,115,232,.25), 0 10px 28px rgba(26,115,232,.18);
}
.btn-primary:hover{background:var(--blueHover)}
.btn-ghost{
  background:transparent;
  color:var(--text);
  border:1px solid var(--border);
}
.btn-danger{
  background:#fff;
  color:var(--red);
  border:1px solid rgba(217,48,37,.35);
}
.btn-small{padding:8px 12px; border-radius:10px; font-size:13px}

.icon-btn{
  width:40px;
  height:40px;
  border-radius:12px;
  padding:0;
}

.input{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  outline:none;
  font-size:16px;
}
.input:focus{border-color: rgba(26,115,232,.6); box-shadow: 0 0 0 4px rgba(26,115,232,.12);}

.row{display:flex; gap:12px; align-items:center;}
.row-between{display:flex; justify-content:space-between; align-items:center; gap:12px;}

.topbar{
  position:sticky;
  top:0;
  z-index:5;
  background: #fff;
  border-bottom:1px solid var(--border);
  padding:12px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex; align-items:center; gap:10px;
}
.brand img{width:34px; height:34px; border-radius:10px}
.brand .name{font-weight:600}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}

.room-meta{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:13px;
}

.pill{
  border:1px solid var(--border);
  padding:6px 10px;
  border-radius:999px;
  background:#fff;
}

.main{
  height: calc(100vh - 64px);
  display:flex;
  flex-direction:column;
}

.canvas{
  flex:1;
  position:relative;
  overflow:hidden;
  background: radial-gradient(circle at 20% 20%, rgba(26,115,232,.06), transparent 40%),
              radial-gradient(circle at 80% 30%, rgba(249,171,0,.08), transparent 45%),
              radial-gradient(circle at 30% 80%, rgba(24,128,56,.06), transparent 45%),
              #fafafa;
}

.canvas-inner{
  position:absolute;
  left:0;
  top:0;
  width:2000px;
  height:2000px;
  transform-origin: 0 0;
}

.tile{
  position:absolute;
  width: 280px;
  border:1px solid var(--tileBorder);
  border-radius:16px;
  background:var(--tileBg);
  box-shadow: var(--shadow);
  overflow:hidden;
  touch-action:none;
}

.tile-header{
  padding:12px 12px 10px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  cursor:grab;
}

.tile-header:active{cursor:grabbing}

.tile-title{
  font-weight:600;
  font-size:14px;
  margin:0;
}
.tile-sub{
  font-size:12px;
  color:var(--muted);
  margin:4px 0 0;
}

.badge{
  font-size:11px;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--muted);
  white-space:nowrap;
}

.badge.green{color:var(--green); border-color: rgba(24,128,56,.35); background: rgba(24,128,56,.06)}
.badge.red{color:var(--red); border-color: rgba(217,48,37,.35); background: rgba(217,48,37,.06)}
.badge.yellow{color:#7a4b00; border-color: rgba(249,171,0,.45); background: rgba(249,171,0,.12)}
.badge.blue{color:var(--blue); border-color: rgba(26,115,232,.35); background: rgba(26,115,232,.06)}

.tile-body{padding:12px}
.tile-actions{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px}

.progress{
  height:10px;
  background:#f1f3f4;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--border);
}
.progress > div{
  height:100%;
  width:0%;
  background:var(--blue);
  transition: width .15s ease;
}

.preview{
  width:100%;
  border-radius:12px;
  background:#000;
  aspect-ratio: 16/9;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
.preview video{
  width:100%;
  height:100%;
  object-fit:contain;
  background:#000;
}

.controlbar{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  height:72px;
  background:var(--controlBar);
  border-top:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:12px 16px;
  backdrop-filter: blur(10px);
  z-index:10;
}

.controlbar .spacer{flex:1}
.toggle{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted);
  font-size:13px;
}
.switch{
  width:44px;
  height:26px;
  border-radius:999px;
  background:#dadce0;
  position:relative;
  cursor:pointer;
  transition: background .15s ease;
}
.switch::after{
  content:"";
  position:absolute;
  top:3px;
  left:3px;
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  transition: transform .15s ease;
}
.switch.on{background: rgba(26,115,232,.7)}
.switch.on::after{transform: translateX(18px)}

.small-note{
  position:absolute;
  left:18px;
  bottom:88px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  color:var(--muted);
  font-size:13px;
  box-shadow: var(--shadow);
}

.modal-backdrop{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index:50;
}
.modal{
  width:min(460px, 100%);
  background:#fff;
  border-radius:18px;
  border:1px solid rgba(0,0,0,.08);
  box-shadow: 0 16px 44px rgba(0,0,0,.24);
  overflow:hidden;
}
.modal-head{
  padding:16px 18px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.modal-title{margin:0; font-size:16px; font-weight:600}
.modal-body{padding:18px}
.modal-actions{padding:0 18px 18px; display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap}

.toast-root{
  position:fixed;
  left:50%;
  transform: translateX(-50%);
  bottom: 88px;
  z-index:60;
  display:flex;
  flex-direction:column;
  gap:10px;
  pointer-events:none;
}
.toast{
  pointer-events:none;
  background:#202124;
  color:#fff;
  padding:10px 12px;
  border-radius:12px;
  font-size:13px;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
  max-width:min(560px, 92vw);
}

.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  border:1px solid var(--border);
  background:#f8f9fa;
  border-bottom-color:#c8c8c8;
  padding:2px 6px;
  border-radius:6px;
}


/* Locked room (PIN gate) */
.locked .topbar,
.locked .main,
.locked .controlbar {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}
