/* Account and settings: bottom sheet on phones, sidebar on wide screens. */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(0 0 0 / 0.45);
}

.panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem calc(1.25rem + env(safe-area-inset-right))
           calc(1.25rem + env(safe-area-inset-bottom))
           calc(1.25rem + env(safe-area-inset-left));
  border-radius: 1.25rem 1.25rem 0 0;
  background: var(--card);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.25);
  transform: translateY(100%);
  visibility: hidden;                /* closed sheet is out of the tab order */
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.panel.open { transform: none; visibility: visible; transition: transform 0.25s ease; }
.panel:focus { outline: none; }

.sheet-handle {
  width: 2.5rem;
  height: 0.3rem;
  margin: 0.25rem auto 0.5rem;
  border-radius: 999px;
  background: var(--border);
}

.panel-section { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.panel-section:last-child { border-bottom: none; }
.panel-section h2 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-section p { margin: 0 0 0.6rem; }
.panel-section p:last-child { margin-bottom: 0; }
.panel .row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.panel-section .hint:empty { display: none; }

.user { font-weight: 600; overflow-wrap: anywhere; }

.broadcast-form { display: flex; flex-direction: column; gap: 0.5rem; }
.broadcast-form input,
.broadcast-form textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;                   /* no zoom on focus in iOS */
  background: var(--card);
  color: inherit;
  resize: vertical;
}
.broadcast-form input:focus,
.broadcast-form textarea:focus { outline: none; border-color: var(--accent); }
.broadcast-confirm {
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.broadcast-confirm p { margin: 0 0 0.5rem; }
.broadcast-confirm .secondary { color: inherit; }
.panel-section .hint { margin: 0.5rem 0 0; }

.sync { display: flex; align-items: center; gap: 0.5rem; }
.sync::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ok);
}
.sync.waiting::before { background: #f59e0b; }
.sync.offline::before { background: var(--danger); }

.shortcuts { display: none; }
.shortcuts dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.75rem;
  margin: 0;
  font-size: 0.85rem;
}
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--muted); }

@media (hover: hover) and (pointer: fine) {
  .shortcuts { display: block; }
}

@media (min-width: 48rem) {
  .panel {
    position: sticky;
    top: 5rem;
    z-index: auto;
    order: -1;
    flex: none;
    width: 17rem;
    max-height: calc(100dvh - 6.5rem);
    padding: 0.25rem 1.25rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
    transform: none;
    visibility: visible;
    transition: none;
  }
  .sheet-handle, #menu-toggle, .scrim { display: none !important; }
}

@media (display-mode: window-controls-overlay) {
  .panel { top: 3.5rem; }
}

@media (display-mode: standalone), (display-mode: window-controls-overlay) {
  #install-section { display: none !important; }
}
