@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-accent: #4f46e5;
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  --color-error: #ef4444;
  --color-info-bg: #f0f9ff;
  --color-info-border: #bae6fd;
  --color-info-text: #0369a1;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text-main);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ==== 全体コンテナ（PC表示でゆったり見やすい最大幅へ拡張） ==== */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ==== ヘッダー ==== */
.site-header {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand-logo {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.25));
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==== ヘッダーナビ & ボタン化された使い方ガイド ==== */
.header-nav {
  display: flex;
  align-items: center;
}

.btn-header-guide {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: #ffffff !important;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none !important;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-header-guide:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  opacity: 0.96;
}

.btn-header-guide .nav-icon {
  stroke: #ffffff;
}

/* ==== メイン領域 ==== */
.site-main {
  flex: 1 0 auto;
  padding: 40px 0 60px;
}

.page-intro {
  margin: 0 0 28px;
  text-align: center;
}

.page-intro h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
  margin: 0 0 12px;
}

.page-intro p {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 720px;
  margin: 0 auto;
}

main.site-main .container > section,
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ==== モード選択（2カラムグリッド配置） ==== */
#mode-section {
  margin-bottom: 24px;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-option:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-sm);
}

.mode-option input[type="radio"] {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.mode-option:has(input[type="radio"]:checked),
.mode-option.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.mode-option-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-option-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text-main);
}

.mode-option-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ==== フォーム全般 ==== */
.section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-title-row h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-main);
}

textarea {
  width: 100%;
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  background: #ffffff;
  color: var(--color-text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  margin-bottom: 6px;
}

.field-label-row label,
.field-label-row .field-label-static {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.option-row input[type="password"],
.option-row input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

#password-section .password-input-wrap {
  max-width: 100%;
  margin-top: 12px;
}

.password-input-wrap input {
  padding-right: 44px !important;
}

.btn-toggle-password {
  position: absolute !important;
  right: 6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 8px !important;
  color: var(--color-text-muted) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm) !important;
  transition: color 0.2s ease, background-color 0.2s ease !important;
  line-height: 1 !important;
  z-index: 2;
}

.btn-toggle-password:hover {
  color: var(--color-text-main) !important;
  background-color: rgba(15, 23, 42, 0.06) !important;
  transform: translateY(-50%) !important;
  opacity: 1 !important;
}

.btn-toggle-password svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

.field-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 6px;
  margin-bottom: 0;
}

.checkbox-row {
  margin-top: 16px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-main);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ==== 情報アイコン（？）と展開ボックス ==== */
.info-toggle {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.info-toggle:hover,
.info-toggle[aria-expanded="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.info-box {
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-info-text);
  margin: 10px 0 16px;
}

.info-box strong {
  color: var(--color-primary);
}

/* ==== ボタンアクション ==== */
.actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

button, .button-link {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

button:hover:not(:disabled), .button-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  opacity: 0.96;
}

button.secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover:not(:disabled) {
  background: var(--color-primary-light);
  border-color: #93c5fd;
  color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

/* ==== 保存ボタン個別カラー調整 ==== */
#downloadTxtBtn {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

#downloadTxtBtn:hover:not(:disabled) {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
  box-shadow: var(--shadow-md);
}

#downloadPdfBtn {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

#downloadPdfBtn:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
  box-shadow: var(--shadow-md);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.notice {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 14px;
  line-height: 1.6;
}

.success-msg {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 500;
  margin-top: 14px;
}

/* ==== QRコード / 結果セクション ==== */
.qr-wrap {
  text-align: center;
  margin: 16px 0;
}

.qr-wrap img {
  width: 240px;
  height: 240px;
  max-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

#result-section {
  text-align: center;
}

.url-display {
  word-break: break-all;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.url-display a {
  color: var(--color-primary);
  text-decoration: none;
}

.url-display a:hover {
  text-decoration: underline;
}

.expires {
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.error {
  color: var(--color-error);
  font-size: 0.92rem;
  font-weight: 500;
}

/* ==== 閲覧ページ ==== */
#noteContent {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.7;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 0 0 20px;
  color: var(--color-text-main);
}

#view-content .actions,
#edit-section .actions {
  justify-content: flex-start;
}

#edit-section textarea {
  min-height: 240px;
}

.download-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

#password-section {
  text-align: center;
  max-width: 440px;
  margin: 0 auto;
}

#password-section input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  margin-top: 12px;
}

html {
  scroll-behavior: smooth;
}

.guide-container .card[id] {
  scroll-margin-top: 84px;
}

/* ==== ガイドページスタイル ==== */
.guide-container .card {
  margin-bottom: 24px;
}

.guide-container h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 18px;
  color: var(--color-text-main);
  padding: 4px 0 4px 14px;
  border-left: 5px solid var(--color-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.guide-container h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-container h3::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
}

