#joinNote {
  margin: 0;
  min-height: 1.3em;
  font-size: 14px;
  line-height: 1.3;
  color: var(--danger);
  opacity: 0;
  transition: opacity .3s;
}

#joinNote.show {
  opacity: 1;
}

/* The vault password dialog (#vault) looks like the lock dialog and opens on top of it. */
#lock,
#vault {
  width: min(420px, calc(100vw - 32px));
  padding: 24px 24px 20px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--lock-bg, var(--float));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  /* The colours of the guess times; the light theme needs darker ones and a nearly opaque card, since the dimmed page shines through the translucent one and turns it grey. */
  --time-red: #ff3b3b;
  --time-orange: #f59e0b;
  --time-grey: var(--muted);
  --time-green: var(--ok);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) #lock,
  :root:not([data-theme]) #vault {
    --lock-bg: rgba(255, 255, 255, .95);
    --time-red: #e00000;
    --time-orange: #b45309;
    --time-grey: #5b6178;
    --time-green: #047857;
  }
}

:root[data-theme="light"] #lock,
:root[data-theme="light"] #vault {
  --lock-bg: rgba(255, 255, 255, .95);
  --time-red: #e00000;
  --time-orange: #b45309;
  --time-grey: #5b6178;
  --time-green: #047857;
}

#lock::backdrop,
#vault::backdrop {
  background: rgba(5, 6, 10, .6);
  backdrop-filter: blur(4px);
}

/* The display rules below would otherwise win over the hidden attribute the script sets. */
#lock label[hidden],
#lock button[hidden],
#vault label[hidden] {
  display: none;
}

#lock h2,
#vault h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

#lock p,
#vault p {
  /* a "\n" in the text becomes a line break; other whitespace still collapses */
  white-space: pre-line;
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

#lock .lockfield,
#vault .lockfield {
  display: block;
  margin-bottom: 10px;
}

#lock .lockfield input,
#vault .lockfield input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

#lock .lockfield input:focus,
#vault .lockfield input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#lock .lockstrength {
  min-height: 7em;
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
}

/* Only the durations are coloured: red under a year, orange under 25 years, grey under 100, green beyond. */
#lock .lockstrength [data-level="red"] {
  color: var(--time-red);
  font-weight: 700;
}

#lock .lockstrength [data-level="orange"] {
  color: var(--time-orange);
}

#lock .lockstrength [data-level="grey"] {
  color: var(--time-grey);
}

#lock .lockstrength [data-level="green"] {
  color: var(--time-green);
}

/* The cost in brackets next to a duration. */
#lock .lockstrength [data-level="muted"] {
  color: var(--muted);
}

#lock .lockgen {
  display: block;
  margin: 0 0 8px;
  padding: 6px 0;
  font: inherit;
  font-size: 13px;
  color: var(--accent);
  border: 0;
  background: transparent;
  cursor: pointer;
}

#lock .lockgen:hover {
  text-decoration: underline;
}

#lock .lockshow,
#vault .lockshow {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

#lock #lockError,
#vault #vaultError {
  min-height: 1.4em;
  margin-bottom: 8px;
  color: var(--danger);
}

/* The room type question: two big buttons that share the width, each with its own description. */
.lockchoices {
  display: none;
}

#lock.choosing {
  width: min(600px, calc(100vw - 32px));
}

#lock.choosing .lockchoices {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
}

#lock.choosing .lockbtns,
#lock.choosing #lockError {
  display: none;
}

#lock .lockchoice {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 14px 18px;
  font: inherit;
  text-align: center;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  cursor: pointer;
  transition: transform .15s, filter .15s, border-color .15s, box-shadow .15s;
}

#lock .lockchoice:hover,
#lock .lockchoice:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.08);
  border-color: var(--accent);
}

#lock .lockchoice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#lock .choiceicon {
  font-size: 34px;
  line-height: 1;
}

#lock .lockchoice strong {
  font-size: 17px;
}

#lock .lockchoice span:last-child {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 420px) {
  #lock.choosing {
    padding: 20px 14px 14px;
  }

  #lock .lockchoice {
    padding: 16px 10px 14px;
  }

  #lock .lockchoice span:last-child {
    font-size: 12px;
  }
}

/* Both buttons are the same size and rise on hover; only the colour tells them apart. */
#lock .lockbtns,
#vault .lockbtns {
  display: flex;
  gap: 10px;
}

#lock .lockbtns button,
#vault .lockbtns button {
  flex: 1;
  width: auto;
  padding: 12px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: none;
  cursor: pointer;
  transition: transform .15s, filter .15s, box-shadow .15s;
}

#lock .lockbtns button:hover,
#vault .lockbtns button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

#lock .lockbtns button.primary,
#vault .lockbtns button.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(109, 106, 247, .35);
}
