/* Share public UI — Phase 5 visual polish (scoped to html.share-public only) */

html#ht_brw.share-public {
  color-scheme: light dark;
  --share-bg: color-mix(in srgb, Canvas 92%, #64748b 8%);
  --share-bg-grad: color-mix(in srgb, Canvas 88%, #6366f1 6%);
  --share-surface: color-mix(in srgb, Canvas 96%, #64748b 4%);
  --share-surface-2: color-mix(in srgb, Canvas 94%, #64748b 6%);
  --share-border: color-mix(in srgb, CanvasText 18%, transparent);
  --share-border-strong: color-mix(in srgb, CanvasText 28%, transparent);
  --share-text: CanvasText;
  --share-muted: color-mix(in srgb, CanvasText 62%, transparent);
  --share-accent: color-mix(in srgb, #2563eb 72%, CanvasText 28%);
  --share-accent-hover: color-mix(in srgb, #1d4ed8 75%, CanvasText 25%);
  --share-success: color-mix(in srgb, #16a34a 55%, CanvasText 45%);
  --share-success-bg: color-mix(in srgb, #16a34a 12%, Canvas 88%);
  --share-success-border: color-mix(in srgb, #16a34a 35%, transparent);
  --share-radius: 0.85rem;
  --share-radius-sm: 0.55rem;
  --share-shadow: 0 1px 2px color-mix(in srgb, CanvasText 8%, transparent),
    0 12px 32px color-mix(in srgb, CanvasText 6%, transparent);
  --share-transition: 180ms ease;

  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: linear-gradient(
    165deg,
    var(--share-bg) 0%,
    var(--share-bg-grad) 48%,
    var(--share-bg) 100%
  );
  min-height: 100%;
}

html#ht_brw.share-public *,
html#ht_brw.share-public *::before,
html#ht_brw.share-public *::after {
  box-sizing: border-box;
}

html#ht_brw.share-public body {
  margin: 0;
  color: var(--share-text);
  background: transparent;
}

/* Browser chrome (Phase 1 + minimal-up2k overlap) */
html#ht_brw.share-public #files,
html#ht_brw.share-public #files thead,
html#ht_brw.share-public #bdoc,
html#ht_brw.share-public #pro,
html#ht_brw.share-public #epi,
html#ht_brw.share-public #op_search,
html#ht_brw.share-public #op_player,
html#ht_brw.share-public #op_bup,
html#ht_brw.share-public #op_mkdir,
html#ht_brw.share-public #op_new_md,
html#ht_brw.share-public #op_msg,
html#ht_brw.share-public #op_cfg,
html#ht_brw.share-public #path,
html#ht_brw.share-public #tree,
html#ht_brw.share-public #srv_info,
html#ht_brw.share-public #wfp,
html#ht_brw.share-public #repl,
html#ht_brw.share-public #js_bork,
html#ht_brw.share-public #widget,
html#ht_brw.share-public #opa_srch,
html#ht_brw.share-public #opa_bup,
html#ht_brw.share-public #opa_mkd,
html#ht_brw.share-public #opa_md,
html#ht_brw.share-public #opa_msg,
html#ht_brw.share-public #opa_auc,
html#ht_brw.share-public #opa_cfg,
html#ht_brw.share-public #opa_del,
html#ht_brw.share-public #ops,
html#ht_brw.share-public #u2conf,
html#ht_brw.share-public #nthread_sub,
html#ht_brw.share-public #nthread_add,
html#ht_brw.share-public #u2cards,
html#ht_brw.share-public #srch_dz,
html#ht_brw.share-public #srch_zd,
html#ht_brw.share-public #u2life,
html#ht_brw.share-public #u2foot,
html#ht_brw.share-public #nthread,
html#ht_brw.share-public #u2conf td.c + .c,
html#ht_brw.share-public #u2conf tr:first-child > td.c[data-perm="read"]:first-child,
html#ht_brw.share-public #u2etas > div.o:first-child {
  display: none !important;
}

html#ht_brw.share-public #op_up2k {
  display: block !important;
}

html#ht_brw.share-public #op_up2k {
  box-sizing: border-box;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

html#ht_brw.share-public #wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 0.75rem 2rem;
}

html#ht_brw.share-public #op_up2k {
  padding-top: clamp(0.5rem, 4vh, 2.5rem);
}

html#ht_brw.share-public #acc_info {
  box-sizing: border-box;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.65rem 1.25rem 0;
  text-align: right;
  font-size: 0.82rem;
  color: var(--share-muted);
}

html#ht_brw.share-public #acc_info a {
  color: inherit;
  text-underline-offset: 0.12em;
}

html#ht_brw.share-public #acc_info #srv_info2 {
  display: none;
}

