:root {
  --bg: #fffaf5;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #25170f;
  --muted: #6c5a51;
  --line: rgba(64, 35, 16, 0.12);
  --accent: #f76b38;
  --accent-deep: #d84e1f;
  --accent-soft: rgba(247, 107, 56, 0.12);
  --danger: #be3f2b;
  --shadow: 0 18px 60px rgba(77, 42, 21, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(247, 107, 56, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 206, 157, 0.34), transparent 34%),
    linear-gradient(180deg, #fffdfb 0%, var(--bg) 100%);
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(37, 23, 15, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 23, 15, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 85%);
}

.page-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
  position: relative;
}

.page-header {
  max-width: 720px;
  margin-bottom: 28px;
}

.brand-mark,
h1,
h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid rgba(247, 107, 56, 0.18);
  box-shadow: 0 10px 30px rgba(247, 107, 56, 0.1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
}

h1 {
  font-size: clamp(2.8rem, 4vw, 4.6rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.lede {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 58ch;
  margin: 18px 0 0;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel-upload,
.panel-download,
.panel-success {
  padding: 28px;
}

.stack {
  display: grid;
  gap: 18px;
}

.picker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr);
  gap: 16px;
}

.dropzone,
.folder-dropzone {
  border: 2px solid rgba(247, 107, 56, 0.24);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(247, 107, 56, 0.03), rgba(247, 107, 56, 0.08)),
    #fff;
  padding: 28px;
  min-height: 300px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.folder-dropzone:hover,
.folder-dropzone:focus-visible,
.dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 18px 30px rgba(247, 107, 56, 0.14);
  outline: none;
}

.dropzone-inner {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  max-width: 480px;
}

.dropzone-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(247, 107, 56, 0.1);
  color: var(--accent-deep);
  font-size: 1rem;
  font-weight: 800;
}

.dropzone-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(247, 107, 56, 0.14);
  font-size: 1.35rem;
  line-height: 1;
}

.dropzone-kicker {
  margin: 0 0 12px;
  color: var(--accent-deep);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
}

.dropzone-note {
  margin: 12px 0 0;
  color: var(--muted);
}

.progress-card,
.banner,
.file-item,
.download-card,
.summary-card {
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid var(--line);
}

.progress-card,
.banner,
.download-card,
.summary-card {
  padding: 16px 18px;
}

.progress-meta,
.file-meta,
.file-actions,
.download-actions,
.download-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-submeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-track {
  margin-top: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(37, 23, 15, 0.08);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffab54);
  transition: width 120ms linear;
}

.banner-error {
  color: var(--danger);
  background: rgba(190, 63, 43, 0.06);
  border-color: rgba(190, 63, 43, 0.18);
}

.file-list,
.download-files {
  display: grid;
  gap: 12px;
}

.file-item {
  padding: 16px 18px;
}

.file-name {
  font-weight: 700;
  word-break: break-word;
}

.file-subtitle,
.file-status,
.summary-text,
.empty-state,
.copy-status,
.meta-value {
  color: var(--muted);
}

.file-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.file-status-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(45, 157, 82, 0.14);
  color: #2d9d52;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.details-grid-inline {
  grid-column: 1 / -1;
  margin-top: 0;
}

.field {
  display: grid;
  gap: 8px;
}

