:root {
      --bg-start: #3a3a3a;
      --bg-end:   #1f1f1f;
      --card-bg:  rgba(10, 10, 10, 0.6);
      --text:     #f3f3f3;
      --muted:    #bdbdbd;
      --accent:   #e0e0e0;
      --border:   rgba(255,255,255,0.12);
      --ok:       #8fdaa1;
      --warn:     #ffd580;
      --err:      #ff9a9a;
    }

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: system-ui, sans-serif;
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
  background: no-repeat url("images/bunpaper_1440p.png");
  background-size: cover;
  color: var(--text);
  position: relative;
  padding-bottom: 75px; /* avoid overlap with footer */
  scroll: hidden;
}

body.wiki-body {
  background-color: #6f7684;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(12, 20, 34, 0.3) 1px, transparent 1.6px),
    radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.1) 1px, transparent 1.6px),
    linear-gradient(150deg, #949dac 0%, #768296 45%, #5a6679 100%);
  background-size: 14px 14px, 20px 20px, 100% 100%;
  background-attachment: fixed;
}

body.wiki-body h1,
body.wiki-body h2,
body.wiki-body h3,
body.wiki-body .marble-content,
body.wiki-body .marble-content * {
  text-shadow: none;
}

/* Dim toggle */
.dim-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 3s ease;
}
body.dimmed .dim-overlay { opacity: 0.55; }


.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

@keyframes paneFlyIn {
  0% {
    opacity: 0;
    transform: perspective(1000px) translate3d(0, 26px, -120px) rotateX(8deg) scale(0.98);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: perspective(1000px) translate3d(0, 0, 0) rotateX(0deg) scale(1);
    filter: blur(0);
  }
}

.title-row,
.player-card,
.files-card,
.crank-card,
.marble-sidebar,
.marble-main,
.admin-sidebar,
.quote-card {
  animation: paneFlyIn 760ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}


header { padding: 24px 16px 8px; }
.title-row {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  border: 1px solid #333;
  padding: 8px 20px;
  border-radius: 100vh;
}
h1 { margin: 0; font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem); color: var(--text); text-shadow: 0 0 20px gray; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 14px;
  border-radius: 100vh;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
  font-weight: 600;
}
.btn i { margin-right: 8px; }
.btn:hover { transform: translateY(-1px); }

.reset-mya-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5000;
}


.status {
  font-size: 13px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
  opacity: .9;
}
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.err { color: var(--err); }

main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px;
  transition: padding 200ms ease;
  scroll: hidden;
}
main.expanded { padding: 0 4%;  scroll: hidden;}

.player-card {
  width: min(92vw, 1100px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  overflow: hidden;
  transition: width 2s ease, border-radius 2s ease, border-color 2s ease;
}
.player-card.expanded { width: 85%; border-radius: 6px; border-color: #222; }

.player-aspect { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.player-aspect video {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  object-fit: contain; background: #000;
}

.msg { position: fixed; top: 95px; left: 50%; transform: translateX(-50%); opacity: .8; font-size: 12px; text-align: center; }

.fidget-box {
position: absolute;
width: 200px;
height: 200px;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
pointer-events: auto;             /* clickable */
will-change: transform;
touch-action: none;               /* smoother touch dragging */
}

/* VERIFICATION SECTION */

#crankAttachment {
	position: fixed;
	top: calc(50% + 50px);
	left: 50%;
	transform: translateX(-50%);
	width: 20px;
	height: 180px;
	background: #555;
	z-index: 1;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#crankContainer {
	position: fixed;
	top: calc(50% + 180px);
	left: 50%;
	transform: translateX(-50%);
	width: 150px;
	height: 150px;
	z-index: 2;
}

#crank {
	width: 150px;
	height: 150px;
	border: 5px solid #555;
	border-radius: 50%;
	position: relative;
	background: #ddd;
	display: flex;
	justify-content: center;
	align-items: center;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#handle {
	width: 20px;
	height: 100px;
	background: #ab7d11;
	position: absolute;
	top: calc(50% - 100px);
	left: calc(50% - 10px);
	transform-origin: bottom center;
	cursor: grab;
	border-radius: 10px;
}

#handleEnd {
	width: 30px;
	height: 30px;
	background: #000;
	border-radius: 50%;
	position: absolute;
	top: -15px;
	left: calc(50% - 15px);
}

#knob {
	width: 20px;
	height: 20px;
	background: #ab7d11;
	border-radius: 50%;
	position: absolute;
	top: -10px;
	left: calc(50% - 10px);
}

