/* ==========================================================================
   緊急連絡先カード作成ツール
   PC: 左に入力フォーム / 右にプレビュー（sticky）
   SP: 入力 → プレビュー → 印刷操作 の1カラム
   ========================================================================== */

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

body {
  background: #f3f5f8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #1f2937;
  line-height: 1.6;
}

button, input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* ── パンくず・導入 ───────────────────────────────────────────── */
.ecc-breadcrumb,
.ecc-seo-header,
.ecc-main-container,
.ecc-doc-section {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

.ecc-breadcrumb { margin-top: 14px; padding: 0 16px; }

.ecc-seo-header {
  margin-top: 10px;
  margin-bottom: 18px;
  padding: 0 16px;
}

.ecc-seo-header h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
}

.ecc-seo-lead {
  margin: 0 0 12px;
  max-width: 760px;
  color: #444;
  line-height: 1.75;
}

.ecc-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ecc-features li {
  padding: 4px 10px;
  border: 1px solid #dbe7f3;
  border-radius: 999px;
  background: #f7faff;
  color: #315d8c;
  font-size: .8rem;
  font-weight: 600;
}

/* ── 個人情報に関する注意 ───────────────────────────────────── */
.ecc-privacy-alert {
  margin-top: 16px;
  padding: 15px 17px;
  border: 1px solid #efc078;
  border-left: 5px solid #d97706;
  border-radius: 9px;
  background: #fff9ed;
  color: #70430a;
}

.ecc-privacy-alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  color: #92400e;
  font-size: .95rem;
  font-weight: 700;
}

.ecc-privacy-alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  border-radius: 50%;
  background: #d97706;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
}

.ecc-privacy-alert p {
  margin: 0 0 7px;
  font-size: .84rem;
  line-height: 1.7;
}