.security-card {
  padding: 18px;
  border: 1px solid rgba(37, 23, 15, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span {
  font-size: 0.94rem;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.toggle-copy-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.toggle-heading {
  cursor: pointer;
}

.toggle-heading,
.toggle-title {
  display: block;
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 32px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-control {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(37, 23, 15, 0.14);
  box-shadow: inset 0 0 0 1px rgba(37, 23, 15, 0.08);
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.toggle-control::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(37, 23, 15, 0.18);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.toggle-switch input:focus-visible + .toggle-control {
  box-shadow:
    inset 0 0 0 1px rgba(247, 107, 56, 0.45),
    0 0 0 5px rgba(247, 107, 56, 0.12);
}

.toggle-switch input:checked + .toggle-control {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.toggle-switch input:checked + .toggle-control::after {
  transform: translateX(22px);
}

.toggle-switch input:disabled + .toggle-control {
  opacity: 0.55;
}

.toggle-title {
  line-height: 1.3;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.tooltip-trigger {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(37, 23, 15, 0.12);
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(77, 42, 21, 0.08);
}

.tooltip-trigger:hover,
.tooltip-trigger:focus-visible,
.tooltip-wrap.is-open .tooltip-trigger {
  box-shadow:
    0 10px 20px rgba(77, 42, 21, 0.12),
    0 0 0 5px rgba(247, 107, 56, 0.12);
}

.tooltip-bubble {
  position: absolute;
  top: calc(100% + 10px);
  left: var(--tooltip-left, 50%);
  z-index: 2;
  width: min(280px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(37, 23, 15, 0.08);
  background: rgba(37, 23, 15, 0.96);
  color: #fff7f1;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 18px 36px rgba(37, 23, 15, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(var(--tooltip-shift-x, -50%), -8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.tooltip-bubble::before {
  content: "";
  position: absolute;
  top: -6px;
  left: var(--tooltip-arrow-left, 50%);
  width: 12px;
  height: 12px;
  background: inherit;
  border-top: 1px solid rgba(37, 23, 15, 0.08);
  border-left: 1px solid rgba(37, 23, 15, 0.08);
  transform: translateX(-50%) rotate(45deg);
}

.tooltip-wrap.is-open .tooltip-bubble,
.tooltip-wrap:focus-within .tooltip-bubble {
  opacity: 1;
  pointer-events: auto;
  transform: translate(var(--tooltip-shift-x, -50%), 0);
}

.field-note {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.5;
}

.password-options-row {
  display: grid;
  gap: 18px;
}

.password-length-field,
.charset-field {
  align-content: start;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slider-row input[type="range"] {
  flex: 1;
  padding: 0;
  accent-color: var(--accent);
}

.slider-row output {
  min-width: 3ch;
  text-align: right;
  font-weight: 700;
  color: var(--accent-deep);
}

.charset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (min-width: 761px) {
  .password-options-row {
    grid-template-columns: minmax(220px, 1.05fr) minmax(320px, 1.45fr);
    align-items: end;
    gap: 20px;
  }

  .charset-field {
    min-width: 0;
  }

  .charset-grid {
    min-height: 48px;
    align-items: center;
  }
}

.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.mini-toggle input {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
}

.mini-toggle span {
  display: inline;
}

.mini-toggle input:focus {
  box-shadow: none;
}

.mini-toggle:has(input:focus-visible) {
  box-shadow: 0 0 0 5px rgba(247, 107, 56, 0.12);
  border-radius: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 14px 15px;
  font: inherit;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(247, 107, 56, 0.55);
  box-shadow: 0 0 0 5px rgba(247, 107, 56, 0.12);
}

textarea {
  resize: vertical;
}

.action-row,
.copy-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.action-row {
  margin-top: 24px;
}

.action-divider {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: lowercase;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #ff954b);
  box-shadow: 0 10px 24px rgba(247, 107, 56, 0.28);
}

.button-secondary {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.button-tertiary {
  color: var(--danger);
  background: rgba(190, 63, 43, 0.08);
  border: 1px solid rgba(190, 63, 43, 0.16);
  box-shadow: none;
}

.button-tertiary:hover,
.button-tertiary:focus-visible {
  box-shadow: 0 10px 20px rgba(190, 63, 43, 0.08);
}

.file-remove-button {
  min-width: 40px;
  padding: 8px 0;
  font-size: 1.05rem;
  line-height: 1;
  text-transform: lowercase;
}

.copy-row input {
  flex: 1;
  min-width: 240px;
}

.copy-status {
  min-height: 1.4em;
  margin-top: 10px;
}

.loading-state,
.state-card {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.loading-state {
  justify-items: center;
  padding: 48px 16px;
}

.password-prompt {
  max-width: 460px;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(247, 107, 56, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.summary-card {
  display: grid;
  gap: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.summary-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: var(--accent-deep);
  font-weight: 700;
}

.summary-message {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  white-space: pre-wrap;
  line-height: 1.6;
}

.download-card {
  display: grid;
  gap: 10px;
}

.download-actions {
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(37, 23, 15, 0.06);
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state {
  padding: 14px 2px 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1100px);
    padding: 28px 0 40px;
  }

  .panel-upload,
  .panel-download,
  .panel-success {
    padding: 18px;
  }

  .dropzone,
  .folder-dropzone {
    min-height: 220px;
    padding: 20px;
  }

  .picker-grid {
    grid-template-columns: 1fr;
  }

  .folder-dropzone {
    min-height: 180px;
    padding: 20px;
  }

  .details-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toggle-row {
    align-items: flex-start;
  }

  .toggle-copy-group {
    flex-wrap: wrap;
  }

  .progress-meta,
  .progress-submeta,
  .file-meta,
  .download-actions,
  .download-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .copy-row {
    align-items: stretch;
  }

  .copy-row .button,
  .action-row .button,
  .action-row a.button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .tooltip-bubble {
    width: min(280px, calc(100vw - 24px));
  }
}

@media (hover: hover) {
  .tooltip-wrap:hover .tooltip-bubble {
    opacity: 1;
    pointer-events: auto;
    transform: translate(var(--tooltip-shift-x, -50%), 0);
  }

  .tooltip-wrap:hover .tooltip-trigger {
    box-shadow:
      0 10px 20px rgba(77, 42, 21, 0.12),
      0 0 0 5px rgba(247, 107, 56, 0.12);
  }
}

@media (hover: hover) and (max-width: 760px) {
  .tooltip-wrap:hover .tooltip-bubble {
    transform: translate(var(--tooltip-shift-x, -50%), 0);
  }
}
