:root {
  --ink: #1c1914;
  --muted: #5c564c;
  --paper: #f4efe4;
  --card: #fffaf1;
  --line: #d8d0c0;
  --accent: #2f5d4a;
  --accent-2: #c45c26;
  --good: #2f5d4a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #efe6d2 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", sans-serif;
}

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

h1,
h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent-2);
  font-weight: 600;
}

.lede {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.lede a,
.limit-note a {
  color: var(--accent);
  font-weight: 600;
}

.limit-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8ebe3;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.panel,
.status,
.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 12px 30px rgba(40, 28, 10, 0.06);
}

.drop {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 160px;
  padding: 24px;
  border: 1.5px dashed #b9ae97;
  border-radius: 12px;
  background: #fbf7ee;
  cursor: pointer;
  text-align: center;
}

.drop.over {
  border-color: var(--accent);
  background: #eef5f0;
}

.drop-title {
  font-weight: 600;
}

.drop-hint,
.fine {
  color: var(--muted);
  font-size: 0.92rem;
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
  cursor: pointer;
}

.format {
  border: 0;
  margin: 16px 0 4px;
  padding: 0;
}

.format legend {
  font-weight: 600;
  margin-bottom: 4px;
}

.format .check {
  margin: 8px 0 0;
}

button,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  background: var(--accent);
  color: #f7f3ea;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.link-button {
  width: auto;
  margin-top: 14px;
  padding: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.preview-head a {
  color: var(--accent);
  font-size: 0.9rem;
  white-space: nowrap;
}

.status,
.result {
  margin-top: 16px;
}

.meter {
  height: 8px;
  background: #ece4d4;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}

.meter span {
  display: block;
  height: 100%;
  width: 18%;
  background: var(--good);
  animation: pulse 1.2s ease-in-out infinite;
}

.meter.done span {
  width: 100%;
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    width: 18%;
  }
  50% {
    width: 72%;
  }
}

#stats {
  margin: 0 0 16px;
  padding-left: 18px;
}

.file-downloads {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.file-downloads li {
  display: grid;
  gap: 8px;
}

.file-downloads a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  background: #fbf7ee;
}

.file-downloads .failed {
  color: var(--muted);
  padding: 10px 12px;
}

.file-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
}

body.viewing #setup {
  display: none;
}

html:has(body.viewing) {
  height: 100%;
  overflow: hidden;
}

body.viewing {
  height: 100%;
  overflow: hidden;
  background: var(--paper);
}

body.viewing .shell {
  max-width: none;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

body.viewing .viewer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.viewing .viewer-bar {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f0e2;
}

body.viewing .crumbs {
  margin: 0;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

body.viewing .columns {
  flex: 1;
  gap: 0;
  height: auto;
  min-height: 0;
}

body.viewing .col {
  border: 0;
  border-radius: 0;
}

body.viewing .downloads {
  margin: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.viewer-summary {
  margin: 4px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.viewer-actions {
  display: flex;
  gap: 18px;
}

.viewer-actions .link-button {
  margin-top: 0;
}

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 12px;
  font-size: 0.94rem;
}

.crumb {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.crumb.current {
  color: var(--ink);
  text-decoration: none;
  cursor: default;
}

.crumb-sep {
  color: var(--muted);
}

.columns {
  display: flex;
  gap: 0;
  height: calc(100vh - 132px);
  min-height: 0;
}

#colFolders {
  flex: 0 0 auto;
  width: 240px;
  min-width: 160px;
}

#colFiles {
  flex: 0 0 auto;
  width: 280px;
  min-width: 180px;
}

.col-preview {
  flex: 1 1 auto;
  min-width: 280px;
  width: auto;
}

.split {
  flex: 0 0 5px;
  position: relative;
  z-index: 3;
  background: var(--line);
  cursor: col-resize;
}

.split::after {
  content: "";
  position: absolute;
  inset: 0 -4px;
}

.split:hover,
.split.dragging,
.split:focus-visible {
  background: var(--accent);
}

body.resizing,
body.resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.resizing iframe {
  pointer-events: none;
}

@media (max-width: 900px) {
  .columns {
    flex-direction: column;
    height: auto;
  }

  .split {
    display: none;
  }

  #colFolders,
  #colFiles,
  .col-preview {
    width: auto !important;
    min-width: 0;
    flex: none;
  }

  body.viewing {
    overflow: auto;
  }

  body.viewing .shell {
    height: auto;
    min-height: 100vh;
  }

  body.viewing .col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body.viewing .col:last-child {
    border-bottom: 0;
  }
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf7ee;
  overflow: hidden;
}

.col-preview {
  background: var(--card);
}

.col-head {
  margin: 0;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #f6f0e2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-head-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #f6f0e2;
  padding-right: 8px;
}

.col-head-bar .col-head {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
}

.col-head-btn {
  width: auto;
  flex: none;
  margin: 0;
  border: 0;
  border-radius: 6px;
  padding: 4px 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.col-head-btn:hover,
.col-head-btn[aria-expanded="true"] {
  background: #eef5f0;
}

.file-tools {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f6f0e2;
}

.file-tools[hidden] {
  display: none !important;
}

.file-tools input,
.file-tools select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fffaf1;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}

.col-list .row-msg {
  align-items: flex-start;
}

.row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.row-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-from {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-list .row.active .row-from {
  color: #d9e6dd;
}

.col-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow: auto;
  flex: 1;
}

.col-list li {
  display: flex;
  align-items: stretch;
  gap: 2px;
}

.col-list .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  width: auto;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.col-list .row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-list .row .meta {
  color: var(--muted);
  font-size: 0.84rem;
  flex: none;
}

.col-list .row:hover {
  background: #eef5f0;
}

.col-list .row.active {
  background: var(--accent);
  color: #f7f3ea;
}

.col-list .row.active .meta {
  color: #d9e6dd;
}

.col-list .caret {
  width: 22px;
  flex: none;
  align-self: center;
  height: 26px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}

.col-list .caret:hover {
  background: #eef5f0;
  color: var(--accent);
}

.col-list .caret-space {
  width: 22px;
  flex: none;
}

#folderList li[data-depth="0"] .row {
  font-weight: 600;
}

.col-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f0e2;
  padding-right: 14px;
}

.preview-head .col-head {
  border: 0;
  background: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.98rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.preview-tools [hidden] {
  display: none !important;
}

.preview-modes {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fffaf1;
}

.preview-switch button {
  width: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}

.preview-switch button.active {
  background: var(--accent);
  color: #f7f3ea;
}

.preview-pictures {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.col-head-btn.danger {
  color: var(--accent-2);
}

.download-menu {
  position: relative;
}

.download-menu > summary {
  list-style: none;
  cursor: pointer;
}

.download-menu > summary::-webkit-details-marker {
  display: none;
}

.download-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 8;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: 0 8px 24px rgba(28, 25, 20, 0.12);
}

.download-menu-list a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
}

.download-menu-list a:hover {
  background: #eef5f0;
  color: var(--accent);
}

.preview-head a {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.preview-head a.col-head-btn {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 20px;
}

#previewText {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.5;
}

#previewFrame {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
}

#previewImage {
  max-width: 100%;
  height: auto;
}

.downloads {
  margin-top: 16px;
}

code {
  font-size: 0.92em;
}
