/* Home content. Uploaders: quick upload + recent uploads; visitors: intro.
   Then everyone: latest shares, latest articles, latest images. */
.yuimg-home {
    --home-surface: var(--yuimg-surface, #f3f4f6);
    --home-ink: var(--yuimg-heading, #111827);
    --home-muted: var(--yuimg-muted, #656565);
    --home-line: var(--yuimg-border, #e6eaed);
    --home-accent: var(--yuimg-accent, #111827);
    /* My uploads and the wall share one tile size so both rows line up. */
    --home-tile: 164px;
    --home-gap: 14px;
    color: var(--home-ink);
}

/* Quick upload (IDs are used by home.js). */
.yuimg-quick { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: stretch; gap: 20px 24px; margin-bottom: 28px; padding: 16px; border: 1px solid var(--home-line); border-radius: var(--yuimg-radius-lg, 16px); background: #fff; }
.yuimg-quick:has(> .yuimg-quick-result:not([hidden])) { grid-template-columns: minmax(0, 1fr) 260px 340px; }
.yuimg-quick-drop { display: flex; min-height: 176px; box-sizing: border-box; align-items: center; justify-content: center; gap: 18px; padding: 20px 24px; border: 1px dashed #d1d5db; border-radius: var(--yuimg-radius, 10px); background: #f9fafb; color: var(--home-ink); text-align: left; cursor: pointer; transition: background .18s, border-color .18s; }
.yuimg-quick-drop:hover, .yuimg-quick-drop.is-over { border-color: var(--home-accent); background: #f3f4f6; }
.yuimg-quick-drop svg { flex: none; width: 26px; height: 26px; padding: 13px; border-radius: 50%; background: #fff; color: var(--home-accent); box-shadow: var(--yuimg-shadow-sm); }
.yuimg-quick-drop > span { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.yuimg-quick-drop strong { font-size: 15px; font-weight: 650; }
.yuimg-quick-drop small { color: var(--home-muted); font-size: 12px; line-height: 1.6; }
.yuimg-quick-options { display: flex; min-width: 0; flex-direction: column; justify-content: center; gap: 10px; }
.yuimg-quick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.yuimg-quick-head h2 { margin: 0; color: var(--home-ink); font-size: 15px; font-weight: 650; }
.yuimg-quick-head span { color: var(--home-muted); font-size: 12px; }
.yuimg-quick-privacy { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 4px; border-radius: 999px; background: var(--home-surface); }
.yuimg-quick-privacy button { min-height: 32px; padding: 6px; border: 0; border-radius: 999px; background: transparent; color: var(--home-muted); font-size: 12px; cursor: pointer; }
.yuimg-quick-privacy button.is-active { background: #fff; color: var(--home-accent); font-weight: 600; box-shadow: 0 1px 3px rgba(17, 24, 39, .1); }
.yuimg-quick-hint, .yuimg-quick-status { margin: 0; color: var(--home-muted); font-size: 12px; line-height: 1.7; }
.yuimg-quick-status { color: var(--home-accent); overflow-wrap: anywhere; }
.yuimg-quick-status:empty { display: none; }
.yuimg-quick-result { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding-left: 24px; border-left: 1px solid var(--home-line); }
.yuimg-quick-result[hidden] { display: none; }
.yuimg-quick-result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.yuimg-quick-result-head strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.yuimg-quick-result-head span { flex: none; color: var(--home-muted); font-size: 11px; }
.yuimg-quick-label { display: block; margin-bottom: 6px; color: var(--home-muted); font-size: 12px; }
.yuimg-quick-url { display: flex; gap: 5px; }
.yuimg-quick-url input { min-width: 0; flex: 1; height: 36px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--home-line); border-radius: var(--yuimg-radius-sm, 6px); background: #fff; color: var(--home-ink); font: 12px var(--yuimg-mono); }
.yuimg-quick-url button { flex: none; padding: 0 12px; border: 0; border-radius: var(--yuimg-radius-sm, 6px); background: var(--home-accent); color: #fff; font-size: 12px; cursor: pointer; }
.yuimg-quick-url button:hover { background: var(--yuimg-accent-hover); }
.yuimg-quick-format { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.yuimg-quick-format label { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--home-muted); font-size: 12px; }
.yuimg-quick-format select { width: 100%; min-width: 0; height: 34px; padding: 0 5px; border: 1px solid var(--home-line); border-radius: var(--yuimg-radius-sm, 6px); background: #fff; color: var(--home-ink); font-size: 12px; }

/* My uploads */
.yuimg-mine { margin-bottom: 18px; }
.yuimg-mine-track { display: grid; grid-template-columns: repeat(auto-fill, var(--home-tile)); gap: var(--home-gap); }
.yuimg-mine-item { min-width: 0; margin: 0; }
.yuimg-mine-open { display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: var(--yuimg-radius, 10px); background: var(--home-surface); box-shadow: var(--yuimg-shadow-sm); cursor: zoom-in; }
.yuimg-mine-open img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .5s var(--yuimg-ease); }
.yuimg-mine-open:hover img { transform: scale(1.05); }
.yuimg-mine-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; }
.yuimg-mine-name { min-width: 0; flex: 1 1 100%; overflow: hidden; color: var(--home-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.yuimg-mine-badges { flex: none; display: flex; }
.yuimg-mine-actions { display: flex; flex: none; gap: 5px; margin-left: auto; }
.yuimg-mine-badge, .yuimg-mine-copy, .yuimg-mine-delete { box-sizing: border-box; display: inline-flex; height: 24px; align-items: center; justify-content: center; padding: 0 7px; border: 1px solid var(--home-line); border-radius: 5px; color: var(--home-muted); font-size: 11px; font-style: normal; line-height: 1; }
.yuimg-mine-badge.is-private { border-color: #e2d5c3; color: #886137; }
.yuimg-mine-copy, .yuimg-mine-delete { flex: none; background: #fff; cursor: pointer; }
.yuimg-mine-copy:hover { border-color: var(--home-accent); color: var(--home-accent); }
.yuimg-mine-delete:hover { border-color: #e3b4ae; background: #fff5f4; color: #b42318; }
.yuimg-mine-delete:disabled { opacity: .6; cursor: wait; }
.yuimg-mine-empty { margin: 0; padding: 28px 20px; border: 1px dashed #d1d5db; border-radius: 10px; background: #f9fafb; color: var(--home-muted); font-size: 13px; line-height: 1.8; text-align: center; }

/* Visitor intro */
.yuimg-home-intro { max-width: 720px; margin: 8px 0 48px; }
.yuimg-home-intro h1 { margin: 0; color: var(--home-ink); font-size: clamp(28px, 3.4vw, 42px); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.yuimg-home-intro p { margin: 12px 0 0; color: var(--home-muted); font-size: 16px; line-height: 1.75; }
/* Section rhythm: one heading row per content type. */
.yuimg-home-section + .yuimg-home-section { margin-top: 56px; }
.yuimg-home-section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.yuimg-home-section-head h2 { margin: 0; color: var(--home-ink); font-size: 20px; font-weight: 700; line-height: 1.3; }
.yuimg-home-section-head > a { margin-left: auto; color: var(--home-muted); font-size: 14px; text-decoration: none; white-space: nowrap; }
.yuimg-home-section-head > a:hover { color: var(--home-ink); }

/* Content tabs: one panel at a time. */
.yuimg-home-tabs { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--home-line); }
.yuimg-home-tablist { display: flex; min-width: 0; gap: 28px; }
.yuimg-home-tablist [role="tab"] { position: relative; display: inline-flex; min-height: 44px; align-items: center; gap: 6px; margin-bottom: -1px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--home-muted); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; transition: color .18s, border-color .18s; }
.yuimg-home-tablist [role="tab"]:hover { color: var(--home-ink); }
.yuimg-home-tablist [role="tab"][aria-selected="true"] { border-bottom-color: var(--home-ink); color: var(--home-ink); }
.yuimg-home-tablist [role="tab"] span { color: #9ca3af; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.yuimg-home-tabs-more { margin-left: auto; padding-bottom: 12px; color: var(--home-muted); font-size: 14px; text-decoration: none; white-space: nowrap; }
.yuimg-home-tabs-more:hover { color: var(--home-ink); }
.yuimg-home-panel[hidden] { display: none; }

/* Shares: fixed-ratio covers in a row. */
.yuimg-home-shares { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px 20px; }
.yuimg-home-share { display: flex; min-width: 0; flex-direction: column; gap: 4px; color: var(--home-ink); text-decoration: none; }
.yuimg-home-cover { position: relative; display: block; overflow: hidden; border-radius: 12px; background: #f3f4f6; }
.yuimg-home-share .yuimg-home-cover { margin-bottom: 8px; aspect-ratio: 4 / 3; }
.yuimg-home-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--yuimg-ease); }
.yuimg-home-share strong { display: -webkit-box; overflow: hidden; font-size: 16px; font-weight: 650; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.yuimg-home-share small, .yuimg-home-article small { color: var(--home-muted); font-size: 13px; line-height: 1.5; }

/* Articles: text first, cover on the side. */
.yuimg-home-articles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 0 40px; }
.yuimg-home-article { display: flex; min-width: 0; align-items: flex-start; gap: 20px; padding: 20px 0; border-top: 1px solid var(--home-line); color: var(--home-ink); text-decoration: none; }
.yuimg-home-article-body { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 6px; }
.yuimg-home-article strong { font-size: 17px; font-weight: 650; line-height: 1.45; transition: color .18s; }
.yuimg-home-article-excerpt { display: -webkit-box; overflow: hidden; color: #4b5563; font-size: 14px; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.yuimg-home-article .yuimg-home-cover { flex: none; width: 132px; aspect-ratio: 4 / 3; border-radius: 10px; }
.yuimg-home-article:hover strong, .yuimg-home-share:hover strong { color: var(--home-accent); }

/* Images: masonry columns at original proportions. */
.yuimg-wall { columns: 5 200px; column-gap: 16px; }
.yuimg-wall-item { margin: 0 0 16px; break-inside: avoid; }
.yuimg-wall[hidden], .yuimg-wall-empty[hidden] { display: none; }
.yuimg-wall-photo { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 12px; background: #f3f4f6; color: #fff; text-align: left; cursor: zoom-in; }
.yuimg-wall-photo img { display: block; width: 100%; height: auto; aspect-ratio: auto; object-fit: initial; transition: transform .6s var(--yuimg-ease); }
.yuimg-wall-caption { position: absolute; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; gap: 2px; padding: 28px 12px 10px; background: linear-gradient(to top, rgba(0, 0, 0, .66), rgba(0, 0, 0, 0)); }
.yuimg-wall-caption strong { overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.yuimg-wall-caption small { overflow: hidden; color: rgba(255, 255, 255, .8); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.yuimg-wall-empty { padding: 52px 22px; border: 1px dashed #d1d5db; border-radius: 11px; background: #f9fafb; text-align: center; }
.yuimg-wall-empty strong { display: block; color: var(--home-ink); font-size: 20px; font-weight: 600; }
.yuimg-wall-empty p { max-width: 500px; margin: 10px auto 0; color: var(--home-muted); font-size: 13px; line-height: 1.8; }
.yuimg-wall-empty a { color: var(--home-accent); text-underline-offset: 3px; }

/* Bottom-right dock: toasts sit above the upload queue. */
.yuimg-home-dock { position: fixed; z-index: 200000; right: 20px; bottom: 20px; display: flex; width: min(360px, calc(100vw - 24px)); flex-direction: column; gap: 8px; }
.yuimg-home-toast-region { display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.yuimg-home-toast { padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: var(--yuimg-radius, 10px); background: #fff; box-shadow: var(--yuimg-shadow); color: #374151; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; animation: yuimg-home-toast-in .2s both; }
.yuimg-home-toast.is-success { border-color: #d1d5db; color: #374151; }
.yuimg-home-toast.is-error { border-color: #e3c7c0; color: #9c4033; }
.yuimg-home-toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
@keyframes yuimg-home-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.yuimg-upload-queue { overflow: hidden; border: 1px solid var(--home-line); border-radius: var(--yuimg-radius, 10px); background: #fff; box-shadow: var(--yuimg-shadow); }
.yuimg-upload-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--home-line); }
.yuimg-upload-queue-head strong { color: var(--home-ink); font-size: 13px; font-weight: 650; }
.yuimg-upload-queue-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--home-muted); font-size: 18px; line-height: 1; cursor: pointer; }
.yuimg-upload-queue-close:hover { background: var(--home-surface); color: var(--home-ink); }
.yuimg-upload-queue-close:disabled { opacity: .35; cursor: default; }
.yuimg-upload-queue-list { max-height: min(360px, 50vh); margin: 0; padding: 6px 0; overflow: auto; list-style: none; }
.yuimg-upload-item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; }
.yuimg-upload-item.is-uploading { background: #f9fafb; }
.yuimg-upload-name { min-width: 0; flex: 1; overflow: hidden; color: var(--home-ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.yuimg-upload-state { flex: none; display: grid; width: 18px; height: 18px; place-items: center; }
.yuimg-upload-spin { width: 14px; height: 14px; box-sizing: border-box; border: 2px solid #d1d5db; border-top-color: var(--home-accent); border-radius: 50%; animation: yuimg-upload-spin .7s linear infinite; }
.yuimg-upload-item.is-queued .yuimg-upload-spin { opacity: .35; }
.yuimg-upload-mark { color: var(--home-accent); font-size: 14px; font-weight: 700; line-height: 1; }
.yuimg-upload-mark.is-error { color: #9c4033; }
@keyframes yuimg-upload-spin { to { transform: rotate(360deg); } }

.yuimg-home :where(a, button, select, input):focus-visible { outline: 2px solid var(--home-accent); outline-offset: 3px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .yuimg-wall-photo:hover img, .yuimg-home-share:hover .yuimg-home-cover img, .yuimg-home-article:hover .yuimg-home-cover img { transform: scale(1.04); }
}
/* Photos stay text-free until hovered or focused. */
@media (hover: hover) {
    .yuimg-wall-caption { opacity: 0; transition: opacity .25s var(--yuimg-ease); }
    .yuimg-wall-photo:hover .yuimg-wall-caption, .yuimg-wall-photo:focus-visible .yuimg-wall-caption { opacity: 1; }
}
@media (hover: none) { .yuimg-wall-caption { display: none; } }
@media (max-width: 1180px) {
    .yuimg-quick { grid-template-columns: minmax(0, 1fr) 240px; }
    .yuimg-quick:has(> .yuimg-quick-result:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .yuimg-quick:has(> .yuimg-quick-result:not([hidden])) .yuimg-quick-drop { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .yuimg-quick, .yuimg-quick:has(> .yuimg-quick-result:not([hidden])) { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
    .yuimg-quick-drop { min-height: 96px; padding: 16px; }
    .yuimg-quick-result { padding: 14px 0 0; border-top: 1px solid var(--home-line); border-left: 0; }
}
/* Phones: two columns, and my uploads scroll in the same column width. */
@media (max-width: 640px) {
    .yuimg-home { --home-gap: 12px; }
    .yuimg-quick { margin-bottom: 22px; }
    .yuimg-quick-drop { gap: 14px; }
    .yuimg-quick-drop svg { padding: 10px; }
    .yuimg-quick-drop strong { font-size: 14px; }
    .yuimg-quick-format select, .yuimg-quick-url input { min-height: 40px; font-size: 16px; }
    .yuimg-mine-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .yuimg-home-intro { margin: 4px 0 36px; }
    .yuimg-home-intro p { font-size: 15px; }
    .yuimg-home-section + .yuimg-home-section { margin-top: 40px; }
    .yuimg-home-section-head { margin-bottom: 14px; }
    .yuimg-home-section-head h2 { font-size: 18px; }
    .yuimg-home-tabs { gap: 12px; margin-bottom: 16px; }
    .yuimg-home-tablist { gap: 20px; }
    .yuimg-home-tablist [role="tab"] { font-size: 16px; }
    .yuimg-home-tabs-more { font-size: 13px; }
    .yuimg-home-shares { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
    .yuimg-home-share strong { font-size: 15px; }
    .yuimg-home-article { gap: 14px; padding: 16px 0; }
    .yuimg-home-article strong { font-size: 16px; }
    .yuimg-home-article .yuimg-home-cover { width: 96px; }
    .yuimg-wall { columns: 2; column-gap: 8px; }
    .yuimg-wall-item { margin-bottom: 8px; }
    .yuimg-wall-photo { border-radius: 8px; }
    .yuimg-home-dock { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) { .yuimg-home *, .yuimg-home-toast, .yuimg-upload-spin { animation: none; transition: none; } }
