@import url("./theater.css");
@import url("./motion.css");

:root {
  --bg: #0c0a12;
  --ink: #eceaf4;
  --muted: #8b8b9a;
  --accent: #7c5cfc;
  --line: #2c2940;
  --teal: #3e6259;
  --brick: #d96b6b;
  --surface: #12101a;
  --row-hover: rgba(124, 92, 252, 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --motion: 160ms var(--ease);

  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Consolas", ui-monospace, monospace;

  --space: 8px;
  --radius: 8px;
  --focus: 2px solid var(--accent);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-auth,
.page-dash,
.page-explain {
  background: var(--bg);
  color: var(--ink);
}

main {
  flex: 1 0 auto;
}

::selection {
  background: rgba(124, 92, 252, 0.28);
  color: var(--ink);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

.nav-ico,
.ico-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
}

.ico,
.nav-ico svg,
.ico-wrap svg,
.btn > .ico,
.file-actions svg,
.paste-actions svg {
  display: block;
  width: 18px;
  height: 18px;
  max-width: none;
  overflow: visible;
  flex: none;
  color: currentColor;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--motion), opacity var(--motion);
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  font-weight: 500;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.mono,
.hex,
.mono-block,
.inspect dd,
.inspect .mono,
.inspect .hex,
#pubkey-text,
.file-meta p,
.file-row-head span:nth-child(2) {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* -------------------------------------------------------------------------- */
/* Visibility                                                                  */
/* -------------------------------------------------------------------------- */

[hidden] {
  display: none !important;
}

.is-hidden,
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Not display:none — Chrome will not open a file dialog from a hidden input. */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

/* -------------------------------------------------------------------------- */
/* Top bar                                                                     */
/* -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--space) * 2);
  min-height: 56px;
  padding: 0 calc(var(--space) * 3);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  user-select: none;
  transition: color var(--motion);
}

.wordmark:hover {
  color: var(--accent);
  text-decoration: none;
}

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: calc(var(--space) * 2);
}

.top-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.top-nav a:hover {
  color: var(--ink);
}

.who {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.who:empty {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Buttons                                                                     */
/* -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space);
  min-height: 40px;
  padding: 0 calc(var(--space) * 2);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition:
    color var(--motion),
    background-color var(--motion),
    border-color var(--motion),
    opacity var(--motion),
    transform var(--motion);
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}

.btn:disabled,
label.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

label.btn {
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-primary:active:not(:disabled) {
  opacity: 0.78;
  transform: scale(0.99);
}

.btn-quiet,
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-quiet:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--row-hover);
  border-color: var(--accent);
}

.btn-quiet:active:not(:disabled),
.btn-ghost:active:not(:disabled) {
  opacity: 0.85;
}

.btn.danger,
.btn-ghost.danger,
.btn-quiet.danger,
.icon-btn.danger {
  color: var(--brick);
}

.btn.danger:hover:not(:disabled),
.btn-ghost.danger:hover:not(:disabled),
.btn-quiet.danger:hover:not(:disabled) {
  background: rgba(217, 107, 107, 0.1);
  border-color: var(--brick);
  color: var(--brick);
}

.icon-btn,
.btn.icon-btn {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
}

.icon-btn:hover:not(:disabled),
.btn.icon-btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--row-hover);
  border-color: var(--accent);
}

.icon-btn.danger:hover:not(:disabled) {
  color: var(--brick);
  background: rgba(217, 107, 107, 0.1);
  border-color: var(--brick);
}

.text-link {
  display: inline-block;
  margin-top: calc(var(--space) * 2);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

/* -------------------------------------------------------------------------- */
/* Forms                                                                       */
/* -------------------------------------------------------------------------- */

form {
  display: grid;
  gap: calc(var(--space) * 2);
}

.field {
  display: grid;
  gap: var(--space);
}

.field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 15px;
  transition: border-color var(--motion), color var(--motion);
}

textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

#paste-body {
  font-family: var(--mono);
  min-height: 220px;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--accent);
}

input:focus-visible,
textarea:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
  border-color: var(--accent);
}

input:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg);
}

.form-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--brick);
  font-size: 13px;
  line-height: 1.4;
}

.form-error:empty {
  min-height: 0;
}

.fineprint,
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hint strong {
  color: var(--ink);
  font-weight: 600;
}

/* -------------------------------------------------------------------------- */
/* Shared type                                                                 */
/* -------------------------------------------------------------------------- */

