:root {
  --ink: #1b2430;
  --muted: #5b6573;
  --line: #d5dbe3;
  --line-strong: #b7c0cc;
  --bg: #eef1f5;
  --paper: #ffffff;
  --brand: #1d4b75;
  --brand-dark: #153757;
  --brand-soft: #e8f0f7;
  --focus: #2f6ea3;
  --ok: #215c45;
  --ok-bg: #e8f5ee;
  --warn: #8a5a12;
  --warn-bg: #fff4e0;
  --danger: #922c38;
  --danger-bg: #fdecee;
  --danger-hover: #7a2230;
  --shadow: 0 1px 2px rgba(27, 36, 48, 0.06), 0 8px 24px rgba(27, 36, 48, 0.06);
  --radius: 14px;
  --font: "Noto Sans TC", "Source Han Sans TC", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -120px, #d9e4ef 0%, transparent 70%),
    var(--bg);
}

img,
svg,
audio,
video,
iframe {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

p {
  margin: 0;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  width: min(860px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  padding: 2.4rem 0 1.4rem;
}

.kicker {
  display: inline-block;
  margin-bottom: 0.55rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--brand);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.site-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  font-weight: 700;
}

.lede {
  margin-top: 0.7rem;
  max-width: 38rem;
  color: var(--muted);
}

.notice {
  margin-bottom: 1.1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #d8e3ee;
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--brand-soft);
  color: #24384d;
  font-size: 0.9375rem;
}

.panel {
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.25rem 1.35rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  margin-bottom: 1rem;
}

.panel-head h2 {
  font-size: 1.15rem;
}

.hint,
.list-summary,
#list-summary {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.6rem 1.1rem 1.3rem;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.dropzone.is-dragover {
  border-color: var(--brand);
  background: #e3eef8;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.dropzone-icon {
  color: var(--brand);
}

.dropzone-title {
  font-weight: 600;
}

.dropzone-help {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  background: #f3f6f9;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-small {
  min-height: 2.15rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.875rem;
}

.upload-status {
  margin-top: 1rem;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
}

.status-text {
  color: var(--ink);
}

.status-count {
  color: var(--muted);
  white-space: nowrap;
}

.progress {
  height: 0.55rem;
  overflow: hidden;
  background: #e2e8ef;
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #1d4b75, #3a7eb3);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.alert-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.alert {
  padding: 0.7rem 0.85rem;
  border-radius: 9px;
  font-size: 0.9375rem;
}

.alert-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.alert-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state {
  padding: 1.6rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  color: var(--muted);
}

.empty-title {
  margin-bottom: 0.3rem;
  color: var(--ink);
  font-weight: 600;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.file-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.file-main {
  min-width: 0;
}

.file-name {
  display: block;
  font-weight: 600;
  word-break: break-word;
}

.file-meta {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.file-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (min-width: 640px) {
  .file-card {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }

  .file-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
}

.site-footer {
  padding: 1.5rem 0 2.4rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.preview-dialog,
.confirm-dialog {
  width: min(720px, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 50px rgba(27, 36, 48, 0.2);
  background: #fff;
  color: var(--ink);
}

.preview-dialog:not([open]),
.confirm-dialog:not([open]) {
  display: none;
}

.preview-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(20, 28, 38, 0.52);
}

.preview-header,
.confirm-dialog {
  padding: 1rem 1.1rem;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.preview-header h2,
.confirm-dialog h2 {
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-body {
  padding: 1.1rem;
}

.preview-body img {
  display: block;
  margin: 0 auto;
  max-height: min(70vh, 640px);
  border-radius: 8px;
}

.preview-body audio {
  width: 100%;
  margin-top: 0.3rem;
}

.preview-body iframe {
  width: 100%;
  height: min(70vh, 640px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f9;
}

.preview-fallback {
  color: var(--muted);
}

.confirm-dialog p {
  margin: 0.7rem 0 1.1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .dropzone,
  .progress-bar {
    transition: none;
  }
}
