/* ファイル受け渡しシステム - スタイル */

:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --ink: #1b2523;
  --muted: #5d6b67;
  --line: #d3dcd9;
  --accent: #0b6b63;
  --accent-hover: #09554f;
  --accent-ink: #ffffff;
  --accent-weak: #e1efed;
  --danger: #b3261e;
  --danger-weak: #fbe9e7;
  --ok: #1d7a45;
  --ok-weak: #e3f3e9;
  --warn: #85560a;
  --warn-weak: #fcf0d3;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
          "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715;
    --surface: #19211f;
    --ink: #e8eeec;
    --muted: #9aaaa5;
    --line: #2d3a37;
    --accent: #3fb3a6;
    --accent-hover: #5cc7ba;
    --accent-ink: #05201d;
    --accent-weak: #1b3330;
    --danger: #ff8a7d;
    --danger-weak: #3b1f1c;
    --ok: #5ccf8d;
    --ok-weak: #17301f;
    --warn: #f0bf5a;
    --warn-weak: #3a2f12;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 var(--font);
}

a { color: var(--accent); }
code { font-size: .9em; background: var(--accent-weak); padding: .1em .4em; border-radius: 4px; }

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

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}

/* ---- ヘッダー ---------------------------------------------------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 8px 0 16px;
}
.site-title { font-weight: 700; font-size: 1.1rem; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 3px solid transparent;
}
.nav a:hover { border-bottom-color: var(--line); }
.nav a.active { border-bottom-color: var(--accent); font-weight: 700; }
.logout-form { margin: 0; }
.link-btn {
  background: none; border: 0; padding: 4px 0;
  font: inherit; font-size: .9rem; color: var(--muted);
  cursor: pointer; text-decoration: underline;
}

/* ---- カード ------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }

h1 { font-size: 1.4rem; line-height: 1.4; margin: 0 0 8px; }
h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.05rem; margin: 32px 0 12px;
}
.card > h2:first-child, #progressBox > h2:first-child, #resultBox > h2:first-child { margin-top: 0; }
#progressBox, #resultBox { margin-top: 0; }

.step {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 1.7em; height: 1.7em; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: .9rem; font-weight: 700;
}
.lead { margin: 0 0 16px; color: var(--muted); }
.muted { color: var(--muted); font-size: .9rem; }
p { margin: 0 0 12px; }

/* ---- フォーム ---------------------------------------------------- */
.field { margin-bottom: 20px; }
label { display: block; font-weight: 700; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted); font-size: .9rem; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: .9rem; margin: 6px 0 0; cursor: pointer; }
.hint { color: var(--muted); font-size: .875rem; margin: 6px 0 0; }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input[readonly] { background: var(--bg); }
textarea.snippet { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.5; margin: 8px 0; }

/* ---- ボタン ------------------------------------------------------ */
.btn {
  display: inline-block;
  padding: 9px 18px;
  font: inherit;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-weak); }
.btn.block { display: block; width: 100%; padding: 14px 18px; font-size: 1.05rem; }
.btn.small { padding: 4px 12px; font-size: .875rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---- メッセージ -------------------------------------------------- */
.msg { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; }
.msg.error { background: var(--danger-weak); color: var(--danger); }
.msg.ok { background: var(--ok-weak); color: var(--ok); }
.msg p { margin-bottom: 8px; }
.empty { text-align: center; color: var(--muted); padding: 24px 0 8px; }

/* ---- ファイル選択 ------------------------------------------------ */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-weak); }
.dz-main { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }
.dz-sub { color: var(--muted); margin: 0; font-size: .9rem; }

.file-list { list-style: none; margin: 12px 0 0; padding: 0; }
.file-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 4px; border-bottom: 1px solid var(--line);
}
.file-list .fname { flex: 1; min-width: 0; }
.file-list .fsize { flex: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.file-list .remove {
  flex: none; width: 2em; height: 2em; line-height: 1;
  background: none; border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted); font-size: 1.1rem; cursor: pointer;
}
.file-list .remove:hover { color: var(--danger); border-color: var(--danger); }
.fname { overflow-wrap: anywhere; word-break: break-all; }

/* ---- 進捗 -------------------------------------------------------- */
.bar { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; margin: 16px 0 8px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.progress-percent { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
#progressDetail, #progressFile { margin-bottom: 4px; }
#errorBox { margin-top: 16px; }
#cancelBtn { margin-top: 16px; }

/* ---- 結果・一覧 -------------------------------------------------- */
.url-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.url-row input { flex: 1 1 240px; min-width: 0; }

dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 2px 20px; margin: 12px 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 8px; }
.item-files { list-style: none; margin: 0 0 8px; padding: 0; }
.item-files li { padding: 2px 0; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.off { background: var(--line); color: var(--muted); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }

details.logs { margin: 12px 0; border-top: 1px solid var(--line); padding-top: 12px; }
details.logs summary { cursor: pointer; font-weight: 700; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
.log-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.log-table th, .log-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; min-width: 10em; }
.log-table th { color: var(--muted); font-weight: 400; }
.item-actions { margin: 0; text-align: right; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }

/* ---- ダウンロード画面 -------------------------------------------- */
.dl-list { list-style: none; margin: 0; padding: 0; }
.dl-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.dl-info { min-width: 0; }
.dl-item .btn { flex: none; }
.zip-box { margin-top: 20px; }
@media (max-width: 480px) {
  .dl-item { flex-direction: column; align-items: stretch; }
  .card { padding: 18px; }
}

ol.steps { padding-left: 1.4em; }
ol.steps li { margin-bottom: 12px; }

.sr-copy { position: fixed; left: -9999px; top: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