.eyebrow {
  margin: 0 0 var(--space);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin: 0 0 calc(var(--space) * 3);
  max-width: 48ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.status-line {
  min-height: 1.2em;
  margin: var(--space) 0 calc(var(--space) * 2);
  color: var(--muted);
  font-size: 13px;
}

.status-line:empty {
  min-height: 0;
  margin: 0;
}

.subhead {
  margin: calc(var(--space) * 5) 0 var(--space);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* -------------------------------------------------------------------------- */
/* Toasts                                                                      */
/* -------------------------------------------------------------------------- */

#toasts {
  position: fixed;
  top: 72px;
  right: calc(var(--space) * 2);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  animation: toast-in 180ms var(--ease);
}

.toast-ok {
  border-left: 3px solid var(--teal);
  color: var(--ink);
}

.toast-err {
  border-left: 3px solid var(--brick);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Auth                                                                        */
/* -------------------------------------------------------------------------- */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 400px);
  gap: calc(var(--space) * 8);
  align-items: center;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: calc(var(--space) * 8) calc(var(--space) * 3) calc(var(--space) * 8);
}

.auth-intro h1 {
  margin: 0 0 calc(var(--space) * 2);
  max-width: 18ch;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
}

.quiet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 42ch;
}

.quiet-list li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 0 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.quiet-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.quiet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.auth-card {
  width: 100%;
  padding: calc(var(--space) * 3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: calc(var(--space) * -3) calc(var(--space) * -3) calc(var(--space) * 3);
  padding: 0 calc(var(--space) * 2);
  border-bottom: 1px solid var(--line);
}

.tabs button {
  height: 44px;
  padding: 0 var(--space);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--motion), border-color var(--motion), opacity var(--motion);
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tabs button:focus-visible {
  outline: var(--focus);
  outline-offset: -4px;
}

.auth-card .btn-primary,
.gate-card .btn-primary {
  width: 100%;
  min-height: 40px;
  margin-top: var(--space);
}

/* -------------------------------------------------------------------------- */
/* Unlock gate                                                                 */
/* -------------------------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(var(--space) * 3);
  background: rgba(12, 10, 18, 0.94);
}

.gate-card {
  width: min(400px, 100%);
}

.gate-card h1 {
  margin: 0 0 var(--space);
  font-size: 24px;
}

.gate-card .lede {
  margin-bottom: calc(var(--space) * 3);
  font-size: 14px;
}

/* -------------------------------------------------------------------------- */
/* Dashboard                                                                   */
/* -------------------------------------------------------------------------- */

.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: calc(var(--space) * 4);
  align-items: start;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(var(--space) * 4) calc(var(--space) * 3) calc(var(--space) * 8);
}

.dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 3);
}

.dash-head h1 {
  margin: 0 0 var(--space);
  font-size: 28px;
}

.dash-head .lede {
  margin: 0;
  font-size: 14px;
}

.dash-head .btn-primary {
  flex-shrink: 0;
  align-self: center;
}

.dash-main {
  min-width: 0;
}

.crypto-stage {
  position: relative;
  margin-bottom: calc(var(--space) * 2);
}

.crypto-stage .key-well {
  margin-top: calc(var(--space) * 2);
}

.crypto-stage .status-line:empty {
  display: none;
}

#dash-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  margin: 0 0 calc(var(--space) * 3);
  border-bottom: 1px solid var(--line);
}

#dash-nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  margin: 0 0 -1px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

#dash-nav button:hover {
  color: var(--ink);
}

#dash-nav button.is-active,
#dash-nav button[data-panel].is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

#dash-nav button:focus-visible {
  outline: var(--focus);
  outline-offset: -4px;
}

#dash-nav button.btn,
#dash-nav .btn {
  min-height: 44px;
  height: 44px;
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}

#dash-nav button.btn.is-active,
#dash-nav .btn.is-active {
  border-bottom-color: var(--accent);
}

#dash-nav .nav-ico,
#dash-nav .ico {
  width: 20px;
  height: 20px;
}

#panel-files,
#panel-images,
#panel-pastes {
  min-width: 0;
}

/* -------------------------------------------------------------------------- */
/* Dropzone + progress                                                         */
/* -------------------------------------------------------------------------- */

.dropzone,
#image-drop {
  position: relative;
  padding: calc(var(--space) * 3) calc(var(--space) * 2);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--motion), color var(--motion), background-color var(--motion);
}

.dropzone p,
#image-drop p {
  margin: 0;
}

.dropzone:hover,
#image-drop:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.dropzone.is-active,
.dropzone.over,
.dropzone:focus,
.dropzone:focus-visible,
#image-drop.is-active,
#image-drop.over,
#image-drop:focus,
#image-drop:focus-visible {
  border-style: solid;
  border-color: var(--accent);
  color: var(--ink);
}

.dropzone:focus-visible,
#image-drop:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}

.progress {
  height: 2px;
  margin: 0 0 calc(var(--space) * 3);
  overflow: hidden;
  background: var(--line);
  border-radius: 1px;
}