#progressContainer {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 100%;
	background: #ccc;
	padding: 20px;
	border-radius: 10px;
	text-align: center;
	z-index: 3;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

#progressBar {
	width: 100%;
	height: 30px;
	background: #333;
	border-radius: 15px;
	overflow: hidden;
	margin-bottom: 10px;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#progressFill {
	width: 0;
	height: 100%;
	background: #ab7d11;
}

#tooltip {
	font-size: 1.2em;
	color: #111;
}

/* HUB SECTION */
.hub-grid {
  width: min(1100px, 92vw);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  perspective: 1200px;
  align-items: stretch;
}

.app-card {
  --tilt-x: 0;
  --tilt-y: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 200px;
  padding: 24px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(145deg, rgba(20,20,20,0.9), rgba(36,36,36,0.78));
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  transform-style: preserve-3d;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  overflow: hidden;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(
    circle at calc(50% + (var(--tilt-x) * 22%)) calc(50% - (var(--tilt-y) * 22%)),
    rgba(255,255,255,0.4),
    rgba(255,255,255,0) 45%
  );
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.app-card:hover::before { opacity: 1; }
.app-card:hover {
  border-color: rgba(255,255,255,0.36);
  box-shadow: 0 22px 36px rgba(0,0,0,0.45);
}

.app-card h2,
.app-card p,
.card-symbol {
  position: relative;
  z-index: 1;
}

.app-card h2 { margin: 0 0 10px; }

.card-symbol {
  margin: 0;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.2rem);
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.3));
}

.card-symbol i {
  color: #f0f0f0;
}


.app-card.is-coming-soon {
  opacity: 0.8;
  cursor: not-allowed;
}


@media (max-width: 900px) {
  .hub-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
}

/* FILES APP */
.files-card {
  width: min(720px, 92vw);
  padding: 28px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.files-card h2 { margin-top: 0; text-align: center; }
.files-form { display: flex; gap: 10px; }
.files-form input,
.link-row input,
.link-row textarea {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
}

.files-form input::placeholder,
.link-row input::placeholder,
.link-row textarea::placeholder {
  color: rgba(255,255,255,0.92);
}

.drop-zone {
  margin-top: 14px;
  border: 2px dashed rgba(255,255,255,0.35);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: rgba(0,0,0,0.2);
}
.drop-zone.dragover {
  border-color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.08);
}

.files-actions { margin-top: 14px; }
.files-error { color: var(--err); min-height: 1.2em; }
.files-info { color: var(--muted); }
.link-row { display: flex; gap: 10px; margin-top: 8px; }

.files-retention {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.select-picker {
  position: relative;
}

.select-picker::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.75);
  pointer-events: none;
  font-size: 0.82rem;
}

.files-retention select,
.convert-panel select,
.convert-panel input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  color: var(--text);
  padding: 12px 40px 12px 12px;
  font-size: 0.98rem;
}

.files-retention select:focus,
.convert-panel select:focus,
.convert-panel input:focus {
  outline: 2px solid rgba(255,255,255,0.3);
  outline-offset: 1px;
}

.retention-help {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.72);
}

.convert-panel {
  margin-top: 16px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}

.convert-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style: none;
}

.convert-panel summary::-webkit-details-marker { display: none; }

.convert-panel summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  color: rgba(255,255,255,0.7);
  transition: transform 160ms ease;
}

.convert-panel[open] summary::after { transform: rotate(180deg); }

.convert-grid {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.conversion-options,
.webp-options {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.conversion-options[hidden],
.webp-options[hidden] { display: none; }

.trim-offset-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 10px;
  margin-top: 4px;
}

.trim-offset-grid label {
  font-size: 0.86rem;
  color: rgba(255,255,255,0.82);
}

.trim-offset-grid input {
  min-width: 0;
}

.file-info-card {
  display: grid;
  gap: 16px;
  text-align: center;
  justify-items: center;
}


.file-info-lead {
  margin: 0;
  color: var(--muted);
}

.file-preview-wrap {
  width: min(340px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.35);
  padding: 10px;
}

.file-preview-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
}

.file-meta-list {
  margin: 4px 0;
  display: grid;
  gap: 12px;
}

.file-meta-list div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.04);
}

.file-meta-list dt {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.file-meta-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.download-btn {
  justify-content: center;
  width: fit-content;
  min-width: 180px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255,255,255,0.28), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.28);
}

.download-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-130%);
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.5) 50%, transparent 65%);
  pointer-events: none;
}

.download-btn.is-animating {
  animation: downloadPulse 500ms ease;
}

.download-btn.is-animating::after {
  animation: downloadShimmer 620ms ease;
}

