:root {
  --bg: #fcfcfb;
  --surface: #ffffff;
  --surface-subtle: #f8f5f2;
  --text: #191817;
  --text-muted: #706a66;
  --border: #ded8d3;
  --border-strong: #c9c1bb;
  --accent: #cc7c5e;
  --accent-hover: #b96b50;
  --accent-soft: #f4e5df;
  --danger: #a44336;
  --danger-soft: #f9e9e5;
  --page-width: 1160px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

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

.site-header {
  min-height: 62px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar,
.page-shell {
  width: min(calc(100% - 40px), var(--page-width));
  margin-inline: auto;
}

.topbar {
  display: flex;
  min-height: 61px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
}

.retrieve-control {
  position: relative;
  min-width: 0;
}

.retrieve-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-label,
.workspace-label,
.selected-files-heading h3,
.content-section-heading h4,
.expiry-options legend {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.105em;
  line-height: 1.2;
  text-transform: uppercase;
}

.section-label {
  margin: 0;
  color: var(--text-muted);
}

.code-entry {
  display: grid;
  grid-template-columns: minmax(150px, 220px) auto;
  gap: 7px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

input:hover,
textarea:hover {
  border-color: #aaa19a;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

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

input::placeholder,
textarea::placeholder {
  color: #9a928d;
  opacity: 1;
}

.code-entry input {
  height: 38px;
  padding: 0 11px;
  font-family: var(--mono);
  font-size: 0.91rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button-primary {
  border-color: var(--accent);
  color: #fffdfc;
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button-secondary {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-subtle);
}

.button-text {
  min-height: 36px;
  padding-inline: 4px;
  color: var(--accent-hover);
  background: transparent;
}

.button-text:hover:not(:disabled) {
  color: var(--text);
}

.code-entry .button {
  min-height: 38px;
}

.retrieve-error {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  margin: 0;
}

.page-shell {
  padding-block: 26px 38px;
}

.share-tool,
.retrieved-drop {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.share-tool {
  padding: 24px;
}

.tool-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.share-input-workspace {
  min-height: 310px;
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

.share-input-workspace:focus-within {
  border-color: var(--accent);
}

.share-input-workspace.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.workspace-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.share-input-workspace textarea {
  display: block;
  min-height: 174px;
  padding: 4px 1px 12px;
  border: 0;
  border-radius: 0;
  resize: vertical;
  font-size: 0.96rem;
  line-height: 1.55;
  background: transparent;
}

.share-input-workspace textarea:hover,
.share-input-workspace textarea:focus,
.share-input-workspace textarea:focus-visible {
  border: 0;
  outline: 0;
}

.workspace-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.file-picker {
  min-height: 36px;
  order: 2;
  font-size: 0.8rem;
}

.file-limit {
  margin: 0 auto 0 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.69rem;
}

.selected-files {
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.selected-files-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 5px;
}

.selected-files-heading h3,
.selected-files-heading span {
  margin: 0;
}

.selected-files-heading h3 {
  color: var(--text-muted);
}

.selected-files-heading span {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.file-list,
.download-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.file-item,
.download-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  border-top: 1px solid var(--border);
}

.file-name,
.download-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.71rem;
  white-space: nowrap;
}

.remove-file,
.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 1.1rem;
  background: transparent;
}

.remove-file:hover,
.icon-button:hover {
  border-color: var(--border);
  color: var(--danger);
  background: var(--surface-subtle);
}

.form-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
}

.expiry-options {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.expiry-options legend {
  margin-bottom: 7px;
  color: var(--text-muted);
}

.segmented-control {
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

.segmented-control label {
  position: relative;
  min-width: 54px;
}

.segmented-control label + label {
  border-left: 1px solid var(--border-strong);
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  min-height: 36px;
  place-items: center;
  padding-inline: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--surface);
  cursor: pointer;
}

.segmented-control input:checked + span {
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.segmented-control input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.form-error {
  padding: 9px 11px;
  margin: 12px 0 0;
  border: 1px solid #ddb7ae;
  border-radius: 6px;
  color: var(--danger);
  font-size: 0.8rem;
  background: var(--danger-soft);
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 0 20px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.success-state {
  padding: 3px 0 1px;
}

.success-code-row,
.share-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
}

.success-code-row {
  padding: 21px 0;
  border-bottom: 1px solid var(--border);
}

.share-code {
  min-width: 0;
  font-family: var(--mono);
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1;
}

.share-link-row {
  padding-top: 16px;
}

.share-url {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.success-expiry,
.availability {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.success-expiry {
  margin: 14px 0 7px;
}

.retrieved-drop {
  padding: 22px 24px 24px;
  margin-bottom: 20px;
}

.retrieved-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.retrieved-code {
  margin: 5px 0 0;
  font-family: var(--mono);
  font-size: 1.25rem;
  letter-spacing: 0.11em;
}

.availability {
  margin: 8px 0 20px;
}

.content-section + .content-section {
  margin-top: 22px;
}

.content-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.content-section-heading h4 {
  margin: 0;
  color: var(--text-muted);
}

.small-copy,
.download-link {
  min-height: 34px;
  padding-inline: 11px;
  font-size: 0.73rem;
}

.shared-text {
  max-height: 340px;
  padding: 14px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: var(--surface-subtle);
}

.download-item {
  padding-block: 8px;
}

@media (max-width: 680px) {
  .topbar,
  .page-shell {
    width: min(calc(100% - 24px), var(--page-width));
  }

  .topbar {
    display: block;
    padding-block: 12px;
  }

  .brand {
    margin-bottom: 11px;
  }

  .retrieve-form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

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

  .retrieve-error {
    position: static;
    width: auto;
    max-width: none;
    margin-top: 8px;
  }

  .page-shell {
    padding-block: 18px 28px;
  }

  .share-tool,
  .retrieved-drop {
    padding: 18px;
  }

  .share-input-workspace {
    min-height: 290px;
    padding: 15px;
  }
}

@media (max-width: 440px) {
  .retrieve-form {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .code-entry {
    grid-template-columns: minmax(0, 1fr) 70px;
  }

  .share-tool,
  .retrieved-drop {
    padding: 15px;
  }

  .share-input-workspace {
    min-height: 276px;
    padding: 13px;
  }

  .share-input-workspace textarea {
    min-height: 146px;
  }

  .workspace-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-picker {
    width: 100%;
    order: 0;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .segmented-control {
    display: grid;
    width: 100%;
  }

  .form-footer > .button {
    width: 100%;
  }

  .success-code-row,
  .share-link-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .success-code-row .button,
  .share-link-row .button {
    width: 100%;
  }

  .file-item,
  .download-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
  }

  .file-item .file-size,
  .download-item .file-size {
    grid-column: 1;
    grid-row: 2;
  }

  .remove-file,
  .download-link {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

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