/* Overlay backdrop */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* Bottom sheet */
.sheet {
  background: var(--bg-panel);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-overflow-scrolling: touch;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 10px auto 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  padding: 16px 16px 0;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sheet-close:active {
  background: var(--border);
}

.sheet-tabs {
  display: flex;
  margin: 16px 16px 0;
  background: var(--bg-raised);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.sheet-tab {
  flex: 1;
  padding: 7px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
}

.sheet-tab.active {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.sheet-tab-panel {
  display: none;
}

.sheet-tab-panel.active {
  display: block;
}

.sheet-body {
  padding: 16px;
}

.sheet-section {
  margin-bottom: 20px;
}

.sheet-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.sheet-footer {
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  position: sticky;
  bottom: 0;
}

.sheet-announce-btn {
  flex: 1;
  background: var(--accent);
  color: #fff;
  padding: 15px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
  min-height: 44px;
}

.sheet-announce-btn:active {
  background: var(--accent-bright);
}

.sheet-stop-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 15px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
}

.sheet-stop-btn:active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* Timeout row */
.timeout-row {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.timeout-row .sheet-section-label {
  margin-bottom: 8px;
}

/* Tablet / desktop: center modal instead of bottom sheet */
@media (min-width: 768px) {
  .sheet-overlay {
    align-items: center;
  }

  .sheet {
    border-radius: 16px;
    max-width: 480px;
    max-height: 80vh;
  }
}

/* Identifying banner */
.identify-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--status-warn);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  letter-spacing: 0.03em;
  animation: identify-flash 1.2s ease-in-out infinite;
}

.identify-pulse {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: pulse-ring 1.2s ease-in-out infinite;
}

@keyframes identify-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
  50% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

/* Device detail sheet is wider on desktop */
@media (min-width: 768px) {
  #sheet-device {
    max-width: 560px;
  }
}
