:root {
  --navy: #003a73;
  --navy-dark: #002a54;
  --blue: #009fe6;
  --blue-soft: #e3f4fd;
  --ink: #1c2b36;
  --gray: #5b6b78;
  --line: #dde5ec;
  --bg: #f5f8fa;
  --white: #ffffff;
  --accent: #ff7a45;
  --green: #2bb673;
  --red: #e0443a;
  --teal: #0c8599;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 42, 84, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Noto Sans JP', 'Inter', sans-serif; color: var(--ink); background: var(--bg); line-height: 1.8; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- header / hero ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--navy); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.header-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 58px; }
.logo { color: #fff; font-weight: 900; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--teal); color: #fff; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a { color: #cfe3f5; text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; transition: .15s; }
.nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav .nav-home { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; border: 1px solid rgba(255,255,255,.25); }
.nav .nav-home:hover { background: var(--teal); border-color: var(--teal); }

.hero { background: linear-gradient(135deg, var(--navy) 0%, #00518f 55%, #0c8599 100%); color: #fff; padding: 56px 0 48px; }
.hero .container { max-width: 980px; }
.hero-eyebrow { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 12px; letter-spacing: .2em; color: #8fe3ef; margin: 0 0 10px; }
.hero h1 { font-size: 34px; font-weight: 900; margin: 0 0 16px; letter-spacing: .02em; }
.hero-lead { font-size: 15px; color: #d7e7f5; margin: 0 0 24px; }
.hero-lead strong { color: #fff; }
.hero-steps { display: flex; gap: 10px; flex-wrap: wrap; }
.step-chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); color: #fff; font-size: 13px; font-weight: 700; padding: 8px 16px; border-radius: 999px; }

/* ---------- lesson ---------- */
.lesson { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 32px; margin: 28px auto; max-width: 980px; }
.lesson-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.step-badge { background: var(--teal); color: #fff; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 12px; letter-spacing: .08em; padding: 4px 12px; border-radius: 999px; }
.lesson h2 { font-size: 20px; font-weight: 900; color: var(--navy); margin: 0; }
.lesson-desc { color: var(--gray); font-size: 14px; margin: 8px 0 0; }
.lesson-desc strong { color: var(--navy); }
.tips-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 18px; }
.tip-card { background: var(--bg); border-radius: 10px; padding: 18px 18px 14px; border: 1px solid var(--line); }
.tip-card h3 { font-size: 14.5px; color: var(--navy); margin: 6px 0 6px; }
.tip-card p { font-size: 13px; color: var(--gray); margin: 0; line-height: 1.7; }

/* ---------- builder layout ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; align-items: start; margin: 28px 0; }
.builder-form { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.form-block + .form-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-h { font-size: 16px; color: var(--navy); margin: 0 0 14px; }
.form-h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.form-h-row .form-h { margin: 0; }
.form-hint { font-size: 12px; color: var(--gray); margin: 0 0 14px; line-height: 1.6; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12.5px; font-weight: 700; color: var(--navy); }
.fld span { font-size: 12px; }
.fld input, .fld textarea, .fld select { font-family: inherit; font-size: 14px; font-weight: 500; color: var(--ink); border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%; }
.fld textarea { resize: vertical; line-height: 1.6; }
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(12,133,153,.12); }
.fld-row { display: flex; gap: 10px; }
.fld-row .fld { flex: 1; }

/* 作品の編集カード */
.work-edit { border: 1.5px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: var(--bg); }
.work-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.work-edit-no { font-size: 12.5px; font-weight: 800; color: var(--teal); }
.work-edit-tools { display: flex; gap: 4px; }
.work-edit-tools button { font-family: inherit; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 6px; width: 30px; height: 26px; cursor: pointer; font-size: 12px; line-height: 1; }
.work-edit-tools button:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.work-edit-tools button:disabled { opacity: .3; cursor: default; }
.work-edit-tools .del:hover { border-color: var(--red); color: var(--red); }
.img-pick { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.img-thumb { width: 76px; height: 60px; border-radius: 6px; border: 1px solid var(--line); background: #fff center/cover no-repeat; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #b6c4ce; }
.img-pick-btns { display: flex; flex-direction: column; gap: 5px; }
.img-pick label.filebtn { font-size: 12.5px; font-weight: 700; color: var(--teal); border: 1.5px solid var(--teal); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; text-align: center; }
.img-pick label.filebtn:hover { background: #e6f6f9; }
.img-pick input[type=file] { display: none; }
.img-pick .img-clear { font-size: 11.5px; color: var(--gray); background: none; border: none; cursor: pointer; text-decoration: underline; }

/* ---------- preview (ブラウザ風フレーム) ---------- */
.pf-preview { background: #eef2f5; border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 0 18px; min-width: 0; }
.pf-preview-head { position: sticky; top: 58px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pf-prev-title { font-weight: 900; color: var(--navy); font-size: 14px; }
.pf-prev-status { font-size: 11.5px; color: var(--green); font-weight: 700; }
.pf-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.web-frame { margin: 18px; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,42,84,.16); background: #fff; }
.web-frame-bar { display: flex; align-items: center; gap: 6px; background: #e3e8ec; padding: 8px 12px; }
.web-frame-bar span { width: 10px; height: 10px; border-radius: 50%; background: #c6ced4; }
.web-frame-bar span:nth-child(1) { background: #ff5f57; }
.web-frame-bar span:nth-child(2) { background: #febc2e; }
.web-frame-bar span:nth-child(3) { background: #28c840; }
.web-frame-bar i { font-style: normal; font-size: 11px; color: #6b7a86; background: #fff; border-radius: 6px; padding: 2px 12px; margin-left: 8px; flex: 1; text-align: center; }
#web-doc { height: 640px; overflow-y: auto; overscroll-behavior: contain; }

/* ---- プレビュー内サイトの見た目(書き出しHTMLと同等) ---- */
#web-doc .s-hero { --ac: var(--teal); background: linear-gradient(150deg, var(--ac), #1c2b36 170%); color: #fff; padding: 72px 32px 60px; }
#web-doc .s-hero .eyebrow { font-family: 'Inter', sans-serif; letter-spacing: .3em; font-size: 11px; opacity: .85; margin: 0 0 14px; }
#web-doc .s-hero h1 { font-size: 34px; font-weight: 900; margin: 0 0 6px; line-height: 1.25; }
#web-doc .s-hero .dept { font-size: 13px; font-weight: 700; opacity: .9; margin: 0 0 14px; }
#web-doc .s-hero .catch { font-size: 15px; margin: 0; opacity: .95; }
#web-doc .s-sec { padding: 44px 32px; }
#web-doc .s-sec + .s-sec { border-top: 1px solid #edf1f4; }
#web-doc .s-h { --ac: var(--teal); font-size: 13px; font-weight: 800; color: var(--ac); letter-spacing: .12em; margin: 0 0 18px; }
#web-doc .s-bio { font-size: 14px; line-height: 2; color: #36474f; margin: 0 0 16px; white-space: pre-wrap; }
#web-doc .s-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; }
#web-doc .s-tag { --ac: var(--teal); font-size: 12px; font-weight: 700; color: var(--ac); border: 1px solid; border-radius: 999px; padding: 3px 12px; }
#web-doc .s-contact { font-size: 13px; color: #36474f; }
#web-doc .s-work { margin-bottom: 40px; }
#web-doc .s-work:last-child { margin-bottom: 0; }
#web-doc .s-work img, #web-doc .s-work .noimg { width: 100%; border-radius: 8px; display: block; }
#web-doc .s-work .noimg { background: #f0f3f6; color: #c2d0da; text-align: center; padding: 60px 0; font-size: 34px; }
#web-doc .s-work h3 { font-size: 19px; font-weight: 900; color: #1c2b36; margin: 14px 0 6px; }
#web-doc .s-work .concept { font-size: 13.5px; line-height: 1.9; color: #36474f; margin: 0 0 8px; white-space: pre-wrap; }
#web-doc .s-work .meta { font-size: 11.5px; color: #7a8a96; }
#web-doc .s-footer { --ac: var(--teal); background: #1c2b36; color: #cfd8de; text-align: center; padding: 28px 20px; font-size: 12px; }
#web-doc .s-empty { text-align: center; color: var(--gray); font-size: 13.5px; padding: 40px 20px; }

/* ---------- btn / toast ---------- */
.btn { font-family: inherit; font-size: 13px; font-weight: 700; padding: 8px 15px; border-radius: 999px; cursor: pointer; border: 1.5px solid var(--line); background: #fff; color: var(--navy); transition: .15s; }
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--gray); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 700; padding: 10px 22px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 1000; transition: opacity .3s; max-width: 90vw; text-align: center; }
.toast[hidden] { display: none; }
.site-footer { background: var(--navy); color: #9fc0dd; text-align: center; padding: 24px 20px; font-size: 12.5px; margin-top: 40px; }
.site-footer p { margin: 0; }

/* ---------- page nav ---------- */
.page-nav { display: flex; gap: 12px; align-items: stretch; margin: 40px auto 0; max-width: 980px; }
.pgnav { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3px; text-decoration: none; background: #fff; border: 1.5px solid #dde5ec; border-radius: 12px; padding: 14px 18px; transition: .15s; box-shadow: 0 2px 12px rgba(0,42,84,.08); }
.pgnav:hover { border-color: #0c8599; transform: translateY(-2px); }
.pgnav.prev { text-align: left; }
.pgnav.next { text-align: right; }
.pgnav.top { flex: 0 0 130px; text-align: center; background: #003a73; border-color: #003a73; }
.pgnav.top .pgnav-dir, .pgnav.top .pgnav-name { color: #fff; }
.pgnav.top:hover { background: #002a54; border-color: #002a54; }
.pgnav-dir { font-size: 12px; font-weight: 700; color: #0c8599; }
.pgnav-name { font-size: 14px; font-weight: 900; color: #003a73; }
.pgnav.is-disabled { visibility: hidden; }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .pf-preview-head { position: static; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 25px; }
  .header-inner { flex-direction: column; height: auto; padding: 10px 20px; gap: 4px; }
  .page-nav { flex-wrap: wrap; } .pgnav.top { order: -1; flex-basis: 100%; }
  .fld-row { flex-direction: column; gap: 0; }
  .web-frame { margin: 12px; }
  #web-doc { height: 480px; }
}
