/* Udemy工場 — 生産ラインをモチーフにした共通スタイル */
:root {
  --steel: #d9dfe4;
  --steel-deep: #c9d1d8;
  --sheet: #f5f7f8;
  --ink: #19212b;
  --ink-soft: #4a5563;
  --rule: #b9c2ca;
  --signal: #f5c400;
  --signal-deep: #d9ad00;
  --lamp-ok: #23915a;
  --lamp-err: #d0402f;
  --lamp-off: #aeb7bf;

  --display: "Dela Gothic One", "Hiragino Sans", sans-serif;
  --body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--steel); }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--steel);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.hidden { display: none !important; }
.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;
}

/* ---------- ヘッダー ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) var(--s5);
  background: var(--ink); color: var(--sheet);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 20px; letter-spacing: .04em;
  color: var(--sheet); text-decoration: none;
}
.brand::before {
  content: ""; width: 14px; height: 14px; background: var(--signal);
  box-shadow: 0 0 0 3px rgba(245, 196, 0, .25);
}
.menu { display: flex; gap: var(--s1); margin-right: auto; margin-left: var(--s5); }
.menu a {
  color: var(--sheet); text-decoration: none; font-size: 14px; font-weight: 700;
  padding: 6px 12px; border: 2px solid transparent;
}
.menu a:hover { border-color: rgba(245, 245, 245, .3); }
.menu a[aria-current="page"] { background: var(--signal); color: var(--ink); }
.who { display: flex; align-items: center; gap: var(--s3); font-size: 13px; color: var(--sheet); }
.who span { opacity: .75; }
.topbar .linkish { color: var(--sheet); }

/* ---------- ページの枠 ---------- */
main { max-width: 880px; margin: 0 auto; padding: var(--s7) var(--s4) var(--s8); }
main.wide { max-width: 1280px; }

h1, h2, h3 { margin: 0; line-height: 1.35; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5.2vw, 52px); letter-spacing: .01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.lead { color: var(--ink-soft); margin: var(--s4) 0 0; max-width: 38em; }
.hint { color: var(--ink-soft); font-size: 13px; margin: var(--s2) 0 0; }
.empty { color: var(--ink-soft); font-size: 14px; }

/* ---------- 生産ライン（このサイトの主役） ---------- */
.line {
  --lamp: 22px;
  list-style: none; margin: var(--s6) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  position: relative;
}
/* レール */
.line::before {
  content: ""; position: absolute; left: calc(12.5%); right: calc(12.5%);
  top: calc(var(--lamp) / 2 - 3px); height: 6px;
  background:
    repeating-linear-gradient(90deg, var(--ink) 0 10px, transparent 10px 18px) center / 100% 2px no-repeat,
    var(--steel-deep);
  border-radius: 3px;
}
.station { position: relative; display: grid; justify-items: center; gap: var(--s2); text-align: center; }
.lamp {
  width: var(--lamp); height: var(--lamp); border-radius: 50%;
  background: var(--lamp-off); border: 3px solid var(--ink);
  transition: background-color .25s, box-shadow .25s;
}
.station b { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: .04em; }
.station small { font-size: 12px; color: var(--ink-soft); }
.station.on .lamp { background: var(--signal); box-shadow: 0 0 0 6px rgba(245, 196, 0, .28); }
.station.done .lamp { background: var(--lamp-ok); box-shadow: 0 0 0 6px rgba(35, 145, 90, .2); }
/* 誰が担当する工程か */
.owners {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4);
  margin-top: var(--s3); font-size: 13px; color: var(--ink-soft); text-align: center;
}
.owners span { border-top: 2px solid var(--ink); padding-top: var(--s1); margin: 0 12%; }
.owners span:last-child { border-top-style: dashed; }

.line.compact { --lamp: 14px; margin: 0; }
.line.compact .lamp { border-width: 2px; }
.line.compact .station b { font-family: var(--body); font-weight: 700; font-size: 12px; letter-spacing: 0; }
.line.compact::before { height: 4px; top: calc(var(--lamp) / 2 - 2px); }