/* Hero */
html#ht_brw.share-public #share-hero {
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(1rem, 3vh, 2rem) 1.25rem 0.5rem;
  text-align: center;
  border: none;
  background: transparent;
}

html#ht_brw.share-public #share-hero h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

html#ht_brw.share-public #share-hero .share-sub {
  margin: 0;
  font-size: clamp(1rem, 2.8vw, 1.12rem);
  line-height: 1.5;
  color: var(--share-muted);
  font-weight: 450;
}

/* Upload policy (below hero, above drop zone) */
html#ht_brw.share-public .share-upload-policy {
  margin: 0.35rem auto 0.85rem;
  padding: 0 0.25rem;
  max-width: 36rem;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--share-muted);
}

/* Upload card shell */
html#ht_brw.share-public #u2conf {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  border-collapse: separate;
  border-spacing: 0;
}

html#ht_brw.share-public #u2conf.w,
html#ht_brw.share-public #u2conf.ww {
  width: 100% !important;
  max-width: 100% !important;
}

html#ht_brw.share-public #u2btn_ct {
  margin: 0 auto;
  max-width: 100%;
}

html#ht_brw.share-public #u2btn,
html#ht_brw.share-public #u2btn_ct {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

html#ht_brw.share-public #u2btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 9.5rem;
  margin: 0 auto !important;
  padding: 1.35rem 1.25rem !important;
  width: 100% !important;
  max-width: 100% !important;
  font-size: 0 !important;
  line-height: 1.35 !important;
  font-weight: 600;
  letter-spacing: normal !important;
  text-shadow: none !important;
  cursor: pointer;
  border-radius: var(--share-radius) !important;
  border: 2px dashed var(--share-border-strong) !important;
  background: var(--share-surface) !important;
  box-shadow: var(--share-shadow);
  transition: border-color var(--share-transition), background var(--share-transition),
    box-shadow var(--share-transition), transform var(--share-transition);
}

html#ht_brw.share-public #u2btn::before {
  content: "Drop files here";
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--share-text);
}

html#ht_brw.share-public #u2btn::after {
  content: "Choose files";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.65rem;
  min-height: 2.85rem;
  min-width: 11rem;
  padding: 0.55rem 1.25rem;
  font-size: 0.98rem;
  font-weight: 650;
  border-radius: var(--share-radius-sm);
  border: 1px solid color-mix(in srgb, var(--share-accent) 35%, var(--share-border));
  background: color-mix(in srgb, var(--share-accent) 14%, var(--share-surface));
  color: var(--share-text);
}

html#ht_brw.share-public #u2btn:hover {
  border-color: color-mix(in srgb, var(--share-accent) 45%, var(--share-border-strong)) !important;
  background: var(--share-surface-2) !important;
}

html#ht_brw.share-public #u2btn:focus-visible {
  outline: 2px solid var(--share-accent);
  outline-offset: 3px;
}

html#ht_brw.share-public #u2btn #u2bm {
  display: none;
}

html#ht_brw.share-public #u2btn sup {
  display: none;
}

html#ht_brw.share-public #drops.vis ~ #u2btn_ct #u2btn,
html#ht_brw.share-public #up_dz.hl ~ * #u2btn {
  border-color: color-mix(in srgb, var(--share-accent) 55%, var(--share-border-strong)) !important;
  background: color-mix(in srgb, var(--share-accent) 8%, var(--share-surface)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--share-accent) 18%, transparent),
    var(--share-shadow);
}

html#ht_brw.share-public #uput,
html#ht_brw.share-public label[for="uput"] {
  display: none !important;
}

/* Shared primary/secondary controls */
html#ht_brw.share-public #cuplinks,
html#ht_brw.share-public button.share-copy-link,
html#ht_brw.share-public #share-ready .share-ready-copy {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.55rem 1.05rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--share-radius-sm);
  border: 1px solid color-mix(in srgb, var(--share-accent) 35%, var(--share-border));
  background: color-mix(in srgb, var(--share-accent) 14%, var(--share-surface));
  color: inherit;
  transition: background var(--share-transition), border-color var(--share-transition),
    transform var(--share-transition);
}

html#ht_brw.share-public #cuplinks:hover,
html#ht_brw.share-public button.share-copy-link:hover,
html#ht_brw.share-public #share-ready .share-ready-copy:hover {
  background: color-mix(in srgb, var(--share-accent) 22%, var(--share-surface));
  border-color: color-mix(in srgb, var(--share-accent) 50%, var(--share-border));
}

html#ht_brw.share-public #cuplinks:focus-visible,
html#ht_brw.share-public button.share-copy-link:focus-visible,
html#ht_brw.share-public #share-ready .share-ready-copy:focus-visible {
  outline: 2px solid var(--share-accent);
  outline-offset: 2px;
}