.progress span,
#upload-progress-bar {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  transition: width 180ms var(--ease);
}

/* -------------------------------------------------------------------------- */
/* Empty + files                                                               */
/* -------------------------------------------------------------------------- */

.empty {
  padding: calc(var(--space) * 5) var(--space) calc(var(--space) * 4);
}

.empty h2 {
  margin: 0 0 var(--space);
  font-size: 18px;
  font-weight: 600;
}

.empty p {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 14px;
}

.empty-quiet {
  padding: calc(var(--space) * 2) 0 calc(var(--space) * 3);
  color: var(--muted);
  font-size: 14px;
}

.file-table {
  margin-top: var(--space);
  border-top: 1px solid var(--line);
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 88px minmax(110px, 140px) minmax(0, auto);
  gap: var(--space);
  align-items: center;
  padding: 12px var(--space);
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background-color var(--motion), transform var(--motion);
}

.file-row:not(.file-row-head):hover {
  background: var(--row-hover);
}

.file-row-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.file-row-head:hover {
  background: transparent;
}

.file-row > :first-child,
.file-name,
.file-cell-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-row > :first-child {
  overflow: hidden;
}

.file-row > :first-child span,
.file-name span:not(.ico) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-mark {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--accent);
}

.file-meta {
  min-width: 0;
}

.file-meta h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.file-actions,
.row-actions,
.paste-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

.file-actions .btn,
.row-actions .btn,
.paste-actions .btn {
  min-height: 32px;
  min-width: 32px;
  padding: 0 8px;
  font-size: 13px;
}

.file-actions .btn.icon-btn,
.row-actions .btn.icon-btn,
.paste-actions .btn.icon-btn,
.file-actions .icon-btn,
.row-actions .icon-btn,
.paste-actions .icon-btn {
  width: 32px;
  padding: 0;
}

#file-list,
#shared-list,
#paste-list {
  min-width: 0;
}

#shared-list .file-row {
  border-top: 1px solid var(--line);
}

#shared-list .file-row:first-child {
  border-top: 0;
}

#shared-list .empty {
  padding: calc(var(--space) * 2) 0;
}

/* -------------------------------------------------------------------------- */
/* Image bin                                                                   */
/* -------------------------------------------------------------------------- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(var(--space) * 1.5);
  margin-top: calc(var(--space) * 2);
}

.image-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  transition: border-color var(--motion);
}

.image-tile-hit {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-tile-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 28px 10px 8px;
  background: linear-gradient(transparent, rgba(12, 10, 18, 0.88));
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.image-tile-actions,
.lightbox-actions {
  display: flex;
  gap: 4px;
}

.image-tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion);
}

.image-tile:hover .image-tile-actions,
.image-tile:focus-within .image-tile-actions {
  opacity: 1;
  pointer-events: auto;
}

.image-tile-actions .btn,
.lightbox-actions .btn {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  background: rgba(12, 10, 18, 0.82);
  border-color: var(--line);
}

.image-tile.is-shared {
  box-shadow: inset 0 0 0 1px rgba(124, 92, 252, 0.35);
}

.image-tile:hover {
  border-color: var(--accent);
}

@media (hover: none) {
  .image-tile-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

#empty-images,
#empty-pastes,
#empty-shared-images {
  min-width: 0;
}

/* -------------------------------------------------------------------------- */
/* Lightbox                                                                    */
/* -------------------------------------------------------------------------- */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space) * 1.5);
  padding: calc(var(--space) * 6) calc(var(--space) * 3) calc(var(--space) * 4);
  background: rgba(12, 10, 18, 0.94);
}

#lightbox-img {
  max-width: min(92vw, 1100px);
  max-height: min(78vh, 860px);
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--line);
}

#lightbox-cap {
  margin: 0;
  max-width: min(92vw, 72ch);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.lightbox-actions {
  justify-content: center;
}

#lightbox-close {
  position: absolute;
  top: calc(var(--space) * 2);
  right: calc(var(--space) * 2);
}

/* -------------------------------------------------------------------------- */
/* Paste editor                                                                */
/* -------------------------------------------------------------------------- */

.paste-compose,
#panel-pastes .paste-compose {
  display: grid;
  gap: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 3);
}

#paste-title {
  font-family: var(--sans);
}

#paste-save {
  justify-self: start;
}

#paste-list {
  border-top: 1px solid var(--line);
}

.paste-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 140px) minmax(0, auto);
  gap: var(--space);
  align-items: center;
  padding: 12px var(--space);
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background-color var(--motion), transform var(--motion);
}

.paste-row:hover {
  background: var(--row-hover);
}

.paste-row > :first-child,
.paste-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}