/* 提出完了時にだけ、ランプが順に点く */
@keyframes lamp-on {
  0% { background: var(--lamp-off); box-shadow: none; }
  60% { box-shadow: 0 0 0 12px rgba(245, 196, 0, .35); }
  100% { background: var(--signal); box-shadow: 0 0 0 6px rgba(245, 196, 0, .28); }
}
.line.run .station.on .lamp { animation: lamp-on .6s both; }
.line.run .station:nth-child(2).on .lamp { animation-delay: .35s; }
@media (prefers-reduced-motion: reduce) {
  .line.run .station.on .lamp { animation: none; }
  .lamp { transition: none; }
}

/* ---------- 作業指示書（フォーム） ---------- */
.sheet {
  background: var(--sheet);
  border: 2px solid var(--ink);
  margin-top: var(--s7);
  box-shadow: 8px 8px 0 var(--ink);
}
.step {
  display: grid; grid-template-columns: 72px 1fr;
  border-bottom: 2px solid var(--ink);
}
.step:last-of-type { border-bottom: 0; }
.step-no {
  font-family: var(--display); font-size: 28px; line-height: 1;
  display: flex; justify-content: center; padding-top: var(--s5);
  border-right: 2px solid var(--ink); background: var(--steel);
}
.step-body { padding: var(--s5) var(--s6) var(--s6); min-width: 0; }
.step-body > h2 + p { margin: var(--s1) 0 0; color: var(--ink-soft); font-size: 14px; }

.field { margin-top: var(--s5); }
.field label, .label { display: block; font-weight: 700; font-size: 14px; margin-bottom: var(--s2); }
.req { font-weight: 400; font-size: 12px; color: var(--ink-soft); margin-left: var(--s2); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }

input[type=text], input[type=email], textarea, select {
  width: 100%; padding: 12px 14px;
  font: inherit; color: var(--ink); background: #fff;
  border: 2px solid var(--rule); border-radius: 2px;
}
input:hover, textarea:hover, select:hover { border-color: var(--ink-soft); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--signal); }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
select { width: auto; padding-right: 32px; }

/* ファイルの投入口 */
.hopper {
  position: relative; display: flex; align-items: center; gap: var(--s4);
  padding: var(--s5); cursor: pointer;
  border: 2px dashed var(--ink-soft); background: #fff;
  transition: border-color .15s, background-color .15s;
}
.hopper input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.hopper:hover, .hopper.over { border-color: var(--ink); background: #fffbe6; }
.hopper:focus-within { border-style: solid; border-color: var(--ink); box-shadow: 0 0 0 3px var(--signal); }
.hopper .slot {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--steel); border: 2px solid var(--ink); font-family: var(--display); font-size: 20px;
}
.hopper .what { min-width: 0; }
.hopper .what strong { display: block; font-size: 15px; word-break: break-all; }
.hopper .what span { font-size: 13px; color: var(--ink-soft); }
.hopper.filled { border-style: solid; border-color: var(--ink); }
.hopper.filled .slot { background: var(--signal); }

.readbox {
  margin: var(--s4) 0; padding: var(--s4) var(--s5);
  background: #fff; border-left: 6px solid var(--signal);
  font-size: 17px; line-height: 1.95;
}
.readbox p { margin: 0; }
.readbox p + p { margin-top: var(--s2); }
.readbox .how { font-size: 13px; color: var(--ink-soft); margin-bottom: var(--s2); line-height: 1.6; }