@keyframes downloadPulse {
  0% { transform: scale(1); }
  45% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@keyframes downloadShimmer {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}


.crank-page {
  min-height: 100%;
}

.crank-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 100vh;
  padding: 28px 20px 20px;
}

.crank-card {
  width: min(680px, 94vw);
  text-align: center;
  z-index: 5;
}

.crank-form {
  margin-top: 14px;
  align-items: center;
}

.crank-form input {
  text-align: center;
}

.crank-progress-wrap {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 14px;
}

#progressContainer {
  position: static;
  transform: none;
  box-shadow: none;
}

#progressBar {
  width: 100%;
  height: 20px;
  background: rgba(0,0,0,0.5);
}

#progressFill {
  background: linear-gradient(90deg, rgba(171,125,17,0.85), rgba(224,205,126,0.95));
}

#tooltip {
  color: var(--text);
  margin-top: 10px;
}

#verifyError {
  min-height: 1.2rem;
  margin-top: 10px;
}

#crankAttachment {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: clamp(18px, 2.4vw, 24px);
  height: clamp(90px, 14vh, 140px);
  background: rgba(185,185,185,0.75);
  border-radius: 100vh;
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

#crankContainer {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: clamp(130px, 20vw, 200px);
  height: clamp(130px, 20vw, 200px);
}

#crank {
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255,255,255,0.3);
  background: linear-gradient(145deg, rgba(235,235,235,0.85), rgba(150,150,150,0.7));
}

#handle {
  width: clamp(16px, 2.2vw, 24px);
  height: clamp(70px, 10vw, 95px);
  top: calc(50% - clamp(70px, 10vw, 95px));
  left: calc(50% - (clamp(16px, 2.2vw, 24px) / 2));
}

.quotes-main {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 160px);
  overflow: hidden;
}

.quotes-board {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 160px);
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 10px 14px;
}

.quote-card {
  position: relative;
  width: min(320px, 88vw);
  max-width: 100%;
  padding: 18px;
  border-radius: 16px;
  background: rgba(18,18,18,0.72);
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
  opacity: 1;
  transition: box-shadow 220ms ease, border-color 220ms ease, transform 220ms ease;
}

.quote-card:hover {
  transform: translateY(-2px) rotate(var(--quote-tilt, 0deg));
}

.quote-card blockquote {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.quote-meta {
  margin: 14px 0 0;
  color: var(--muted);
}

.quote-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.quote-like-btn {
  min-width: 82px;
  gap: 8px;
  padding: 8px 12px;
}

.quote-like-btn i {
  color: #ffb9c7;
  margin-right: 0;
}

.quotes-fab-group {
  position: fixed;
  top: 92px;
  right: 22px;
  display: inline-flex;
  gap: 10px;
  z-index: 30;
}

.add-quote-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(20,20,20,0.75);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.quote-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 60;
  overflow: hidden;
}

.quote-modal.is-hidden,
.admin-sidebar.is-hidden,
.admin-sidebar-toggle.is-hidden {
  display: none;
}

.quote-form-card {
  width: min(620px, 94vw);
  display: grid;
  gap: 12px;
  position: sticky;
  top: 50%;
  transform: translateY(-50%);
}

.quote-form-card label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.quote-form-card textarea,
.quote-form-card input {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.quote-form-card textarea {
  min-height: 120px;
  resize: vertical;
}

.quote-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-sidebar {
  position: fixed;
  top: 154px;
  right: 0;
  width: min(360px, 88vw);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 14px;
  background: rgba(7,7,7,0.8);
  border: 1px solid rgba(255,255,255,0.2);
  border-right: 0;
  border-radius: 16px 0 0 16px;
  backdrop-filter: blur(10px);
  transform: translateX(0);
  transition: transform 220ms ease;
  z-index: 35;
}

.admin-sidebar.is-collapsed {
  transform: translateX(calc(100% + 8px));
}

.admin-sidebar-toggle {
  position: fixed;
  top: 154px;
  right: 14px;
  z-index: 36;
}

.admin-sidebar-toggle.is-collapsed {
  right: 14px;
}

.admin-sidebar-toggle.is-active {
  border-color: rgba(174, 225, 255, 0.65);
  background: rgba(41, 96, 136, 0.46);
}

.admin-quote-list {
  display: grid;
  gap: 10px;
}

.admin-quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
}

.admin-quote-actions {
  display: inline-flex;
  gap: 8px;
}

.admin-quote-row span {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}


/* Marble Codex */
.marble-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
}