.paste-row .paste-date,
.paste-row > :nth-child(2) {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------- */
/* Aside / share / inspect                                                     */
/* -------------------------------------------------------------------------- */

.dash-side {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space) * 2);
  min-width: 0;
}

.side-card {
  padding: calc(var(--space) * 2.5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.side-card h2 {
  margin: 0 0 var(--space);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  margin-bottom: calc(var(--space) * 2);
}

.side-card-head h2 {
  margin: 0;
}

.side-card-head .btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.mono-block {
  margin: calc(var(--space) * 1.5) 0;
  padding: 12px;
  max-height: 160px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.side-card .btn-quiet {
  width: 100%;
}

.side-card .btn-primary {
  width: 100%;
  margin-top: var(--space);
}

#share-panel:not([hidden]),
#inspect-panel:not([hidden]) {
  animation: panel-in 160ms var(--ease);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.inspect {
  display: grid;
  gap: 0;
  margin: calc(var(--space) * 2) 0 0;
}

.inspect div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.inspect div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.inspect dt {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.inspect dd {
  margin: 4px 0 0;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.45;
}

/* -------------------------------------------------------------------------- */
/* Explain / protocol                                                          */
/* -------------------------------------------------------------------------- */

.explain {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--space) * 6) calc(var(--space) * 3) calc(var(--space) * 8);
}

.explain h1 {
  margin: 0 0 calc(var(--space) * 2);
  font-size: clamp(28px, 4vw, 36px);
}

.protocol {
  list-style: none;
  margin: calc(var(--space) * 5) 0;
  padding: 0;
}

.protocol li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: calc(var(--space) * 2);
  align-items: start;
  padding: calc(var(--space) * 2) 0;
  border-top: 1px solid var(--line);
}

.protocol li:last-child {
  border-bottom: 1px solid var(--line);
}

.step-n {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.protocol h2 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 0;
}

.protocol p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.threat {
  margin-top: calc(var(--space) * 6);
  overflow-x: auto;
}

.threat h2 {
  margin: 0 0 calc(var(--space) * 2);
  font-size: 18px;
}

.threat table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.threat th,
.threat td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}

.threat th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
}

.threat tr:last-child td {
  border-bottom: 0;
}

.threat tr:hover td {
  background: var(--row-hover);
}

.threat tbody tr:hover td:first-child {
  background: var(--row-hover);
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                      */
/* -------------------------------------------------------------------------- */

.site-foot {
  flex-shrink: 0;
  padding: calc(var(--space) * 3);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* Breakpoints                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .auth-shell,
  .dash {
    grid-template-columns: 1fr;
    gap: calc(var(--space) * 4);
  }

  .auth-intro h1 {
    max-width: none;
  }

  .dash-side {
    margin-top: var(--space);
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 48px;
    padding: 10px calc(var(--space) * 2);
    flex-wrap: wrap;
  }

  .auth-shell,
  .dash,
  .explain {
    padding-left: calc(var(--space) * 2);
    padding-right: calc(var(--space) * 2);
  }

  .auth-shell {
    padding-top: calc(var(--space) * 4);
    gap: calc(var(--space) * 4);
  }

  .dash-head {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-head .btn-primary {
    width: 100%;
    align-self: stretch;
  }

  #dash-nav {
    margin-left: calc(var(--space) * -2);
    margin-right: calc(var(--space) * -2);
    padding: 0 var(--space);
  }

  #dash-nav button {
    padding: 0 10px;
  }

  .file-row-head {
    display: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1.2fr) 56px minmax(72px, 96px) minmax(0, auto);
    gap: 6px;
  }

  .file-mark {
    display: none;
  }

  .file-actions,
  .row-actions,
  .paste-actions {
    justify-content: flex-start;
  }

  .paste-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .paste-row > :nth-child(2) {
    display: none;
  }

  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space);
  }

  #lightbox {
    padding: calc(var(--space) * 5) calc(var(--space) * 2) calc(var(--space) * 3);
  }

  #paste-save {
    width: 100%;
    justify-self: stretch;
  }

  .tabs {
    margin-left: calc(var(--space) * -2);
    margin-right: calc(var(--space) * -2);
    padding: 0 var(--space);
  }

  .auth-card {
    padding: calc(var(--space) * 2);
  }

  #toasts {
    right: var(--space);
    left: var(--space);
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 360px) {
  body {
    font-size: 14px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .wordmark {
    letter-spacing: 0.12em;
  }

  .top-nav {
    gap: 12px;
  }

  .auth-shell,
  .dash,
  .explain {
    padding-left: 12px;
    padding-right: 12px;
  }

  .protocol li {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
  }

  .btn {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .toast,
  #share-panel:not([hidden]),
  #inspect-panel:not([hidden]) {
    animation: none;
    transform: none;
  }
}