audio, video { width: 100%; margin-top: var(--s3); display: block; }
video { background: var(--ink); aspect-ratio: 16 / 9; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 12px 22px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 2px;
}
.btn:hover { background: var(--steel); }
.btn:active { transform: translate(1px, 1px); }
.btn.primary { background: var(--signal); box-shadow: 4px 4px 0 var(--ink); }
.btn.primary:hover { background: var(--signal-deep); }
.btn.primary:active { box-shadow: 2px 2px 0 var(--ink); transform: translate(2px, 2px); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn.danger { color: var(--lamp-err); border-color: var(--lamp-err); }
.btn.danger:hover { background: #fdecea; }

.submit-row {
  display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap;
  padding: var(--s5) var(--s6); background: var(--steel); border-top: 2px solid var(--ink);
}
.submit-row .btn.primary { font-size: 18px; padding: 14px 40px; font-family: var(--display); font-weight: 400; letter-spacing: .08em; }

/* ---------- 進捗・メッセージ ---------- */
.progress { height: 10px; background: var(--steel-deep); border: 2px solid var(--ink); overflow: hidden; flex: 1; min-width: 160px; }
.progress > div {
  height: 100%; width: 0; transition: width .2s;
  background: repeating-linear-gradient(-45deg, var(--signal) 0 8px, var(--ink) 8px 16px);
}
.msg { padding: var(--s3) var(--s4); font-size: 14px; font-weight: 700; border: 2px solid currentColor; }
.msg.error { color: var(--lamp-err); background: #fdecea; }
.msg.ok { color: var(--lamp-ok); background: #e7f5ec; }

/* ---------- 状態ランプ ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: var(--lamp-off); }
.badge.in_progress::before { background: var(--signal); }
.badge.done::before { background: var(--lamp-ok); }

/* ---------- ファイル一覧 ---------- */
.files { list-style: none; padding: 0; margin: 0; }
.files li {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s3) 0; border-bottom: 1px solid var(--rule); font-size: 14px;
}
.files li:last-child { border-bottom: 0; }
.files .name { flex: 1; min-width: 160px; font-weight: 700; word-break: break-all; }
.files .size { color: var(--ink-soft); font-size: 12px; }
.files .media { flex-basis: 100%; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.thumbs figure { margin: 0; font-size: 12px; color: var(--ink-soft); }
.thumbs img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--ink); display: block; background: #fff; }

/* ---------- 受付完了（伝票） ---------- */
.receipt { margin-top: var(--s7); }
.receipt .url {
  display: flex; gap: var(--s2); align-items: stretch; margin-top: var(--s4);
}
.receipt .url input { font-size: 14px; background: #fff; }

/* ---------- 汎用 ---------- */
.linkish {
  background: none; border: 0; padding: 0; font: inherit; font-size: 13px; cursor: pointer;
  color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
}
.warn-text { color: var(--lamp-err); font-weight: 700; }
.crumb { margin: 0 0 var(--s2); font-size: 14px; }
.crumb a { color: var(--ink-soft); }
.title-row { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.pad { padding: var(--s5) var(--s6); }
.pad-all { padding: var(--s5) var(--s6) var(--s6); }
.pad-x { padding: 0 var(--s6) var(--s3); }
.form-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s4); }
.btn.wide { width: 100%; margin-top: var(--s5); }
.inline-form { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); max-width: 640px; }
.inline-form.stacked { display: block; margin-top: var(--s4); padding: var(--s4); background: var(--steel); border: 2px solid var(--ink); }
.inline-form.stacked label { display: block; font-weight: 700; font-size: 13px; margin-top: var(--s2); }
.inline-form.stacked input, .inline-form.stacked textarea { margin-top: var(--s1); font-weight: 400; }

.sheet-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s4) var(--s6); border-bottom: 2px solid var(--ink); background: var(--steel);
}
.sheet .msg { margin: 0; border-width: 2px 0 0; }
.sheet + .sheet { margin-top: var(--s6); }