.marble-sidebar,
.marble-main {
  background: rgba(8, 8, 8, 0.62);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(9px);
}

.marble-sidebar {
  padding: 16px;
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.marble-sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.marble-sidebar-header h1 {
  font-size: 1.4rem;
}

.page-tree {
  --tree-line: rgba(255,255,255,0.22);
}

.page-tree-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  position: relative;
}

.page-tree-list-root {
  padding-left: 0;
}

.page-tree-list:not(.page-tree-list-root)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -4px;
  bottom: 15px;
  border-left: 1px solid var(--tree-line);
}

.page-tree-node {
  position: relative;
  margin: 6px 0;
}

.page-tree-list:not(.page-tree-list-root) > .page-tree-node::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 18px;
  width: 11px;
  border-top: 1px solid var(--tree-line);
}

.page-tree-item {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.page-tree-item:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
  transform: translateX(2px);
}

.page-tree-caret,
.page-tree-leaf {
  width: 18px;
  min-width: 18px;
  color: rgba(255,255,255,0.72);
  text-align: center;
}

.page-tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-tree-item.active {
  border-color: rgba(174, 225, 255, 0.7);
  background: linear-gradient(135deg, rgba(74, 126, 166, 0.42), rgba(255,255,255,0.12));
  box-shadow: 0 0 0 1px rgba(174, 225, 255, 0.2);
}

.page-tree-children {
  margin-top: 4px;
}

.marble-main {
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-height: calc(100vh - 32px);
  width: 100%;
}

.marble-main-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 12px;
  width: 100%;
}

.marble-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(560px, 100%);
}

body:not(.marble-edit-mode) .marble-edit-only {
  display: none !important;
}

.marble-sticky-controls {
  position: sticky;
  top: 16px;
  z-index: 40;
  width: calc(100% + 16px);
  margin: 0 -8px;
}

.marble-sticky-controls:has(.editor-toolbar[hidden]) {
  display: none;
}

.marble-title-input {
  width: 100%;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.4);
  color: var(--text);
  font-size: 1.05rem;
  text-align: center;
}

.marble-small-btn {
  padding: 8px 12px;
  border-radius: 10px;
}

.marble-control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.marble-right-menu .marble-control-group,
.marble-right-menu-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.marble-page-settings {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.marble-right-menu .marble-page-settings {
  justify-content: flex-start;
}

.marble-right-menu .marble-small-btn,
.marble-right-menu .marble-select,
.marble-right-menu .marble-bg-field input {
  width: 100%;
}

.marble-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.marble-parent-select {
  max-width: 220px;
}

.marble-bg-field input {
  width: 190px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(0,0,0,0.45);
  color: var(--text);
  padding: 0 10px;
}

.marble-field input:disabled,
.marble-field select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.marble-title-input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.editor-toolbar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  position: static;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(9, 11, 18, 0.88);
  box-shadow: 0 14px 32px rgba(0,0,0,0.22);
  backdrop-filter: blur(12px);
}

.editor-toolbar[hidden] {
  display: none !important;
}

.editor-toolbar-scroll {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
  padding: 8px;
  scrollbar-width: thin;
}

.marble-tool-group {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 6px;
  padding-right: 8px;
  border-right: 1px solid rgba(255,255,255,0.12);
}

.marble-tool-group:last-of-type {
  border-right: 0;
}


.marble-save-tool-group {
  position: sticky;
  left: 0;
  z-index: 1;
  padding-left: 0;
  background: linear-gradient(90deg, rgba(9, 11, 18, 0.95), rgba(9, 11, 18, 0.76));
}

.marble-save-btn {
  border-color: rgba(110, 231, 183, 0.38);
  background: rgba(22, 101, 52, 0.34);
  color: #dcfce7;
}

.marble-save-btn:disabled {
  opacity: 0.62;
}

.marble-format-select {
  min-width: 132px;
}

.marble-size-field {
  min-width: 112px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(0,0,0,0.45);
  color: var(--text);
  padding: 0 10px;
  font-size: 0.84rem;
}

.marble-number-input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.marble-size-input {
  width: 48px;
}

.marble-line-select {
  min-width: 124px;
}

.marble-toggle-tool {
  height: 38px;
  padding: 0 12px;
  gap: 7px;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  white-space: nowrap;
}

.marble-toggle-tool.active,
.marble-toggle-tool[aria-pressed="true"] {
  border-color: rgba(174, 225, 255, 0.56);
  background: rgba(41, 96, 136, 0.5);
  color: #e6f6ff;
}

.marble-color-tool {
  width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  cursor: pointer;
}

