:root {
  --bg: #f6f4ef;
  --bg-soft: #fbf9f4;
  --ink: #1d2a35;
  --ink-soft: #4a5763;
  --ink-mute: #6b7785;
  --line: #d9d3c7;
  --line-soft: #e7e2d6;
  --accent-1: #c97b4a;
  --accent-2: #8a6d4a;
  --accent-3: #4a6b7c;
  --safe-bg: #e6f0e6;
  --safe-ink: #2f5a3a;
  --avoid-bg: #f6e6e6;
  --avoid-ink: #7a2f2f;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(29,42,53,0.06), 0 8px 24px rgba(29,42,53,0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --max: 1200px;
  --pad: clamp(16px, 3vw, 32px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--accent-3); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  padding: 16px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-flex; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--ink-mute); font-size: 0.85rem; }

.site-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-soft);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.site-nav a:hover { background: var(--line-soft); text-decoration: none; color: var(--ink); }

.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px var(--pad);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 100px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.sidebar h2 { margin-top: 0; font-size: 1.1rem; }
.sidebar p { margin-top: 4px; }

.context-list { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.context-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.context-btn:hover { background: var(--line-soft); color: var(--ink); }
.context-btn.is-active {
  background: var(--bg-soft);
  border-color: var(--accent-3);
  color: var(--ink);
  font-weight: 600;
}

.sidebar-card {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.sidebar-card h3 { margin: 0 0 6px; font-size: 0.95rem; }
.sidebar-card p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }

.main-content { min-width: 0; }
.section-head { margin-bottom: 20px; }
.section-head h1, .section-head h2 { margin: 0 0 8px; line-height: 1.2; }
.section-head h1 { font-size: 2rem; }
.section-head h2 { font-size: 1.6rem; }
.lead { color: var(--ink-soft); max-width: 720px; }
.muted { color: var(--ink-mute); font-size: 0.9rem; }

.level-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.level-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.level-card:hover { border-color: var(--accent-3); transform: translateY(-1px); }
.level-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.level-number {
  display: inline-block;
  background: var(--accent-3);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.level-head h2 { margin: 0; font-size: 1.25rem; }
.level-summary { color: var(--ink-soft); margin: 0 0 16px; }
.level-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.level-col h3 { margin: 0 0 8px; font-size: 0.95rem; }
.topic-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.topic-list li {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  position: relative;
  padding-left: 28px;
}
.topic-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.topic-list.safe { background: var(--safe-bg); color: var(--safe-ink); }
.topic-list.safe li::before { background: var(--safe-ink); }
.topic-list.avoid { background: var(--avoid-bg); color: var(--avoid-ink); }
.topic-list.avoid li::before { background: var(--avoid-ink); }
.level-note {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent-1);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.section-contexts { margin-top: 48px; }
.context-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.context-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.context-card h3 { margin-top: 0; font-size: 1.05rem; color: var(--accent-2); }
.context-card ul { margin: 10px 0 0; padding-left: 18px; }
.context-card li { margin-bottom: 6px; font-size: 0.95rem; }

.section-phrases { margin-top: 48px; }
.phrase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.phrase-group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.phrase-group h3 { margin-top: 0; font-size: 1rem; color: var(--accent-3); }
.phrase-group ul { margin: 10px 0 0; padding-left: 18px; }
.phrase-group li { margin-bottom: 8px; font-size: 0.95rem; font-style: italic; }

.section-check { margin-top: 48px; }
.check-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.check-form fieldset { border: none; padding: 0; margin: 0; }
.check-form legend { font-weight: 600; margin-bottom: 8px; font-size: 0.95rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: 12px; }
.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
}
.radio-row input { accent-color: var(--accent-3); }

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--accent-3);
  color: #fff;
}
.btn-primary:hover { background: #3a5763; }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); }

.check-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  min-height: 40px;
}
.check-result.ok { background: var(--safe-bg); border-color: var(--safe-ink); color: var(--safe-ink); }
.check-result.warn { background: #fbf2e6; border-color: var(--accent-1); color: #6b4a2a; }
.check-result.bad { background: var(--avoid-bg); border-color: var(--avoid-ink); color: var(--avoid-ink); }

.section-save { margin-top: 48px; }
.save-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.save-form { display: flex; flex-direction: column; gap: 10px; }
.save-form label { font-weight: 600; font-size: 0.95rem; }
.save-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
.save-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.save-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.save-list h3 { margin-top: 0; font-size: 1rem; }
#notesList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
#notesList li {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
#notesList li.empty { background: transparent; border: none; color: var(--ink-mute); font-style: italic; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.note-delete {
  background: transparent;
  border: none;
  color: var(--avoid-ink);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.note-delete:hover { background: var(--avoid-bg); }

.section-about, .section-print { margin-top: 48px; }
.about-content p { max-width: 720px; }
.about-content .meta { color: var(--ink-mute); font-size: 0.85rem; margin-top: 16px; }
.print-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

.site-footer {
  margin-top: 64px;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding: 32px var(--pad) 16px;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-inner p { margin: 4px 0 0; color: var(--ink-mute); font-size: 0.9rem; }
.footer-inner nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: start; }
.fineprint {
  max-width: var(--max);
  margin: 16px auto 0;
  color: var(--ink-mute);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .level-body { grid-template-columns: 1fr; }
  .save-grid { grid-template-columns: 1fr; }
  .section-head h1 { font-size: 1.6rem; }
  .section-head h2 { font-size: 1.35rem; }
}

@media (max-width: 600px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .site-nav { gap: 8px; }
  .site-nav a { padding: 4px 8px; font-size: 0.9rem; }
  .radio-row { flex-direction: column; }
  .save-actions { flex-direction: column; }
  .save-actions button { width: 100%; }
  .print-actions { flex-direction: column; }
  .print-actions button { width: 100%; }
}

@media print {
  .site-header, .sidebar, .section-check, .section-save, .section-print, .site-footer, .save-actions, .print-actions, #adsense-slot {
    display: none;
  }
  .layout { display: block; }
  .level-card, .context-card, .phrase-group { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; color: #000; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