.strip {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  margin: var(--s5) 0 0; padding: var(--s3) var(--s4); font-size: 14px;
  background: var(--sheet); border: 2px solid var(--ink);
}
.strip.warn { background: #fff6cc; }
.strip .badge { margin-right: var(--s2); }

/* 講座の一覧 */
.course-list { list-style: none; margin: 0; padding: 0; }
.course-list > li + li { border-top: 1px solid var(--rule); }
.course-row {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s4); align-items: center;
  padding: var(--s4) var(--s6); color: var(--ink); text-decoration: none;
}
.course-row:hover { background: #fffbe6; }
.course-title { font-weight: 700; font-size: 17px; }
.course-meta { font-size: 13px; color: var(--ink-soft); }
.meter { grid-column: 1 / -1; height: 6px; background: var(--steel-deep); display: block; }
.meter span { display: block; height: 100%; background: var(--lamp-ok); }
.submit-row input[type=text] { flex: 1; min-width: 220px; }

/* レクチャーの並び（順番が意味を持つので番号を大きく見せる） */
.lectures { list-style: none; margin: var(--s6) 0 0; padding: 0; }
.lecture {
  display: grid; grid-template-columns: 72px 1fr;
  background: var(--sheet); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
}
.lec-no {
  font-family: var(--display); font-size: 30px; display: flex; justify-content: center; padding-top: var(--s4);
  background: var(--steel); border-right: 2px solid var(--ink);
}
.lec-body { padding: var(--s4) var(--s5) var(--s5); min-width: 0; }
.lec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.lec-head h3 { font-size: 18px; }
.lec-script { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s4); font-size: 14px; }
.lec-note { margin: var(--s3) 0 0; font-size: 14px; color: var(--ink-soft); white-space: pre-wrap; border-left: 3px solid var(--rule); padding-left: var(--s3); }
.lec-tools { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--rule); }
.deliver { margin-top: var(--s4); border: 2px solid var(--lamp-ok); background: #fff; padding: var(--s2) var(--s4); }
.deliver summary { cursor: pointer; font-weight: 700; color: var(--lamp-ok); padding: var(--s1) 0; }
.deliver[open] summary { margin-bottom: var(--s2); }

/* レクチャーの間に挿入する口 */
.insert { position: relative; height: 34px; display: flex; align-items: center; justify-content: center; }
.insert::before { content: ""; position: absolute; left: 36px; top: 0; bottom: 0; border-left: 2px dashed var(--ink-soft); }
.insert-btn {
  position: relative; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 2px 14px; color: var(--ink-soft); background: var(--steel); border: 2px dashed var(--ink-soft);
  opacity: .55; transition: opacity .15s;
}
.insert:hover .insert-btn, .insert-btn:focus-visible { opacity: 1; color: var(--ink); border-color: var(--ink); background: var(--signal); }
.insert.open { height: auto; display: block; padding: var(--s3) 0; }
.insert.open::before { display: none; }
.insert .sheet { margin: 0; }
.add-sheet { margin-top: var(--s6); }
.hopper.small { padding: var(--s3) var(--s4); }
.hopper.small .slot { width: 36px; height: 36px; font-size: 16px; }

/* ログイン */
.gate-main { display: grid; grid-template-columns: 1.35fr 1fr; gap: var(--s7); align-items: center; max-width: 1120px; min-height: calc(100vh - 60px); }
.gate-intro h1 { font-size: clamp(28px, 3.6vw, 46px); line-height: 1.45; }
.phrase { display: inline-block; }
.gate-line { margin-top: var(--s6); }
.gate-sheet { margin: 0; padding: var(--s6); }
.gate-step h2 { font-family: var(--display); font-weight: 400; font-size: 24px; }
.gate-links { margin: var(--s4) 0 0; font-size: 13px; }
.gate-sheet .msg { margin-top: var(--s4); border-width: 2px; }
.code-input { font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 700; }

.queue { list-style: none; padding: 0; margin: var(--s2) 0 0; font-size: 13px; }
.queue li { margin: var(--s2) 0; }

@media (max-width: 900px) {
  .gate-main { grid-template-columns: 1fr; gap: var(--s6); min-height: 0; }
}

@media (max-width: 720px) {
  .menu { order: 3; flex-basis: 100%; margin: var(--s2) 0 0; }
  .topbar { flex-wrap: wrap; }
  .who span { display: none; }
  .sheet-head, .course-row, .pad, .pad-all { padding-left: var(--s4); padding-right: var(--s4); }
  .pad-x { padding: 0 var(--s4) var(--s3); }
  .lecture { grid-template-columns: 48px 1fr; box-shadow: 4px 4px 0 var(--ink); }
  .lec-no { font-size: 22px; }
  .lec-body { padding: var(--s4); }
  .insert::before { left: 24px; }
  .inline-form { flex-wrap: wrap; }
  main { padding: var(--s6) var(--s4) var(--s7); }
  .topbar { padding: var(--s3) var(--s4); }
  .step { grid-template-columns: 1fr; }
  .step-no { justify-content: flex-start; padding: var(--s3) var(--s5); border-right: 0; border-bottom: 2px solid var(--ink); font-size: 22px; }
  .step-body { padding: var(--s5); }
  .pair { grid-template-columns: 1fr; }
  .submit-row { padding: var(--s5); }
  .submit-row .btn.primary { width: 100%; }
  .sheet { box-shadow: 5px 5px 0 var(--ink); }
  .station b { font-size: 15px; }
  .line { --lamp: 18px; }
  .receipt .url { flex-direction: column; }
}

/* .field label の指定が投入口に効かないようにする */
.field .hopper { display: flex; margin-bottom: 0; font-weight: 400; font-size: 14px; }
.hopper .slot { font-family: var(--body); font-weight: 700; }