html#ht_brw.share-public #cuplinks:active,
html#ht_brw.share-public button.share-copy-link:active,
html#ht_brw.share-public #share-ready .share-ready-copy:active {
  transform: scale(0.98);
}

html#ht_brw.share-public #cuplinks {
  margin: 0.35rem 0.5rem 0.35rem 0;
}

html#ht_brw.share-public #luplinks {
  font-size: 0.88em;
  color: var(--share-muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Upload progress / ETA */
html#ht_brw.share-public #u2etaw {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  margin: 1.15rem auto 0.5rem !important;
  padding: 0.85rem 1rem;
  text-align: left;
  border-radius: var(--share-radius-sm);
  border: 1px solid var(--share-border);
  background: color-mix(in srgb, var(--share-surface) 85%, transparent);
}

html#ht_brw.share-public #u2etas {
  background: none !important;
  border: none !important;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--share-muted);
}

html#ht_brw.share-public #u2etaw #u2etat {
  font-weight: 600;
  color: var(--share-text);
}

html#ht_brw.share-public #u2tabw {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-top: 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--share-radius-sm);
  border: 1px solid var(--share-border);
  background: var(--share-surface);
}

html#ht_brw.share-public #u2tab {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

html#ht_brw.share-public #u2tab thead td {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  line-height: 1.5;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--share-border);
  background: color-mix(in srgb, var(--share-surface-2) 70%, transparent);
}

html#ht_brw.share-public .share-u2-hdr-title {
  font-weight: 650;
  font-size: 0.95rem;
}

html#ht_brw.share-public .share-u2-hdr-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

html#ht_brw.share-public #u2tab tbody tr[id^="f"] td {
  padding: 0.65rem 0.85rem;
  vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--share-border) 65%, transparent);
}

html#ht_brw.share-public #u2tab tbody tr[id^="f"]:last-child td {
  border-bottom: none;
}

html#ht_brw.share-public #u2tab tbody tr[id^="f"] td:first-child {
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

html#ht_brw.share-public #u2tab tbody tr[id^="f"] td:first-child a {
  display: inline;
  word-break: break-all;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  color: var(--share-muted);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

html#ht_brw.share-public #u2tab tbody tr[id^="f"] td:nth-child(2),
html#ht_brw.share-public #u2tab tbody tr[id^="f"] td:nth-child(3) {
  font-size: 0.88rem;
  color: var(--share-muted);
}

html#ht_brw.share-public #u2tab td.prog {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.82rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

html#ht_brw.share-public #u2tab span.inf,
html#ht_brw.share-public #u2tab span.ok,
html#ht_brw.share-public #u2tab span.err {
  display: inline-block;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

html#ht_brw.share-public button.share-copy-link {
  margin: 0.55rem 0 0;
  min-width: 7.25rem;
}

/* Phase 4: Share Ready summary */
html#ht_brw.share-public #share-ready {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 1rem auto 0.85rem;
  padding: 1.15rem 1.2rem;
  border-radius: var(--share-radius);
  border: 1px solid var(--share-success-border);
  background: var(--share-success-bg);
  color: inherit;
  box-shadow: var(--share-shadow);
  transition: opacity var(--share-transition), transform var(--share-transition);
}

html#ht_brw.share-public #share-ready:not([hidden]) {
  animation: share-ready-in 220ms ease;
}

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

html#ht_brw.share-public #share-ready[hidden] {
  display: none !important;
}

html#ht_brw.share-public #share-ready .share-ready-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

html#ht_brw.share-public #share-ready .share-ready-title::before {
  content: "✓ ";
  color: var(--share-success);
  font-weight: 800;
}

html#ht_brw.share-public #share-ready .share-ready-count {
  margin: 0 0 0.95rem;
  font-size: 1rem;
  color: var(--share-text);
}

html#ht_brw.share-public #share-ready .share-ready-copy {
  width: 100%;
  max-width: 20rem;
  font-size: 1rem;
}

@media (max-width: 480px) {
  html#ht_brw.share-public #share-hero {
    padding: 0.85rem 0.85rem 0.35rem;
  }

  html#ht_brw.share-public #op_up2k {
    padding: 0.35rem 0.65rem 2rem;
  }

  html#ht_brw.share-public #u2btn {
    min-height: 8.5rem;
    padding: 1.1rem 0.85rem !important;
  }

  html#ht_brw.share-public #cuplinks {
    display: inline-flex;
    width: auto;
    max-width: 100%;
  }

  html#ht_brw.share-public .share-u2-hdr-actions {
    width: 100%;
    justify-content: flex-start;
  }

  html#ht_brw.share-public button.share-copy-link {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
  }

  html#ht_brw.share-public #share-ready {
    padding: 1rem 0.95rem;
  }

  html#ht_brw.share-public #share-ready .share-ready-copy {
    max-width: 100%;
  }
}

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