/* ===========================
   FILETIME・LDAP タイムスタンプ変換 — yorozu-craft 共通の和紙風の配色
   色はトークン（--bg / --card / --text / --muted / --accent / --border）だけを使う。
   ダークモードは端末の設定に自動で合わせる（prefers-color-scheme。手動切替は付けない）
   =========================== */
:root {
  color-scheme: light dark;
  --bg: #f0ebe0;
  --bg-2: #e6dfd0;
  --card: #faf6ee;
  --text: #3a3025;
  --muted: #6e604f;
  --accent: #8b4513;
  --accent-soft: #f3e6d8;
  --border: #cfc0a0;
  --shadow: rgba(58, 48, 37, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1814;
    --bg-2: #25201a;
    --card: #2b251e;
    --text: #ece4d6;
    --muted: #b9ab96;
    --accent: #e0a066;
    --accent-soft: #3a2e22;
    --border: #4a3f33;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

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

body {
  /* README「ツールを追加するとき」9: 端末のフォント。Web フォントは読まない */
  font-family: "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a { color: var(--accent); }

/* ヘッダー */
.app-header {
  text-align: center;
  padding: 1.4rem 1rem 1.1rem;
  background: var(--bg-2);
  border-bottom: 2px solid var(--border);
}
.app-header h1 { font-size: 1.45rem; color: var(--accent); line-height: 1.4; }
.app-header .subtitle { font-size: 0.88rem; color: var(--muted); margin-top: 0.3rem; }

/* レイアウト */
.app-main { max-width: 680px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.card h2 {
  font-size: 1.02rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.9rem;
}

/* 入力 */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.field .hint { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%;
  max-width: 16rem;
  padding: 0.45rem 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--card);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 読みもの（guide.html） */
.content h3 { font-size: 0.95rem; margin: 1rem 0 0.3rem; }
.content p, .content li { font-size: 0.9rem; }
.content p + p { margin-top: 0.5rem; }
.content ul, .content ol { padding-left: 1.3rem; margin: 0.3rem 0; }
.faq dt { font-weight: 600; margin-top: 0.9rem; font-size: 0.92rem; }
.faq dt::before { content: 'Q. '; color: var(--accent); }
.faq dd { font-size: 0.88rem; color: var(--muted); padding: 0.2rem 0 0.5rem 1.2rem; border-bottom: 1px solid var(--border); }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.2rem; font-size: 0.9rem; }
.info-list dt { font-weight: 600; }
.info-list dd { color: var(--muted); }
.small { font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; }

/* フッター */
.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.footer-nav ul { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-bottom: 0.6rem; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover, .footer-nav a[aria-current="page"] { color: var(--accent); }

/* ===== FILETIME 変換の部品 ===== */
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace; }
.field input.wide, .field textarea { width: 100%; max-width: none; }
.field textarea {
  padding: 0.5rem; font-size: 0.88rem; line-height: 1.5; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--text); resize: vertical;
}
.field input[type="datetime-local"] {
  padding: 0.4rem 0.5rem; font-size: 1rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--text); max-width: 100%;
}
.field-row { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.field-row .field { flex: 1 1 12rem; min-width: 0; }
.field-row .field select { max-width: 100%; }
.inline-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.examples { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: -0.3rem 0 0.9rem; }
.examples .small { margin: 0; }
.chip {
  border: 1px solid var(--border); background: var(--accent-soft); color: var(--text);
  border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.8rem; cursor: pointer;
}
.chip:hover, .chip:focus-visible { border-color: var(--accent); }
.btn-sub { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
.result { border-top: 1px dashed var(--border); padding-top: 0.8rem; margin-top: 0.4rem; }
.result .read { margin: 0 0 0.5rem; }
.error { color: #b3261e; font-weight: 600; font-size: 0.9rem; }
@media (prefers-color-scheme: dark) { .error { color: #ff8a80; } }
.notes { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 4px; padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; }
.notes p { font-size: 0.88rem; }
.notes p + p { margin-top: 0.4rem; }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.result-table th, .result-table td { text-align: left; vertical-align: top; padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--border); }
.result-table th { font-weight: 600; color: var(--muted); width: 38%; }
.result-table td .v { font-family: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace; overflow-wrap: anywhere; }
.copy {
  margin-left: 0.3rem; font-size: 0.72rem; padding: 0.05rem 0.45rem; border-radius: 4px;
  border: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; vertical-align: 1px;
}
@media (max-width: 480px) {
  .result-table th, .result-table td { display: block; width: auto; border-bottom: none; padding: 0.15rem 0.2rem; }
  .result-table td { border-bottom: 1px solid var(--border); padding-bottom: 0.45rem; }
}
.snippets { margin-top: 0.8rem; font-size: 0.85rem; }
.snippets summary { cursor: pointer; color: var(--accent); }
.snippets pre, .content pre {
  margin-top: 0.4rem; padding: 0.6rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.8rem; overflow-x: auto; white-space: pre; font-family: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace;
}
.actions { margin-top: 0.8rem; }
.next { margin-top: 0.7rem; font-size: 0.88rem; }
.msg { min-height: 1.2em; text-align: center; }
.table-wrap { overflow-x: auto; margin-top: 0.5rem; }
.bulk-table { border-collapse: collapse; font-size: 0.78rem; min-width: 100%; }
.bulk-table th, .bulk-table td { border: 1px solid var(--border); padding: 0.25rem 0.4rem; text-align: left; vertical-align: top; }
.bulk-table th { background: var(--bg-2); white-space: nowrap; }
.bulk-table td:nth-child(4), .bulk-table td:nth-child(5) { white-space: nowrap; }
.bulk-table td:last-child { min-width: 16em; }
.bulk-table td.num { font-family: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace; white-space: nowrap; }
.lang-switch { font-size: 0.82rem; margin-top: 0.35rem; }
.content code { font-family: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace; font-size: 0.85em; overflow-wrap: anywhere; }
.content table { border-collapse: collapse; font-size: 0.84rem; margin: 0.4rem 0; width: 100%; }
.content th, .content td { border: 1px solid var(--border); padding: 0.3rem 0.4rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.content th { background: var(--bg-2); }
.content h2 + p, .content h3 + p { margin-top: 0.2rem; }
.sources li { overflow-wrap: anywhere; }
.content details { margin-top: 0.6rem; }
.content details summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.content details[open] summary { margin-bottom: 0.4rem; }

@media (max-width: 480px) {
  .app-header h1 { font-size: 1.2rem; }
}