/* ==== 目次のモダンカード＆矢印アイコン付き表示 ==== */
.guide-toc ul {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.guide-toc li {
  margin: 0;
}

.guide-toc a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-main);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.guide-toc a::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2.5px solid var(--color-primary);
  border-top: 2.5px solid var(--color-primary);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.guide-toc a:hover {
  background: #ffffff;
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.guide-toc a:hover::before {
  transform: translateX(3px) rotate(45deg);
}

/* ==== テーブル一般 ==== */
.guide-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

@media (max-width: 640px) {
  .guide-table {
    width: 100%;
    table-layout: auto;
    word-break: break-word;
  }

  .guide-table th,
  .guide-table td {
    padding: 10px 8px;
    font-size: 0.82rem;
    white-space: normal;
  }

  /* 更新履歴テーブル：バージョン列は文字幅に合わせた最小可変幅、内容列を広く表示 */
  .table-changelog th:first-child,
  .table-changelog td:first-child {
    width: 1%;
    white-space: nowrap !important;
    font-weight: 700;
  }

  .table-steps th:first-child,
  .table-steps td:first-child {
    width: 44px;
  }

  .table-viewer th:first-child,
  .table-viewer td:first-child {
    width: 90px;
  }

  .table-equal-2 {
    table-layout: fixed;
  }

  .table-equal-2 th,
  .table-equal-2 td {
    width: 50%;
  }

  .table-modes {
    table-layout: fixed;
  }

  .table-modes th:first-child,
  .table-modes td:first-child,
  .table-modes td.col-label {
    width: 26%;
  }

  .table-modes th:nth-child(2),
  .table-modes td:nth-child(2),
  .table-modes th:nth-child(3),
  .table-modes td:nth-child(3) {
    width: 37%;
  }
}

.guide-table th,
.guide-table td {
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}

.guide-table tr:last-child th,
.guide-table tr:last-child td {
  border-bottom: none;
}

.guide-table th:last-child,
.guide-table td:last-child {
  border-right: none;
}

.guide-table th {
  background: var(--color-bg);
  font-weight: 700;
  color: var(--color-text-main);
  white-space: nowrap;
}

.guide-table code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: monospace;
}

/* ==== 基本の使い方：手順番号のセンター太字表示 ==== */
.table-steps th:first-child,
.table-steps td:first-child {
  text-align: center !important;
  font-weight: 700;
  font-size: 1rem;
  width: 70px;
  white-space: nowrap;
}

/* ==== 閲覧機能テーブル：機能セルの改行禁止 ==== */
.table-viewer th:first-child,
.table-viewer td:first-child {
  white-space: nowrap !important;
  font-weight: 700;
  width: 140px;
}

/* ==== モード比較テーブル：一番左は改行禁止、2・3列目は均等幅 ==== */
.table-modes {
  width: 100%;
}

@media (min-width: 641px) {
  .table-modes {
    table-layout: fixed;
  }

  .table-modes th:first-child,
  .table-modes td:first-child,
  .table-modes td.col-label {
    white-space: normal;
    width: 20%;
  }

  .table-modes th:nth-child(2),
  .table-modes td:nth-child(2),
  .table-modes th:nth-child(3),
  .table-modes td:nth-child(3) {
    width: 40%;
  }
}

/* ==== 左右均等2列テーブル（パスワード保護、マイQRの仕組み等） ==== */
@media (min-width: 641px) {
  .table-equal-2 {
    table-layout: fixed;
    width: 100%;
  }

  .table-equal-2 th,
  .table-equal-2 td {
    width: 50%;
  }
}

/* ==== FAQ (よくある質問)：カード枠＆グラデーションQバッジ表示 ==== */
.faq-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.faq-item:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-sm);
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-q {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--color-text-main);
  margin: 0 0 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.5;
}

.faq-q::before {
  content: "Q";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.faq-a {
  font-size: 0.94rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin: 0;
  padding-left: 38px;
}

@media (max-width: 640px) {
  .faq-item {
    padding: 16px;
  }

  .faq-a {
    padding-left: 0;
    margin-top: 8px;
  }
}

/* ==== フッター (センター配置 & 指定リンク構造) ==== */
.site-footer {
  flex-shrink: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  box-shadow: 0 -1px 3px rgba(15, 23, 42, 0.02);
}

.footer-inner {
  padding: 28px 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.footer-desc {
  margin: 0 0 4px;
  font-weight: 500;
}

.footer-sub {
  margin: 0 0 16px;
  font-size: 0.78rem;
  opacity: 0.85;
}

.footer-links {
  border-top: 1px dashed var(--color-border);
  padding-top: 16px;
  margin-top: 14px;
}

.footer-link-row {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.80rem;
}

.footer-link-row a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link-row a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.footer-sep {
  color: var(--color-border);
  user-select: none;
}

.footer-brand-row {
  margin: 0;
}

.footer-brand-link {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-brand-link:hover {
  color: var(--color-primary);
}

.hidden {
  display: none !important;
}

/* ==== レスポンシブ調整 ==== */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    padding: 12px 16px;
  }

  .brand-text {
    font-size: 1.15rem;
  }

  .btn-header-guide {
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .site-main {
    padding: 24px 0 40px;
  }

  .page-intro h1 {
    font-size: 1.35rem;
  }

  .page-intro p {
    font-size: 0.88rem;
    text-align: left;
  }

  main.site-main .container > section,
  .card {
    padding: 18px;
    border-radius: var(--radius-md);
  }

  .mode-options {
    grid-template-columns: 1fr;
  }

  .qr-wrap img {
    width: 200px;
    height: 200px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button,
  .actions .button-link {
    width: 100%;
  }

  .footer-inner {
    padding: 24px 16px;
  }
}

/* ==== 印刷（PDF保存）用 ==== */
@media print {
  body * {
    visibility: hidden;
  }

  #noteContent, #noteContent * {
    visibility: visible;
  }

  #noteContent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    border: none;
    background: none;
    padding: 0;
  }
}