.marble-color-tool input {
  width: 16px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.marble-tool {
  width: 42px;
  height: 38px;
  padding: 0;
}


.marble-select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.45);
  color: var(--text);
  padding: 0 10px;
}

.marble-image-controls-popup {
  position: fixed;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: rgba(7, 10, 17, 0.96);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  z-index: 80;
}

.marble-image-controls-popup[hidden] {
  display: none !important;
}

.marble-document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.marble-document-layout:has(> .marble-right-rail) {
  grid-template-columns: minmax(0, 1fr) minmax(190px, 230px);
}

.marble-right-rail {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  z-index: 25;
  margin-top: 28px;
}

.marble-content {
  --marble-page-bg: rgba(255, 255, 255, 1);
  --paragraph-ruler-color: rgba(100, 100, 100, 0.52);
  --paragraph-ruler-number-color: rgba(180, 180, 180, 0.78);
  --paragraph-ruler-opacity: 0.12;
  position: relative;
  counter-reset: marble-paragraph;
  margin-top: 14px;
  border: 1px solid rgba(0,0,0,0.2);
  background: var(--marble-page-bg);
  color: #000;
  font: normal 11pt/1.5 Arial, sans-serif;
  border-radius: 14px;
  padding: 16px;
  min-height: 60vh;
  width: 100%;
  overflow: visible;
}

.marble-content::before,
.book-mode-on .marble-book-page::before {
  content: "";
  position: absolute;
  top: 16px;
  right: -24px;
  bottom: 16px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--paragraph-ruler-color) 8%,
    var(--paragraph-ruler-color) 92%,
    transparent
  );
  opacity: var(--paragraph-ruler-opacity);
  pointer-events: auto;
  transition: opacity 180ms ease;
}

.marble-content:hover,
.marble-content:focus-within,
.book-mode-on .marble-book-page:hover,
.book-mode-on .marble-book-page:focus-within {
  --paragraph-ruler-opacity: 0.72;
}

.marble-content:focus {
  outline: 1px solid rgba(255,255,255,0.28);
}

.marble-content p {
  position: relative;
  margin-top: 0;
  margin-bottom: 0;
}

.marble-content p {
  counter-increment: marble-paragraph;
}

.marble-content p::after {
  content: counter(marble-paragraph);
  position: absolute;
  top: 0;
  right: -48px;
  width: 24px;
  color: var(--paragraph-ruler-number-color);
  opacity: var(--paragraph-ruler-opacity);
  transition: opacity 180ms ease;
  z-index: 1;
  font: 600 0.68rem/1.5 Arial, sans-serif;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.marble-content img {
  max-width: 100%;
  border-radius: 8px;
}

.marble-doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.marble-doc-table td,
.marble-doc-table th {
  min-width: 80px;
  min-height: 28px;
  border: 1px solid #b9c0c9;
  padding: 8px;
  vertical-align: top;
}

.marble-content blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 4px solid #8aa6c7;
  background: #f4f7fb;
}

.marble-content pre {
  padding: 12px;
  border-radius: 8px;
  background: #f1f3f5;
  overflow-x: auto;
}

.marble-content a {
  color: #2b6cb0;
}


.marble-chapter-break {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 34px 0;
  color: rgba(32, 36, 42, 0.78);
  font: 700 0.78rem/1.2 Arial, sans-serif;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  user-select: none;
}

.marble-chapter-break::before,
.marble-chapter-break::after {
  content: "";
  height: 2px;
  flex: 1 1 auto;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(40, 40, 40, 0), rgba(40, 40, 40, 0.42), rgba(245, 245, 245, 0.58));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
}

.marble-chapter-break::after {
  background: linear-gradient(90deg, rgba(245, 245, 245, 0.58), rgba(40, 40, 40, 0.42), rgba(40, 40, 40, 0));
}

.marble-chapter-label {
  flex: 0 1 auto;
  max-width: 70%;
  padding: 8px 15px;
  border: 1px solid rgba(20, 20, 20, 0.14);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.64), rgba(210, 214, 220, 0.36));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(12px) saturate(115%);
}

.marble-chapter-nav {
  width: 100%;
}

.marble-chapter-nav[hidden] {
  display: none !important;
}

.marble-chapter-nav-card,
.marble-right-menu {
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 18px;
  background: rgba(9, 11, 18, 0.78);
  box-shadow: 0 18px 42px rgba(0,0,0,0.32);
  backdrop-filter: blur(14px);
}

.marble-right-menu {
  max-height: none;
}

