:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6d7585;
  --line: #e4e8f0;
  --accent: #2764ff;
  --accent-hover: #174ed9;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --shadow: 0 8px 30px rgba(22, 34, 59, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  margin-bottom: 22px;
}

.brand-summary {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.brand-separator,
.brand-limit {
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex: none;
  gap: 7px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(460px, 100%);
  margin: 11vh auto 0;
  padding: 32px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -0.045em; }
h2 { margin-bottom: 0; font-size: 1.15rem; }

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

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

.field {
  display: grid;
  gap: 8px;
  margin: 24px 0 14px;
  font-size: 0.88rem;
  font-weight: 650;
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39, 100, 255, 0.12); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: 120ms ease;
}

.button:disabled { opacity: 0.5; cursor: wait; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.ghost { background: var(--panel); border-color: var(--line); color: var(--text); }
.button.ghost:hover:not(:disabled) { background: #f1f4f9; }
.button.danger { background: var(--danger-bg); color: var(--danger); border-color: #ffd5d1; }
.button.small { min-height: 36px; padding: 0 12px; font-size: 0.86rem; }
.button.wide { width: 100%; margin-top: 14px; }

.message {
  min-height: 1.3em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.message.error { color: var(--danger); }
.page-message { text-align: right; }


.upload-card { padding: 18px; margin-bottom: 34px; }

.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 12px 16px;
  border: 1.5px dashed #c7cfdd;
  border-radius: 14px;
  background: #fafbfe;
  cursor: pointer;
  transition: 130ms ease;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: #f3f7ff; }
.drop-line { display: inline-flex; align-items: baseline; justify-content: center; gap: 12px; white-space: nowrap; }
.drop-title { font-weight: 800; }

.selected-files {
  margin-top: 14px;
  padding: 12px 2px 2px;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}
.selected-files-summary { font-weight: 750; margin-bottom: 8px; }
.selected-files-list {
  display: grid;
  gap: 5px;
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}
.selected-files-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}
.selected-files-list li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.selected-files-list li span:last-child { flex: 0 0 auto; }

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.progress-track { flex: 1; height: 7px; overflow: hidden; border-radius: 999px; background: #e8edf5; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 100ms linear; }

.files-section { margin-top: 10px; }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.count { display: grid; place-items: center; min-width: 25px; height: 25px; border-radius: 999px; background: #e9eef8; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.file-list { display: grid; gap: 10px; }

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  box-shadow: none;
}
.file-main { min-width: 0; }
.file-name { display: block; overflow: hidden; color: var(--text); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-weight: 720; }
.file-name:hover { color: var(--accent); }
.file-meta { display: flex; gap: 10px; margin-top: 5px; color: var(--muted); font-size: 0.78rem; }
.file-actions { display: flex; flex: none; gap: 7px; }
.file-actions form, .topbar form { margin: 0; }

.empty { padding: 42px 20px; text-align: center; color: var(--muted); box-shadow: none; }
.footnote { margin-top: 18px; color: var(--muted); text-align: right; font-size: 0.78rem; }

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 920px); padding-top: 12px; }
  .topbar { margin-bottom: 16px; align-items: flex-start; }
  .brand-summary { gap: 6px; font-size: 0.92rem; }
  .brand-separator, .brand-limit { font-size: 0.78rem; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .button { min-height: 34px; padding: 0 9px; font-size: 0.78rem; }
  .auth-card { margin-top: 7vh; padding: 24px 20px; }
  .upload-card { padding: 12px; }
  .drop-zone { min-height: 64px; padding: 10px 12px; }
  .drop-line { gap: 8px; font-size: 0.9rem; }
  .file-row { align-items: flex-start; flex-direction: column; padding: 14px; }
  .file-main { width: 100%; }
  .file-actions { width: 100%; }
  .file-actions .button, .file-actions form { flex: 1; }
  .file-actions form .button { width: 100%; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f131a;
    --panel: #171c25;
    --text: #f3f5f8;
    --muted: #9ba4b4;
    --line: #2b3340;
    --accent: #7aa2ff;
    --accent-hover: #91b1ff;
    --danger: #ff9c94;
    --danger-bg: #321b1c;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  }
  .field input { background: #121720; }
  .drop-zone { background: #121720; border-color: #3b4554; }
  .drop-zone:hover, .drop-zone.dragging { background: #172034; }
  .button.primary { color: #0b1020; }
  .button.ghost:hover:not(:disabled) { background: #202733; }
  .count { background: #252d3a; }
  .progress-track { background: #283140; }
}

/* PCに表示するQR認証 */
.qr-auth-panel {
  margin-top: 18px;
  text-align: center;
}

.qr-code {
  display: grid;
  place-items: center;
  width: min(280px, 100%);
  min-height: 220px;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #50596a;
  overflow: hidden;
}

.qr-code .qr-svg,
.qr-code svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 256px;
}

.qr-loading {
  font-size: 0.88rem;
}

.qr-instruction {
  max-width: 360px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.qr-mobile-card {
  margin-top: 9vh;
}

@media (max-width: 640px) {
  .qr-code {
    width: min(260px, 100%);
    min-height: 200px;
  }
}
