:root {
  color-scheme: dark;
  --bg: #090a0b;
  --surface: #141516;
  --surface-muted: #1c1d1f;
  --surface-strong: #252629;
  --line: #2d2f32;
  --line-strong: #4b4d51;
  --text: #e7e5e1;
  --muted: #96938d;
  --accent: #393a3c;
  --accent-contrast: #f0efec;
  --danger: #b68484;
  --danger-bg: #271d1d;
  --shadow: 0 18px 44px rgba(0, 0, 0, .28);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-muted: #eeece7;
  --surface-strong: #dfdcd5;
  --line: #d3d0c9;
  --line-strong: #aaa69e;
  --text: #202124;
  --muted: #696761;
  --accent: #343537;
  --accent-contrast: #ffffff;
  --danger: #9b3f3f;
  --danger-bg: #fff0f0;
  --shadow: 0 18px 44px rgba(42, 39, 34, .12);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: linear-gradient(180deg, #101112 0, var(--bg) 38rem); color: var(--text); }
html[data-theme="light"] body { background: linear-gradient(180deg, #ffffff 0, var(--bg) 38rem); }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }

button, .button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: .68rem 1rem;
  border-radius: .55rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .18);
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
button:hover, .button:hover { background: var(--surface-muted); border-color: var(--line-strong); }
button:active, .button:active { transform: translateY(1px); }
.button { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 650; }
.button:hover { background: #46474a; border-color: #55575b; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #77787b; outline-offset: 2px; }
.danger { color: var(--danger); border-color: #593b3b; background: var(--danger-bg); }
.danger:hover { background: #332323; border-color: #704848; }
.error { color: var(--danger); }

input, select, textarea { width: 100%; background: #0e0f10; border: 1px solid var(--line); color: var(--text); padding: .75rem .8rem; border-radius: .5rem; }
html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { background: #fff; }
input::placeholder, textarea::placeholder { color: #777873; }
textarea { resize: vertical; }
label { display: grid; gap: .38rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: .45rem; }
.check input { width: auto; accent-color: var(--accent); }
.stack { display: grid; gap: 1rem; }
.center { width: min(92%, 430px); margin: 10vh auto; }
.card, .panel { background: rgba(20, 21, 22, .96); border: 1px solid var(--line); border-radius: .85rem; padding: 1.5rem; box-shadow: var(--shadow); }
html[data-theme="light"] .card, html[data-theme="light"] .panel { background: rgba(255, 255, 255, .96); }

.hero { min-height: 100vh; display: grid; align-items: center; gap: clamp(2rem, 7vw, 6rem); width: min(1120px, 90%); margin: auto; padding: 4rem 0; }
.hero h1 { max-width: 760px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(4rem, 12vw, 8.2rem); font-weight: 500; line-height: .82; letter-spacing: -.065em; margin: .22em 0; }
.lead { font-size: clamp(1.2rem, 2.8vw, 1.8rem); max-width: 650px; color: #c5c2bc; }
html[data-theme="light"] .lead { color: #55534e; }
.bio { color: var(--muted); max-width: 600px; }
.eyebrow { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .18em; }
.actions { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: 2rem; }
.portrait { aspect-ratio: 4/5; border: 1px solid var(--line); background: linear-gradient(145deg, #242527, #111213); display: grid; place-items: center; border-radius: .9rem; overflow: hidden; box-shadow: var(--shadow); }
html[data-theme="light"] .portrait { background: linear-gradient(145deg, #ece9e2, #d8d4cc); }
.portrait span { font-family: Georgia, "Times New Roman", serif; font-size: 20vw; font-weight: 400; color: rgba(255, 255, 255, .07); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: .85rem 5%; background: rgba(10, 11, 12, .93); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
html[data-theme="light"] .top { background: rgba(255, 255, 255, .93); }
.brand { text-decoration: none; font-weight: 750; letter-spacing: .14em; }
.top nav { display: none; gap: .25rem; align-items: center; }
.top nav.open { display: flex; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 1rem; box-shadow: var(--shadow); }
.top nav a { padding: .6rem .75rem; text-decoration: none; border-radius: .45rem; }
.top nav a:hover { background: var(--surface-muted); }
.top form { margin: 0; }
.nav-toggle { display: block; }
.notification-center { position: relative; }
.notification-toggle { position: relative; display: grid; place-items: center; width: 2.65rem; height: 2.65rem; padding: .62rem; }
.notification-toggle svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.notification-toggle span { position: absolute; top: -.35rem; right: -.4rem; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem; display: grid; place-items: center; border: 2px solid #0a0b0c; border-radius: 999px; background: #d1cfca; color: #111214; font-size: .68rem; font-weight: 800; line-height: 1; }
.notification-panel { position: absolute; z-index: 20; top: calc(100% + .7rem); right: 0; width: min(390px, 92vw); max-height: min(620px, 75vh); overflow: auto; border: 1px solid var(--line); border-radius: .75rem; background: #111213; box-shadow: var(--shadow); }
html[data-theme="light"] .notification-panel { background: #fff; }
.notification-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem; border-bottom: 1px solid var(--line); background: rgba(17, 18, 19, .97); }
html[data-theme="light"] .notification-head { background: rgba(255, 255, 255, .97); }
.notification-head button { padding: .42rem .6rem; font-size: .76rem; }
.notification-item { position: relative; display: grid; gap: .18rem; padding: .85rem 1rem .85rem 1.2rem !important; border-bottom: 1px solid var(--line); border-radius: 0 !important; }
.notification-item:hover { background: var(--surface-muted) !important; }
.notification-item.unread::before { content: ''; position: absolute; left: .45rem; top: 1.15rem; width: .38rem; height: .38rem; border-radius: 50%; background: #c8c5bf; }
.notification-item span, .notification-item small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.notification-empty { margin: 0; padding: 1.2rem; color: var(--muted); text-align: center; }

.page, .share-page { width: min(1100px, 92%); margin: 3rem auto; }
.narrow { max-width: 620px; }
.page-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1.5rem; }
.page h1, .share-page h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 7vw, 4.4rem); font-weight: 500; letter-spacing: -.035em; margin: .1em 0; }
.toolbar, .row-actions { display: flex; gap: .45rem; flex-wrap: wrap; }
.breadcrumbs { margin: 1rem 0; color: var(--muted); }
.breadcrumbs button { border: 0; background: none; box-shadow: none; padding: .2rem; color: var(--muted); }
.breadcrumbs button:hover { color: var(--text); }

.dropzone { border: 1px dashed var(--line-strong); border-radius: .75rem; min-height: 170px; display: grid; place-content: center; text-align: center; gap: .5rem; margin: 1rem 0; background: rgba(20, 21, 22, .65); }
html[data-theme="light"] .dropzone { background: rgba(255, 255, 255, .7); }
.dropzone.over { border-color: #6f7074; background: var(--surface-strong); }
.filters, .form-grid { display: grid; gap: 1rem; margin: 1rem 0; }
.file-list { display: grid; border-top: 1px solid var(--line); }
.file-list > div, .file-list > a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem .45rem; border-bottom: 1px solid var(--line); text-decoration: none; }
.file-list > a:hover { background: rgba(255, 255, 255, .035); }
html[data-theme="light"] .file-list > a:hover { background: rgba(0, 0, 0, .035); }
.file-list small { display: block; color: var(--muted); }
.progress { height: .45rem; background: var(--surface-strong); border-radius: 1rem; overflow: hidden; margin: .4rem 0; }
.progress i { display: block; height: 100%; background: #77787a; }

.pc-grid { display: grid; gap: 1rem; }
.pc-card { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; padding: 1.1rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
.badge { display: inline-flex; padding: .2rem .55rem; border-radius: 2rem; background: var(--surface-strong); color: var(--muted); }
.badge.online { background: #292a2c; color: #c1beb8; }
html[data-theme="light"] .badge.online { background: #dfdcd5; color: #46443f; }
.notice { padding: 1rem; background: #1c1d1e; border: 1px solid #343538; border-radius: .6rem; color: #bbb8b2; }
html[data-theme="light"] .notice { background: #eeece7; border-color: var(--line); color: var(--muted); }

.theme-toggle {
  position: fixed;
  z-index: 60;
  top: .72rem;
  right: .72rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1rem;
}
body:has(.top) > .theme-toggle { right: calc(5% + 3.1rem); }
html[data-theme="light"] .thumb-shell[data-fallback="TXT"] img { filter: none; }
html:not([data-theme="light"]) .thumb-shell[data-fallback="TXT"] img { filter: invert(1) hue-rotate(180deg); }

.settings-section { margin-top: 1.5rem; }
.settings-section h2 { margin-top: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.homepage-settings { display: grid; gap: 1rem; }
.homepage-settings textarea { min-height: 7rem; }
.homepage-settings .wide { grid-column: 1 / -1; }
.settings-photo { display: block; width: min(240px, 100%); aspect-ratio: 4/5; object-fit: cover; border: 1px solid var(--line); border-radius: .65rem; margin: .5rem 0 1rem; }

.public-upload { padding: 1.5rem; }
.upload-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) auto; align-items: center; gap: .75rem; margin: .5rem 0; text-align: left; }
.upload-row progress { width: 100%; accent-color: #77787a; }
.upload-row.done small { color: #aaa7a1; }
.upload-row.failed small { color: var(--danger); }
.share-search { margin: 1.5rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.share-search .filters { grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; }
.share-search-status { min-height: 1.5rem; color: var(--muted); }
.share-admin-list > div { align-items: flex-start; }
.share-admin-list .row-actions { justify-content: flex-end; }
.share-admin-list form { margin: 0; }

.share-row-button { font-weight: 650; }
.share-row-button.is-shared { border-color: #55575a; background: #292a2c; color: #ccc9c3; }
.shared-badge { display: inline-flex; align-items: center; margin-left: .5rem; padding: .12rem .42rem; border: 1px solid #46484b; border-radius: 999px; background: #242527; color: #b5b2ac; font-size: .72rem; font-weight: 650; vertical-align: middle; }
.share-entry-download { flex: 0 0 auto; margin-left: .25rem; }
.share-dialog { width: min(720px, 94vw); max-height: 92vh; padding: 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface); color: var(--text); box-shadow: 0 28px 80px rgba(0, 0, 0, .48); }
.share-dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(3px); }
.share-dialog form { padding: 1.25rem; }
.share-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.share-dialog-head h2 { margin: .1rem 0 1rem; }
.share-dialog-head > [data-share-close] { border: 0; background: transparent; box-shadow: none; font-size: 1.8rem; padding: .1rem .5rem; }
.share-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.share-url { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .75rem; }
.share-dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; flex-wrap: wrap; }
.share-dialog .error { padding: .75rem; border: 1px solid #593b3b; border-radius: .55rem; background: var(--danger-bg); }

@media (min-width: 760px) {
  .hero { grid-template-columns: 1.3fr .7fr; }
  .portrait span { font-size: 9rem; }
  .nav-toggle { display: none; }
  .top nav { display: flex; }
  .filters { grid-template-columns: 1fr 220px; }
  .form-grid, .homepage-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .pc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 759px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .page, .share-page { width: calc(100% - 1.5rem); margin: 1.25rem auto 2rem; }
  .page h1, .share-page h1 { font-size: clamp(2rem, 12vw, 3rem); overflow-wrap: anywhere; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head, .toolbar, .actions { width: 100%; }
  .share-page > .actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .share-page > .actions > .button,
  .share-page > .actions > a,
  .share-page > .actions > label { width: 100%; text-align: center; }
  .share-page > .actions .view-toggle { width: 100%; }
  .share-page > .actions .view-toggle button { flex: 1 1 0; }
  .share-search .filters, .upload-row { grid-template-columns: 1fr; }
  .share-search { padding: .75rem; }
  .share-search .filters button, .share-search .button { width: 100%; }
  .share-search .file-list > div { align-items: flex-start; flex-direction: column; }
  .share-search .row-actions { width: 100%; }
  .share-search .row-actions a { width: 100%; text-align: center; }
  .page .file-list > div { align-items: stretch; flex-direction: column; }
  .page .file-list .row-actions { width: 100%; }
  .page .file-list .row-actions > button,
  .page .file-list .row-actions > a,
  .page .file-list .row-actions > form { flex: 1 1 8rem; }
  .page .file-list .row-actions > form button { width: 100%; }
  .entry-visual, .entry-visual > span { min-width: 0; }
  .entry-visual strong, .file-list strong, .file-list small { overflow-wrap: anywhere; word-break: break-word; }
  .notification-center { display: grid; }
  .notification-toggle { width: 100%; }
  .notification-panel { position: static; width: 100%; max-height: 55vh; margin-top: .5rem; }
  body:has(.top) > .theme-toggle { right: 4.25rem; }
}

@media (max-width: 600px) {
  .share-dialog { width: 100vw; max-width: none; max-height: 100dvh; border-radius: 0; }
  .share-form-grid, .share-url { grid-template-columns: 1fr; }
  .share-dialog-actions > * { flex: 1 1 100%; }
  .shared-badge { display: flex; width: max-content; margin: .3rem 0 0; }
  .file-list.view-grid .row-actions .share-row-button { flex-basis: 100%; }
  .theme-toggle { top: .55rem; right: .55rem; }
}