.ecc-privacy-alert b { color: #78350f; }

.ecc-privacy-alert ul {
  margin: 5px 0 0;
  padding-left: 1.4em;
}

.ecc-privacy-alert li {
  margin: 2px 0;
  font-size: .8rem;
  line-height: 1.65;
}

/* ── メインレイアウト ─────────────────────────────────────────── */
.ecc-main-container {
  margin-bottom: 48px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(340px, .85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
}

.ecc-form-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ecc-panel {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  padding: 20px 22px;
}

.ecc-preview-panel { padding: 22px 22px 18px; }
.ecc-save-panel { padding: 16px 22px; }

.ecc-panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -20px -22px;
  padding: 20px 22px;
  cursor: pointer;
  list-style: none;
}

.ecc-panel-summary::-webkit-details-marker { display: none; }

.ecc-panel[open] > .ecc-panel-summary {
  margin-bottom: 4px;
  border-bottom: 1px solid #eef1f5;
}

.ecc-block-title {
  font-size: .95rem;
  font-weight: 700;
  color: #374151;
}

.ecc-toggle-icon::before { content: "＋"; color: #2f6fb0; font-weight: 700; }
details[open] > .ecc-panel-summary .ecc-toggle-icon::before { content: "－"; }

.ecc-panel-body { padding-top: 16px; }
.ecc-panel-note { margin-bottom: 14px; }

.ecc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.ecc-intro-note {
  margin: 0;
  color: #6b7280;
  font-size: .82rem;
  line-height: 1.6;
}

.ecc-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.ecc-form-field:last-child { margin-bottom: 0; }

.ecc-form-field label {
  font-size: .85rem;
  font-weight: 600;
  color: #4b5563;
}

.ecc-form-field input[type="text"],
.ecc-form-field input[type="tel"],
.ecc-form-field input[type="date"],
.ecc-form-field textarea,
.ecc-form-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-size: .95rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
}

.ecc-form-field textarea {
  min-height: 56px;
  resize: vertical;
  line-height: 1.5;
}

.ecc-form-field input:focus,
.ecc-form-field textarea:focus,
.ecc-form-field select:focus {
  border-color: #2f6fb0;
}

.ecc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ecc-field-note {
  margin: 8px 0 0;
  font-size: .76rem;
  color: #8b93a1;
  line-height: 1.6;
}

.ecc-char-count {
  margin: 4px 0 0;
  text-align: right;
  font-size: .72rem;
  color: #9ca3af;
}

.ecc-char-count.is-limit { color: #b45309; font-weight: 600; }

.ecc-field-group-label {
  margin: 0 0 8px;
  font-size: .85rem;
  font-weight: 600;
  color: #4b5563;
}

.ecc-subheading {
  margin: 0 0 10px;
  font-size: .84rem;
  font-weight: 700;
  color: #2f6fb0;
}

.ecc-subheading-row {
  margin-top: 18px;
  align-items: center;
}

.ecc-optional-tag {
  margin-left: 4px;
  font-size: .74rem;
  font-weight: 500;
  color: #9ca3af;
}

.ecc-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ecc-visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .74rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
}

.ecc-visibility-toggle input {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.ecc-design-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.ecc-design-choice { position: relative; cursor: pointer; }

.ecc-design-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ecc-design-choice span {
  display: flex;
  min-height: 76px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: .78rem;
  text-align: center;
}

.ecc-design-choice input:checked + span {
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47,111,176,.12);
  color: #1f4f8a;
}

.ecc-design-choice input:focus-visible + span {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

.ecc-tpl-icon {
  display: block;
  width: 48px;
  height: 28px;
  border: 1px solid #d7dde5;
  border-radius: 3px;
  background: #fff;
  position: relative;
  overflow: hidden;
}

.ecc-tpl-icon::before,
.ecc-tpl-icon::after {
  content: "";
  position: absolute;
  background: #94a3b8;
}

.ecc-tpl-icon-simple::before { top: 6px; left: 6px; width: 20px; height: 3px; }
.ecc-tpl-icon-simple::after { bottom: 6px; left: 6px; width: 30px; height: 2px; background: #cbd5e1; }
.ecc-tpl-icon-blue::before { top: 0; left: 0; right: 0; height: 5px; background: #2f6fb0; }
.ecc-tpl-icon-blue::after { top: 11px; left: 6px; width: 22px; height: 3px; background: #2f6fb0; }
.ecc-tpl-icon-mono::before { top: 6px; left: 6px; width: 22px; height: 3px; background: #374151; }
.ecc-tpl-icon-mono::after { bottom: 5px; left: 6px; right: 6px; height: 1px; background: #6b7280; }

.ecc-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #333;
  font-size: .88rem;
  cursor: pointer;
}
.ecc-checkbox-row input { width: 18px; height: 18px; flex: 0 0 18px; }

.ecc-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 50px;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #1d4ed8;
  border: 1px solid #1d4ed8;
  color: #fff;
}

.ecc-btn-primary:hover { background: #1e40af; }

.ecc-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  border: 1px solid #2f6fb0;
  color: #2f6fb0;
  flex: 0 0 auto;
}

.ecc-btn-outline:hover { background: #eff6ff; }

.ecc-btn-text {
  background: none;
  border: none;
  padding: 6px 4px;
  font-size: .85rem;
  color: #7d8795;
  text-decoration: underline;
  cursor: pointer;
}
.ecc-btn-text:hover { color: #4b5563; }

.ecc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.ecc-preview-column {
  position: sticky;
  top: 20px;
  min-width: 0;
}

.ecc-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.ecc-preview-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
}

.ecc-preview-zoom-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
  color: #64748b;
  font-size: .78rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.ecc-zoom-buttons {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.ecc-zoom-btn {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
.ecc-zoom-btn:last-child { border-right: 0; }
.ecc-zoom-btn:hover { background: #f1f5f9; }
.ecc-zoom-btn.is-active { background: #2f6fb0; color: #fff; }
.ecc-zoom-btn:focus-visible { position: relative; z-index: 1; outline: 2px solid #2f6fb0; outline-offset: -2px; }

.ecc-overflow-warning {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #f3c98b;
  border-radius: 8px;
  background: #fff8ec;
  color: #92610f;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.6;
}

.ecc-scale-wrap {
  overflow: auto;
  margin-bottom: 16px;
  padding: 26px 14px 14px;
  border-radius: 10px;
  background: #e5e7eb;
}

.ecc-preview-container { position: relative; margin: 0 auto; }

.ecc-sheet {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0,0,0,.16);
  transform-origin: top left;
}

.ecc-sheet-grid {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ecc-card-slot { position: relative; }
.ecc-print-actions { margin-bottom: 8px; }

.ecc-note-small {
  margin: 0;
  font-size: .78rem;
  color: #8b93a1;
  line-height: 1.6;
  text-align: center;
}

.ecc-card {
  --ecc-accent: #374151;
  --ecc-base: 2.4mm;
  --ecc-name: 4.2mm;
  --ecc-tel: 3.3mm;
  --ecc-label: 1.9mm;
  position: relative;
  overflow: hidden;
  width: 91mm;
  height: 55mm;
  display: flex;
  flex-direction: column;
  gap: 1.1mm;
  padding: 4.2mm 5.5mm;
  border: 1px solid #d8dee6;
  background: #fff;
  color: #1f2328;
  text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
}

.ecc-card-toplabel {
  color: var(--ecc-accent);
  font-size: var(--ecc-label);
  font-weight: 700;
  letter-spacing: .04em;
}

.ecc-card-name {
  margin-top: .4mm;
  color: #111827;
  font-size: var(--ecc-name);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ecc-card-namekana {
  margin-top: -.2mm;
  color: #6b7280;
  font-size: calc(var(--ecc-base) * .78);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.ecc-card-line {
  color: #374151;
  font-size: var(--ecc-base);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ecc-card-line-label {
  color: #6b7280;
  font-weight: 600;
}

.ecc-card-divider {
  margin: .6mm 0;
  border-top: .25mm solid var(--ecc-accent);
  opacity: .3;
}

.ecc-card-section-label {
  color: var(--ecc-accent);
  font-size: var(--ecc-label);
  font-weight: 700;
}

.ecc-card-contact-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 3mm;
}

.ecc-card-contact-who {
  min-width: 0;
  color: #1f2937;
  font-size: var(--ecc-base);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ecc-card-contact-tel {
  flex: 0 0 auto;
  color: var(--ecc-accent);
  font-size: var(--ecc-tel);
  font-weight: 700;
  white-space: nowrap;
}

.ecc-card-supplement {
  display: flex;
  flex-direction: column;
  gap: .3mm;
}

/* テンプレート差分 */
.ecc-card.ecc-tpl-mono {
  border-width: 1.4px;
  border-color: #4b5563;
}
.ecc-card.ecc-tpl-mono .ecc-card-divider {
  border-top-style: solid;
  opacity: .5;
}

.ecc-cut-guide::before {
  content: "";
  position: absolute;
  top: -1.6mm;
  right: -1.6mm;
  bottom: -1.6mm;
  left: -1.6mm;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 94.2 58.2'%3E%3Cg stroke='%239aa5b1' stroke-width='0.15'%3E%3Cline x1='0' y1='1.6' x2='1.2' y2='1.6'/%3E%3Cline x1='1.6' y1='0' x2='1.6' y2='1.2'/%3E%3Cline x1='93' y1='1.6' x2='94.2' y2='1.6'/%3E%3Cline x1='92.6' y1='0' x2='92.6' y2='1.2'/%3E%3Cline x1='0' y1='56.6' x2='1.2' y2='56.6'/%3E%3Cline x1='1.6' y1='57' x2='1.6' y2='58.2'/%3E%3Cline x1='93' y1='56.6' x2='94.2' y2='56.6'/%3E%3Cline x1='92.6' y1='57' x2='92.6' y2='58.2'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.ecc-mobile-action-bar { display: none; }
.ecc-print-only { display: none; }

.ecc-doc-section {
  margin-top: 40px;
  margin-bottom: 60px;
  padding: 0 16px;
  color: #374151;
  line-height: 1.85;
}

.ecc-doc-section h2 {
  margin: 38px 0 14px;
  padding-left: 10px;
  border-left: 4px solid #1d4ed8;
  color: #111827;
  font-size: 1.22rem;
  font-weight: 700;
}

.ecc-doc-section h2:first-of-type { margin-top: 0; }
.ecc-doc-section h3 { margin: 0 0 6px; color: #1d4ed8; font-size: 1rem; font-weight: 700; }
.ecc-doc-section p,
.ecc-doc-section li { color: #374151; font-size: .92rem; line-height: 1.85; }
.ecc-doc-section p { margin: 0 0 12px; }
.ecc-doc-section ul { margin: 0 0 12px; padding-left: 1.4em; }

.ecc-doc-privacy {
  padding: 15px 17px;
  border: 1px solid #ead5ac;
  border-radius: 9px;
  background: #fffaf0;
}

.ecc-doc-privacy p:last-child,
.ecc-doc-privacy ul:last-child { margin-bottom: 0; }

.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-links li a {
  display: block;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
  color: #1d4ed8;
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
}

.related-links li a:hover { background: #eff6ff; }

.ecc-faq-item {
  margin-bottom: 10px;
  padding: 13px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}
.ecc-faq-item p { margin: 0; }

@media (max-width: 991px) {
  body { padding-bottom: 70px; }

  .ecc-seo-header { max-width: 900px; }
  .ecc-main-container {
    max-width: 900px;
    grid-template-columns: 1fr;
  }

  .ecc-preview-column { position: static; }
  .ecc-print-actions { display: none; }

  .ecc-mobile-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: flex;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e4e9f0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  }
}

@media (max-width: 560px) {
  .ecc-seo-header h1 { font-size: 1.3rem; }
  .ecc-toolbar { align-items: flex-start; }
  .ecc-form-grid { grid-template-columns: 1fr; gap: 0; }
  .ecc-design-choices { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
  .ecc-scale-wrap { padding: 20px 8px 10px; }
  .ecc-privacy-alert { padding: 13px 14px; }
}

@media print {
  .no-print { display: none !important; }

  body { margin: 0; padding: 0; background: #fff; }

  #header,
  #footer,
  .ecc-breadcrumb,
  .ecc-seo-header,
  .ecc-doc-section,
  .ecc-mobile-action-bar { display: none !important; }

  .ecc-main-container {
    display: block !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .ecc-form-column { display: none !important; }
  .ecc-preview-column { position: static; }

  .ecc-preview-panel {
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .ecc-preview-toolbar,
  .ecc-preview-zoom-row,
  .ecc-overflow-warning,
  .ecc-scale-wrap { display: none !important; }

  .ecc-print-only { display: block !important; }

  .ecc-preview-container {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
  }

  .ecc-sheet {
    width: 210mm;
    height: 296mm;
    margin: 0;
    box-shadow: none;
    transform: none !important;
  }

  .ecc-card { border: none !important; }

  .ecc-sheet,
  .ecc-sheet * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  @page { size: A4 portrait; margin: 0; }
}