.marble-chapter-nav-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.marble-chapter-nav ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.marble-chapter-nav-link {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 8px 9px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.marble-chapter-nav-link:hover,
.marble-chapter-nav-link:focus-visible {
  border-color: rgba(174, 225, 255, 0.5);
  background: rgba(41, 96, 136, 0.42);
  transform: translateX(-2px);
  outline: none;
}

.marble-chapter-nav-number {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(235, 235, 235, 0.22), rgba(95, 95, 95, 0.34));
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 800;
}


.book-mode-on .marble-content {
  max-width: min(794px, 100%);
  margin-inline: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.marble-book-pages-container {
  display: grid;
  gap: 26px;
}

.book-mode-on .marble-book-page {
  position: relative;
  width: 794px;
  min-height: 1123px;
  box-sizing: border-box;
  padding: 72px 76px;
  background: var(--marble-page-bg, rgba(255, 255, 255, 1));
  color: #1c1c1c;
  border-radius: 10px;
  box-shadow: 0 12px 26px rgba(0,0,0,0.24);
}

.book-mode-on .marble-content::before {
  content: none;
}

.book-mode-on .marble-book-page::before {
  top: 72px;
  right: -24px;
  bottom: 72px;
}

.book-mode-on .marble-book-page p::after {
  right: -108px;
}

.book-mode-on .marble-main {
  align-items: center;
}

.marble-main .controls .is-active,
.marble-right-menu .is-active {
  border-color: rgba(174, 225, 255, 0.65);
  background: rgba(41, 96, 136, 0.46);
}

.marble-content img {
  max-width: 100%;
  border-radius: 8px;
}

.marble-content img[data-selected="true"],
.marble-content img.is-selected {
  outline: 2px solid rgba(71, 126, 170, 0.8);
}

.marble-image-scale-full { width: 100%; }
.marble-image-scale-large { width: 75%; }
.marble-image-scale-medium { width: 50%; }
.marble-image-scale-small { width: 33%; }

.marble-image-placement-inline { display: inline-block; margin: 8px 0; }
.marble-image-placement-left { display: block; margin: 10px auto 10px 0; }
.marble-image-placement-center { display: block; margin: 10px auto; }
.marble-image-placement-right { display: block; margin: 10px 0 10px auto; }

.marble-image-flow-none { float: none; clear: both; }
.marble-image-flow-wrap.marble-image-placement-left { float: left; margin: 10px 16px 12px 0; }
.marble-image-flow-wrap.marble-image-placement-right { float: right; margin: 10px 0 12px 16px; }
.marble-image-flow-wrap.marble-image-placement-center,
.marble-image-flow-wrap.marble-image-placement-inline { float: none; }

@media (max-width: 1180px) {
  .marble-tool-group {
    min-width: 0;
  }

  .marble-save-tool-group {
    position: static;
    background: transparent;
  }

  .marble-format-select,
  .marble-line-select,
  .marble-toggle-tool {
    flex: 1 1 112px;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .editor-toolbar-scroll {
    gap: 6px;
    padding: 6px;
  }

  .marble-tool-group {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 0 6px;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .marble-tool-group:last-of-type {
    border-bottom: 0;
  }

  .marble-tool,
  .marble-color-tool {
    width: 38px;
    height: 36px;
  }

  .marble-save-btn {
    width: 100%;
    justify-content: center;
  }

  .marble-size-field,
  .marble-line-select,
  .marble-toggle-tool {
    flex: 1 1 84px;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .marble-shell {
    grid-template-columns: 1fr;
  }

  .marble-main-header {
    margin-bottom: 10px;
  }

  .marble-title-wrap {
    justify-content: center;
  }

  .marble-sidebar {
    position: static;
    max-height: none;
  }


  .marble-book-pages-container {
    gap: 14px;
  }


  .marble-document-layout,
  .marble-document-layout:has(> .marble-right-rail) {
    grid-template-columns: 1fr;
  }

  .marble-right-rail {
    position: static;
    order: -1;
    width: 100%;
    margin-top: 16px;
  }

  .marble-chapter-nav-card {
    max-height: 34vh;
  }
}


.marble-danger-btn {
  color: #ffd0d0;
  border-color: rgba(255, 140, 140, 0.35);
  background: rgba(80, 18, 18, 0.42);
}

.marble-danger-btn:hover {
  border-color: rgba(255, 180, 180, 0.55);
}

.file-preview-panel {
  width: 100%;
  display: grid;
  gap: 12px;
}

.file-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.file-preview-heading h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.file-preview-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-preview-expand {
  flex-shrink: 0;
}

.file-preview-wrap {
  width: 100%;
  min-height: clamp(260px, 48vh, 640px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.file-preview-wrap--image {
  width: 100%;
  justify-self: stretch;
}

.file-preview-wrap--collection,
.file-preview-wrap--video,
.file-preview-wrap--pdf,
.file-preview-wrap--text {
  min-height: clamp(360px, 62vh, 760px);
  align-items: start;
}

.file-preview-image,
.file-preview-media,
.file-preview-frame {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
}

.file-preview-image {
  height: min(62vh, 640px);
  max-height: 640px;
  object-fit: contain;
}

.file-preview-media {
  max-height: 430px;
  background: rgba(0,0,0,0.45);
}

.file-preview-frame {
  min-height: min(52vh, 430px);
  background: rgba(255,255,255,0.94);
}

.file-audio-preview {
  width: 100%;
  display: grid;
  gap: 18px;
  place-items: center;
  padding: 22px;
  color: rgba(255,255,255,0.86);
}

.file-audio-preview > i {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 2rem;
}

.file-preview-audio {
  width: min(480px, 100%);
}

.file-preview-text,
.file-preview-modal__text {
  width: 100%;
  height: 100%;
  min-height: 280px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 10px;
  color: rgba(255,255,255,0.92);
  background: rgba(0,0,0,0.45);
  font: 0.88rem/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.file-preview-empty {
  display: grid;
  gap: 10px;
  justify-items: center;
  color: var(--muted);
  padding: 26px;
}

.file-preview-empty i {
  font-size: 2.4rem;
}

.file-preview-modal[hidden] {
  display: none;
}

.preview-modal-open {
  overflow: hidden;
}

.file-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: stretch;
  padding: 0;
}

.file-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.76);
  backdrop-filter: blur(10px);
}

.file-preview-modal__content {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(16,16,22,0.94);
  box-shadow: 0 24px 80px rgba(0,0,0,0.58);
  overflow: hidden;
}

.file-preview-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
}

.file-preview-modal__header h2,
.file-preview-modal__header p {
  margin: 0;
}

.file-preview-modal__header h2 {
  font-size: clamp(1rem, 2vw, 1.3rem);
  word-break: break-word;
}

.file-preview-modal__header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.file-preview-modal__body {
  min-height: 0;
  max-height: 100%;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: auto;
  background: rgba(0,0,0,0.28);
}

.file-preview-modal__body--pdf,
.file-preview-modal__body--text {
  align-items: stretch;
}

.file-preview-modal__image,
.file-preview-modal__media,
.file-preview-modal__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 14px;
}

.file-preview-modal__image,
.file-preview-modal__media {
  object-fit: contain;
  background: rgba(0,0,0,0.38);
}

.file-preview-modal__image {
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.file-preview-modal__frame {
  background: rgba(255,255,255,0.96);
}

.file-audio-preview--modal {
  width: min(720px, 100%);
}

.file-audio-preview--modal > i {
  width: 110px;
  height: 110px;
  font-size: 3rem;
}

@media (max-width: 700px) {
  .file-preview-heading,
  .file-preview-modal__header {
    align-items: stretch;
    flex-direction: column;
  }

  .file-preview-expand,
  .file-preview-modal__header .btn {
    width: 100%;
    justify-content: center;
  }

  .file-preview-modal__content {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .trim-offset-grid {
    grid-template-columns: 1fr;
  }
}

/* Consistent app navigation */
.hub-back-btn {
  position: fixed;
  top: 24px;
  left: 16px;
  z-index: 6000;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

/* Wide Files layouts */
.files-upload-card {
  width: min(1120px, 94vw);
}

.files-upload-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(300px, 0.92fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
}

.files-upload-primary,
.files-upload-settings,
.file-download-details {
  min-width: 0;
}

.files-upload-primary h2,
.files-upload-primary p:first-of-type {
  text-align: left;
}

.files-upload-primary h2 {
  margin-bottom: 8px;
}

.files-upload-primary .drop-zone {
  min-height: clamp(210px, 34vh, 360px);
  display: grid;
  place-items: center;
  margin-top: 18px;
}

.files-upload-settings .files-retention,
.files-upload-settings .convert-panel,
.files-upload-settings .files-actions {
  margin-top: 0;
}

.files-upload-settings {
  display: grid;
  gap: 16px;
}

.files-upload-settings .files-actions {
  display: flex;
  justify-content: flex-end;
}

.files-upload-settings .files-actions .btn {
  min-width: 150px;
}

.file-info-card {
  width: min(1080px, 94vw);
  justify-items: stretch;
  text-align: left;
}

.file-info-card > h2,
.file-info-card > .file-info-lead {
  text-align: center;
}

.file-download-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) minmax(280px, 0.8fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
}

.file-download-layout .file-preview-panel {
  min-width: 0;
}

.file-download-layout .file-preview-wrap {
  width: 100%;
}

.file-download-details {
  display: grid;
  gap: 18px;
  align-content: start;
}

.file-download-details .download-btn {
  justify-self: start;
}

@media (max-width: 900px) {
  .files-upload-layout,
  .file-download-layout {
    grid-template-columns: 1fr;
  }

  .files-upload-primary h2,
  .files-upload-primary p:first-of-type {
    text-align: center;
  }

  .files-upload-primary .drop-zone {
    min-height: 190px;
  }

  .file-info-card {
    text-align: center;
  }

  .file-download-details .download-btn {
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .hub-back-btn {
    position: static;
    width: fit-content;
    margin: 16px 16px 0;
  }

  header {
    padding-top: 12px;
  }

  .link-row {
    flex-direction: column;
  }
}

.collection-choice {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
}

.collection-choice[hidden] { display: none; }

.collection-choice p {
  margin: 0;
  color: var(--muted);
}

.collection-choice label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.collection-gallery {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.collection-gallery__item {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.collection-gallery__item:hover,
.collection-gallery__item:focus-visible {
  border-color: rgba(255,255,255,0.36);
  background: rgba(255,255,255,0.1);
}

.collection-gallery__item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 9px;
  background: rgba(0,0,0,0.28);
}

.collection-gallery__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.file-preview-modal__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-left: auto;
}

.file-preview-modal__actions .btn {
  justify-content: center;
}

.modal-download-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-preview-modal__content--image,
.file-preview-modal__content--collection {
  grid-template-rows: 1fr;
}

.file-preview-modal__content--image .file-preview-modal__header,
.file-preview-modal__content--collection .file-preview-modal__header {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: min(320px, calc(100vw - 32px));
  flex-direction: column;
  align-items: stretch;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background: rgba(16,16,22,0.72);
  backdrop-filter: blur(14px);
}

.file-preview-modal__content--image .file-preview-modal__body,
.file-preview-modal__content--collection .file-preview-modal__body {
  grid-row: 1;
  height: 100dvh;
  overflow: hidden;
}


.file-preview-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  background: rgba(16,16,22,0.68);
  color: var(--text);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(14px);
}

.file-preview-modal__nav:hover,
.file-preview-modal__nav:focus-visible {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.16);
  transform: translateY(-50%) scale(1.05);
}

.file-preview-modal__nav--prev {
  left: 18px;
}

.file-preview-modal__nav--next {
  right: 18px;
}

.file-preview-modal__nav i {
  font-size: 1.4rem;
}

.file-preview-modal__content--image .file-preview-modal__image,
.file-preview-modal__content--collection .file-preview-modal__image {
  width: auto;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  border-radius: 0;
}

@media (max-width: 700px) {
  .file-preview-modal__content--image .file-preview-modal__header,
  .file-preview-modal__content--collection .file-preview-modal__header {
    top: 8px;
    right: 8px;
    width: min(280px, calc(100vw - 16px));
  }

  .file-preview-modal__nav {
    width: 44px;
    height: 44px;
  }

  .file-preview-modal__nav--prev {
    left: 10px;
  }

  .file-preview-modal__nav--next {
    right: 10px;
  }
}
.login-card{max-width:440px;margin:auto;padding:2.5rem}.login-card h1{text-align:center}.login-domain{text-align:center;text-transform:uppercase;letter-spacing:.2em;opacity:.65}.login-card form{display:grid;gap:.8rem}.login-card input,.gallery-heading input,.gallery-upload-options select,.gallery-heading select{padding:.75rem;border-radius:.65rem;border:1px solid rgba(255,255,255,.2);background:rgba(10,10,15,.7);color:inherit}.login-honeypot{position:absolute!important;left:-10000px!important;width:1px;height:1px;overflow:hidden}.gallery-upload-options,.gallery-heading{display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:1rem}.gallery-table-wrap{overflow-x:auto}.gallery-table{width:100%;border-collapse:collapse}.gallery-table th,.gallery-table td{padding:.8rem;text-align:left;border-bottom:1px solid rgba(255,255,255,.12)}.gallery-table th[data-sort]{cursor:pointer}.gallery-table small{display:block;opacity:.65}.gallery-thumb img,.gallery-thumb video{width:72px;height:52px;object-fit:cover;border-radius:.4rem}.gallery-thumb span{font-size:2rem}
