:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #1c1917;
  background: #f7f6f3;
  font-synthesis: none;
  --primary: #1c1917;
  --primary-hover: #36312d;
  --accent: #f05a1a;
  --accent-dark: #b23a0a;
  --accent-soft: #fff4ed;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --muted: #78716c;
  --subtle: #a8a29e;
  --surface: #ffffff;
  --canvas: #f7f6f3;
  --danger: #c4302b;
  --danger-dark: #a12521;
  --danger-soft: #fdf1f0;
  --success: #2f7a47;
  --success-soft: #eef7f0;
  --warning: #7a5200;
  --warning-soft: #fdf7e3;
  --shadow-card: 0 1px 2px rgb(28 25 23 / 4%), 0 1px 3px rgb(28 25 23 / 5%);
  --shadow-pop: 0 10px 30px rgb(28 25 23 / 14%), 0 2px 6px rgb(28 25 23 / 8%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 280px; }
body { margin: 0; min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.625rem, 4vw, 1.875rem); line-height: 1.25; letter-spacing: -.025em; }
h2 { margin-bottom: 18px; font-size: 1rem; line-height: 1.4; }
svg { display: block; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.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;
}

.container { width: min(1024px, calc(100% - 32px)); margin-inline: auto; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgb(255 255 255 / 96%); border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--primary); letter-spacing: -.02em; white-space: nowrap; }
.brand-symbol { width: 30px; height: 30px; flex: none; }
.brand-wordmark { font-size: 1rem; }
.brand-wordmark strong { font-weight: 750; }
.account-actions { display: flex; min-width: 0; align-items: center; gap: 10px; }
.user-email { max-width: 260px; overflow: hidden; color: #57534e; font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar { display: inline-grid; width: 28px; height: 28px; margin-right: 7px; place-items: center; vertical-align: middle; color: #fff; background: var(--primary); border-radius: 50%; font-size: .75rem; font-weight: 700; }
.main-content { padding-block: 44px 96px; }
.page-heading { margin-bottom: 26px; padding-inline: 4px; }
.muted { color: var(--muted); }
.page-heading .muted { max-width: 720px; margin-bottom: 0; font-size: .875rem; line-height: 1.65; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); }
.upload-panel { margin-bottom: 38px; padding: 8px; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 17px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 9px;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.button:hover:not(:disabled) { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button-secondary { color: var(--primary); background: #fff; border-color: var(--border-strong); font-weight: 500; }
.button-secondary:hover:not(:disabled) { color: var(--primary); background: var(--canvas); border-color: var(--subtle); }
.button-danger { background: var(--danger); border-color: var(--danger); }
.button-danger:hover:not(:disabled) { background: var(--danger-dark); border-color: var(--danger-dark); }
.button-small { min-height: 36px; padding: 7px 12px; font-size: .8125rem; }
.button-block { width: 100%; }
.button-quiet { color: #57534e; background: transparent; border-color: transparent; font-weight: 500; }
.button-quiet:hover:not(:disabled) { color: var(--primary); background: var(--canvas); border-color: transparent; }
.button:focus-visible, input:focus-visible, .drop-zone:focus-within, a:focus-visible, .icon-button:focus-visible, .text-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.icon-button { display: inline-grid; width: 36px; height: 36px; padding: 0; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 8px; transition: color .15s, background-color .15s; }
.icon-button:hover, .icon-button[aria-expanded="true"] { color: var(--primary); background: var(--canvas); }
.text-button { padding: 2px 0; color: var(--accent-dark); background: none; border: 0; font-size: .875rem; font-weight: 600; text-underline-offset: 3px; }
.text-button:hover { text-decoration: underline; }

#upload-form { transition: opacity .18s; }
.drop-zone {
  display: flex;
  width: 100%;
  min-height: 98px;
  align-items: center;
  padding: 18px;
  background: var(--canvas);
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.drop-zone:hover, .drop-zone.is-dragging { background: var(--accent-soft); border-color: var(--accent); }
.drop-zone-prompt { display: flex; width: 100%; align-items: center; gap: 16px; }
.drop-zone-icon { display: grid; width: 46px; height: 46px; flex: none; place-items: center; color: #fff; background: var(--primary); border-radius: 50%; transition: background-color .15s; }
.drop-zone.is-dragging .drop-zone-icon { background: var(--accent); }
.drop-zone-copy { min-width: 0; flex: 1; }
.drop-zone-title { display: block; color: var(--primary); font-size: .9375rem; font-weight: 650; }
.drop-zone-detail { display: block; margin-top: 4px; color: var(--muted); font-size: .8125rem; line-height: 1.55; }
.drop-zone-action { display: inline-flex; min-height: 38px; align-items: center; gap: 6px; padding: 7px 13px; background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; font-size: .8125rem; font-weight: 550; white-space: nowrap; }
.file-summary { display: flex; width: 100%; align-items: center; gap: 14px; }
.file-badge { position: relative; display: grid; width: 38px; height: 46px; flex: none; place-items: end center; padding-bottom: 7px; color: var(--accent-dark); background: var(--accent-soft); border: 1px solid #fdc9a8; border-radius: 5px; font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.file-badge::after { position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; content: ""; background: #fff; border-bottom: 1px solid #fdc9a8; border-left: 1px solid #fdc9a8; border-radius: 0 0 0 3px; }
.file-summary-copy { min-width: 0; }
.file-summary-name { display: block; overflow: hidden; font-size: .875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-summary-detail { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; }
.upload-details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 14px; margin: 4px 4px 0; padding: 20px 8px 8px; border-top: 1px solid var(--border); }
.field label { display: block; margin-bottom: 7px; font-size: .875rem; font-weight: 600; }
.field input { width: 100%; min-height: 44px; padding: 10px 13px; color: var(--primary); background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; font-size: .875rem; transition: border-color .15s, box-shadow .15s; }
.field input::placeholder { color: var(--subtle); }
.field input:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 4px var(--border); }
.input-group { display: flex; align-items: stretch; min-height: 44px; background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; transition: border-color .15s, box-shadow .15s; }
.input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--border); }
.input-prefix { display: flex; align-items: center; padding-left: 13px; color: var(--subtle); font-size: .875rem; white-space: nowrap; }
.field .input-group input { min-width: 0; min-height: 42px; padding-left: 2px; background: transparent; border: 0; box-shadow: none; }
.upload-button { min-height: 44px; }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: .75rem; }
.notice { display: flex; align-items: flex-start; gap: 8px; margin: 14px 4px 0; padding: 10px 12px; border: 1px solid; border-radius: 9px; font-size: .8125rem; line-height: 1.55; overflow-wrap: anywhere; }
.notice .icon { width: 16px; height: 16px; margin-top: 2px; }
.notice-error { color: var(--danger-dark); background: var(--danger-soft); border-color: #f5c6c2; }
.notice-warning { color: var(--warning); background: var(--warning-soft); border-color: #eed98f; }
.upload-progress { margin: 16px 12px 8px; }
.progress-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; font-size: .8125rem; }
#progress-value { font-size: .9375rem; font-weight: 650; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 6px; overflow: hidden; accent-color: var(--accent); background: var(--border); border: 0; border-radius: 999px; }
progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .15s ease-out; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.upload-success { padding: 12px; animation: rise-in .2s ease-out; }
.success-heading { display: flex; align-items: flex-start; gap: 12px; }
.success-check { display: grid; width: 28px; height: 28px; flex: none; place-items: center; color: #fff; background: var(--success); border-radius: 50%; }
.success-heading h3 { margin: 1px 0 3px; font-size: .9375rem; }
.success-heading p { margin: 0; color: var(--muted); font-size: .8125rem; }
.share-link-row { display: flex; gap: 8px; margin-top: 18px; }
.share-link-input { min-width: 0; min-height: 42px; flex: 1; padding: 9px 12px; color: #57534e; background: var(--canvas); border: 1px solid var(--border); border-radius: 9px; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.share-link-actions { display: flex; gap: 8px; }
.upload-success > .text-button { margin-top: 15px; }

.section-heading { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 12px; }
.section-heading h2 { margin: 0; }
.section-heading .muted { font-size: .8125rem; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: visible; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); }
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.file-table th, .file-table td { padding: 13px 18px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.file-table th { color: var(--muted); background: rgb(247 246 243 / 55%); font-size: .75rem; font-weight: 550; }
.file-table th:first-child { border-radius: 15px 0 0; }
.file-table th:last-child { border-radius: 0 15px 0 0; }
.file-table th:nth-child(2) { width: 158px; }
.file-table th:nth-child(3) { width: 108px; }
.file-table th:last-child { width: 164px; }
.file-table tbody tr:last-child td { border-bottom: 0; }
.file-preview { display: flex; width: 100%; max-width: 100%; align-items: center; gap: 12px; border-radius: 7px; }
.file-play { display: grid; width: 36px; height: 36px; flex: none; place-items: center; color: var(--accent-dark); background: var(--accent-soft); border-radius: 9px; }
.file-play .icon { width: 16px; height: 16px; fill: currentColor; stroke-width: 0; }
.file-title-text { min-width: 0; overflow: hidden; font-size: .875rem; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.file-preview:hover .file-title-text { text-decoration: underline; text-underline-offset: 3px; }
.file-mobile-meta { display: none; }
.file-meta { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-menu { position: relative; }
.row-menu-popover { position: absolute; top: 42px; right: 0; z-index: 20; width: 152px; padding: 5px; background: #fff; border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-pop); transform-origin: top right; animation: menu-in .15s ease-out; }
.menu-item { display: flex; width: 100%; min-height: 36px; align-items: center; gap: 9px; padding: 8px 10px; color: var(--primary); background: none; border: 0; border-radius: 7px; font-size: .8125rem; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--canvas); outline: 0; }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item-danger, .menu-item-danger .icon { color: var(--danger-dark); }
.menu-item-danger:hover, .menu-item-danger:focus-visible { background: var(--danger-soft); }
.menu-separator { height: 1px; margin: 4px; background: var(--border); }
.file-table tr.is-busy .file-size, .file-table tr.is-busy .mobile-file-size { color: var(--accent-dark); font-weight: 600; }
.file-list-state, .state-card { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); }
.skeleton-row { display: flex; align-items: center; gap: 13px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.skeleton-row:last-child { border-bottom: 0; }
.skeleton { display: block; height: 12px; background: var(--border); border-radius: 5px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton-icon { width: 36px; height: 36px; flex: none; border-radius: 9px; }
.skeleton-title { width: min(42%, 320px); }
.skeleton-meta { width: 100px; margin-left: auto; }
.state-card { padding: 40px 24px; text-align: center; }
.state-card h3 { margin: 15px 0 5px; font-size: .875rem; }
.state-card p { margin: 0; color: var(--muted); font-size: .8125rem; }
.state-illustration { width: 64px; height: 48px; margin: 0 auto; }
.state-error-icon { display: grid; width: 42px; height: 42px; margin: 0 auto; place-items: center; color: var(--danger); background: var(--danger-soft); border-radius: 50%; }
.state-card .button { margin-top: 20px; }
#list-error { color: var(--primary); }
#list-error-text { color: var(--muted); }

.confirm-dialog { width: min(400px, calc(100% - 32px)); padding: 24px; color: var(--primary); border: 0; border-radius: 16px; box-shadow: var(--shadow-pop); animation: dialog-in .18s ease-out; }
.confirm-dialog::backdrop { background: rgb(28 25 23 / 45%); }
.dialog-icon { display: grid; width: 40px; height: 40px; margin-bottom: 16px; place-items: center; color: var(--danger); background: var(--danger-soft); border-radius: 50%; }
.confirm-dialog h2 { margin-bottom: 9px; }
.confirm-dialog p { margin-bottom: 12px; color: #57534e; font-size: .875rem; line-height: 1.7; }
.dialog-file-name { color: var(--primary); font-weight: 600; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.confirm-dialog .notice { margin: 14px 0 0; }
.edit-dialog { width: min(440px, calc(100% - 32px)); }
.edit-dialog .field { margin-top: 18px; }
.edit-dialog .field-help { display: block; }
.edit-dialog .notice { margin-top: 12px; }
.dialog-icon[data-tone="neutral"] { color: var(--accent-dark); background: var(--accent-soft); }
.field .input-prefix[hidden] + input { padding-left: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: flex; max-width: min(420px, calc(100% - 48px)); align-items: center; gap: 10px; padding: 12px 16px; color: #fff; background: var(--primary); border-radius: 12px; box-shadow: var(--shadow-pop); font-size: .875rem; font-weight: 500; animation: toast-in .18s ease-out; }
.toast::before { display: grid; width: 18px; height: 18px; flex: none; place-items: center; content: "✓"; color: #bfe0c8; font-size: 1rem; font-weight: 700; }
.toast[data-tone="error"]::before { content: "!"; color: #f5c6c2; }

.login-body { display: grid; min-height: 100dvh; padding: 48px 16px; place-items: center; background: var(--canvas); }
.login-shell { width: min(380px, 100%); }
.login-heading { margin-bottom: 28px; text-align: center; }
.login-brand { display: inline-flex; margin-bottom: 17px; }
.login-brand .brand-symbol { width: 44px; height: 44px; }
.login-heading h1 { margin-bottom: 7px; font-size: 1.25rem; letter-spacing: -.015em; }
.login-heading p { margin: 0; color: var(--muted); font-size: .8125rem; }
.login-card { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); }
.login-form .field { margin-bottom: 17px; }
.login-form .notice { margin: 0 0 18px; }
.login-form .button { min-height: 44px; margin-top: 4px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 46px; }
.password-toggle { position: absolute; top: 4px; right: 4px; }
.login-footer { margin: 22px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.65; text-align: center; }
.spinner { animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (max-width: 720px) {
  .container { width: min(100% - 28px, 1024px); }
  .main-content { padding-block: 28px 64px; }
  .page-heading { margin-bottom: 22px; }
  .user-email { display: none; }
  .account-actions { gap: 4px; }
  .drop-zone-prompt { align-items: flex-start; flex-wrap: wrap; }
  .drop-zone-copy { flex-basis: calc(100% - 64px); }
  .drop-zone-action { margin-left: 62px; }
  .upload-details { grid-template-columns: 1fr; gap: 14px; }
  .upload-button { width: 100%; }
  .share-link-row { flex-direction: column; }
  .share-link-actions .button { flex: 1; }
  .table-wrap { overflow: visible; }
  .file-table, .file-table tbody { display: block; }
  .file-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .file-table tr { display: grid; grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .file-table td { display: block; padding: 0; border: 0; }
  .file-table td:nth-child(2), .file-table td:nth-child(3) { display: none; }
  .file-table tbody tr { border-bottom: 1px solid var(--border); }
  .file-table tbody tr:last-child { border-bottom: 0; }
  .file-title-text { white-space: normal; overflow-wrap: anywhere; }
  .file-mobile-meta { display: block; margin: 4px 0 0 48px; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
  .row-actions { margin-top: 14px; justify-content: flex-start; }
  .row-actions > .button { flex: 1; }
  .row-menu { margin-left: auto; }
  .row-menu-popover { right: 0; }
}

@media (max-width: 480px) {
  .brand-symbol { width: 27px; height: 27px; }
  .brand-wordmark { font-size: .9375rem; }
  .topbar .button-quiet { padding-inline: 9px; }
  .topbar .button-quiet .button-label { display: none; }
  .main-content { padding-top: 24px; }
  .page-heading { padding-inline: 0; }
  .upload-panel { padding: 6px; }
  .drop-zone { padding: 16px 13px; }
  .drop-zone-icon { width: 42px; height: 42px; }
  .drop-zone-copy { flex-basis: calc(100% - 58px); }
  .drop-zone-action { margin-left: 0; }
  .upload-success { padding: 10px 7px; }
  .login-body { padding-block: 36px; }
  .login-card { padding: 22px 20px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .toast { right: 16px; bottom: 16px; max-width: calc(100% - 32px); }
  .state-card { padding: 34px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
