:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #f1eadc;
  --ink: #212933;
  --muted: #6d6a63;
  --line: #e2d8c8;
  --accent: #b23a2b;
  --accent-dark: #8c2b20;
  --accent-soft: #f4e2dc;
  --gold: #a9853e;
  --green: #4d6b52;
  --shadow: 0 18px 50px rgba(61, 46, 25, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  overflow-x: clip;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.9), transparent 38rem),
    radial-gradient(circle at 88% 12%, rgba(240, 227, 205, 0.55), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "YuGothic",
    "Noto Sans JP", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.015em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
ol,
ul {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.9rem, 4.6vw, 2.5rem);
  margin-bottom: 1rem;
  overflow-wrap: break-word;
  line-break: strict;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin-bottom: 0.8rem;
}

h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
}

.wrap {
  width: min(1080px, calc(100% - 40px));
  margin-inline: auto;
}

.page {
  width: min(760px, calc(100% - 40px));
  padding: 56px 0 80px;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 0.78rem;
}

.eyebrow {
  margin-bottom: 0.6rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lead {
  font-size: 1.06rem;
  color: #4a4a45;
  max-width: 38rem;
}

/* Header */

.site-header {
  border-bottom: 1px solid rgba(226, 216, 200, 0.7);
  background: rgba(247, 243, 234, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 0.86rem;
}

.site-nav a {
  color: #4b4b46;
  border-bottom: 1px solid transparent;
  padding: 0.2rem 0;
}

.site-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.66rem;
  line-height: 1;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 3px solid rgba(178, 58, 43, 0.3);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(178, 58, 43, 0.22);
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--gold);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: #4b4b46;
}

.btn-ghost:hover {
  border-color: var(--gold);
  background: rgba(255, 253, 248, 0.7);
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding: clamp(3.5rem, 8vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
  min-width: 0;
}

.hero-copy,
.hero-visual {
  min-width: 0;
}

.hero h1 {
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 2rem 0 1rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.palace {
  width: min(100%, 360px);
  padding: 1.6rem 1.5rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 28px 28px 28px 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(246, 238, 223, 0.9)),
    var(--surface);
  box-shadow: var(--shadow);
  position: relative;
}

.palace::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(169, 133, 62, 0.18);
  border-radius: 22px 22px 22px 5px;
  pointer-events: none;
}

.palace-label {
  display: inline-block;
  margin-bottom: 1.1rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.loci-path {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.2rem;
  border-left: 1px dashed rgba(169, 133, 62, 0.45);
}

.loci-path li {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.48rem 0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: 1.02rem;
}

.loci-path li::before {
  content: "";
  position: absolute;
  left: -1.45rem;
  top: 0.95rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(178, 58, 43, 0.12);
}

.loci-path li span {
  color: var(--gold);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.palace-note {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.75;
}

/* Sections */

.section {
  padding: 2.5rem 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
  margin-top: 1.6rem;
}

.step {
  padding: 1.5rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.62);
}

.step-num {
  display: block;
  margin-bottom: 0.9rem;
  color: var(--gold);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.step p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.sample-card {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 2rem;
  padding: clamp(1.5rem, 4vw, 2.6rem);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.term-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.term-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.term-list li:last-child {
  border-bottom: none;
}

.term-list strong {
  display: block;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-weight: 600;
}

.term-list span {
  color: var(--muted);
  font-size: 0.82rem;
}

.science {
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(255, 253, 248, 0.9), rgba(255, 253, 248, 0.35));
  border-radius: 0 var(--radius) var(--radius) 0;
}

.science p {
  max-width: 44rem;
}

.cta {
  margin: 3rem auto 1rem;
  padding: clamp(2rem, 5vw, 3.4rem);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 80% 0%, rgba(178, 58, 43, 0.1), transparent 20rem),
    var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: var(--shadow);
}

.cta p {
  color: var(--muted);
  margin-bottom: 1.4rem;
}

/* Forms and onboarding */

.notice {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: #7e2d23;
  font-size: 0.86rem;
}

.error {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #fbe9e6;
  color: #8c2b20;
  font-size: 0.86rem;
}

.template-grid {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.template-card {
  display: block;
  cursor: pointer;
}

.template-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.template-body {
  display: block;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.7);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.template-card input:checked + .template-body {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(178, 58, 43, 0.1);
}

.template-card input:focus-visible + .template-body {
  outline: 3px solid rgba(178, 58, 43, 0.3);
  outline-offset: 3px;
}

.template-name {
  display: block;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.template-desc {
  display: block;
  margin: 0.3rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.template-loci {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.template-loci span {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: #55524b;
  font-size: 0.72rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

/* Dashboard */

.app-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.app-head h1 {
  margin-bottom: 0.2rem;
}

.streak {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}

.streak span {
  color: var(--accent);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.streak small {
  color: var(--muted);
  font-size: 0.72rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.panel {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.7);
  margin-bottom: 1rem;
}

.today-panel {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 1.4rem;
}

.panel p:last-child {
  margin-bottom: 0;
}

.score-line {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 2.5rem;
  line-height: 1.2;
  color: var(--accent);
  margin: 0.4rem 0;
}

.score-line span {
  font-size: 1.1rem;
  color: var(--muted);
}

.big-number {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 2.6rem;
  line-height: 1.2;
  color: var(--accent);
  margin: 0.3rem 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

.stats-row div {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.55);
  text-align: center;
}

.stats-row span {
  display: block;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.9rem;
  line-height: 1.2;
}

.stats-row small {
  color: var(--muted);
  font-size: 0.74rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.text-link {
  color: var(--accent);
  font-size: 0.82rem;
  border-bottom: 1px solid transparent;
}

.text-link:hover {
  border-color: var(--accent);
}

.loci-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 1.5rem;
}

.loci-list li {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(226, 216, 200, 0.6);
  font-size: 0.9rem;
}

.loci-list li span {
  color: var(--gold);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.68rem;
}

/* Challenge */

.challenge-page {
  padding-top: 40px;
}

.challenge-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.challenge-head h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.progress {
  height: 4px;
  margin-bottom: 2rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.challenge-card {
  padding: clamp(1.6rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}

.challenge-card h2 {
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  margin-bottom: 0.8rem;
}

.phase-label {
  margin-bottom: 0.8rem;
  color: var(--gold);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
}

.locus-name {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.82rem;
}

.meaning {
  color: #4f4c46;
  font-size: 1rem;
}

.hint {
  margin: 1.6rem 0;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.choices {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.choice {
  width: 100%;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.choice:hover:not(:disabled) {
  border-color: var(--gold);
  transform: translateX(2px);
}

.choice:disabled {
  cursor: default;
}

.choice.correct {
  border-color: var(--green);
  background: #edf3ed;
}

.choice.wrong {
  border-color: var(--accent);
  background: #fbece8;
}

.feedback {
  min-height: 1.6rem;
  margin: 1rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.empty-state {
  padding: 3rem 0;
  text-align: center;
}

.empty-state .btn {
  margin: 0.3rem;
}

/* Result */

.result-page {
  text-align: center;
  padding-top: 70px;
}

.result-page h1 {
  max-width: 24rem;
  margin-inline: auto;
}

.result-score {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  color: var(--accent);
  line-height: 1;
  margin: 1.6rem 0 0.8rem;
}

.result-score span {
  font-size: clamp(4rem, 14vw, 7rem);
}

.result-score small {
  font-size: 1.4rem;
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin: 2rem 0 2.5rem;
}

.share {
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.share .btn {
  margin: 0.2rem;
}

/* Review */

.review-card {
  margin-top: 1.5rem;
  padding: clamp(1.6rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}

.review-card h2 {
  margin-top: 1.6rem;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1.8rem;
}

.grade {
  min-height: 48px;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.grade:hover {
  border-color: var(--gold);
}

.grade-again {
  color: #8c2b20;
}

.grade-hard {
  color: #8a6120;
}

.grade-good {
  color: var(--green);
}

.grade-easy {
  color: #3c5d8a;
}

/* Import */

.import-form {
  margin-top: 1.5rem;
}

textarea {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.7;
  resize: vertical;
}

textarea:focus {
  outline: 3px solid rgba(178, 58, 43, 0.15);
  border-color: var(--accent);
}

.import-form .btn {
  margin-top: 0.8rem;
}

/* Footer */

.site-footer {
  margin-top: 2rem;
  padding: 2.2rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-brand {
  margin-bottom: 0.2rem;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  color: var(--ink);
}

.site-footer a {
  border-bottom: 1px solid var(--line);
}

.site-footer a:hover {
  border-color: var(--accent);
}

/* Motion */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 3rem;
  }

  .hero-visual {
    order: -1;
  }

  .palace {
    width: min(100%, 420px);
  }

  .steps,
  .sample-card,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .wrap,
  .page {
    width: min(100% - 28px, 1080px);
  }

  .page {
    padding-top: 36px;
  }

  .header-inner {
    min-height: 60px;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 7vw, 2.5rem);
  }

  .site-nav {
    gap: 0.8rem;
    font-size: 0.8rem;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .app-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .loci-list {
    grid-template-columns: 1fr;
  }

  .grade-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-actions .btn,
  .share .btn {
    width: 100%;
  }
}

/* Blog and article */

img {
  max-width: 100%;
  height: auto;
}

.blog-hero {
  padding: clamp(3rem, 7vw, 5.5rem) 0 2rem;
}

.blog-hero h1 {
  max-width: 20em;
}

.blog-featured {
  padding: 1rem 0 2rem;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 60px rgba(61, 46, 25, 0.12);
}

.featured-media,
.post-media {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}

.featured-media {
  min-height: 320px;
}

.featured-media img,
.post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-media img {
  position: absolute;
  inset: 0;
}

.featured-body {
  padding: clamp(1.6rem, 4vw, 3rem);
  align-self: center;
}

.featured-body h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  margin-bottom: 0.7rem;
  text-wrap: balance;
}

.featured-body p {
  color: var(--muted);
  font-size: 0.94rem;
}

.post-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.post-meta {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  padding: 1rem 0 2rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.75);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.post-media {
  aspect-ratio: 16 / 10;
}

.post-body {
  padding: 1.3rem 1.4rem 1.5rem;
}

.post-body h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  text-wrap: balance;
}

.post-body p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.9rem;
}

.blog-note {
  padding: 2rem 0;
}

.note-inner {
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.9), rgba(240, 230, 212, 0.5));
}

.note-inner p {
  color: var(--muted);
  font-size: 0.9rem;
}

.blog-teaser {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.blog-teaser img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  display: block;
}

.blog-teaser-body {
  padding: clamp(1.6rem, 4vw, 2.8rem);
  align-self: center;
}

.blog-teaser-body p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Article */

.article-page {
  width: min(860px, calc(100% - 40px));
  padding: 40px 0 80px;
}

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.breadcrumb a {
  border-bottom: 1px solid var(--line);
}

.breadcrumb a:hover {
  border-color: var(--accent);
}

.article-header h1 {
  max-width: 22em;
  font-size: clamp(2rem, 4.8vw, 2.8rem);
}

.article-header .lead {
  margin-top: 1rem;
}

.article-hero {
  margin: 2rem 0 2.5rem;
}

.article-hero img {
  width: 100%;
  max-height: 560px;
  object-fit: cover;
  border-radius: var(--radius);
}

.article-hero figcaption,
.article-body figure figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.article-body {
  width: min(720px, 100%);
  margin-inline: auto;
  font-size: 1rem;
  line-height: 1.95;
}

.article-body h2 {
  margin: 3.2rem 0 1rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  scroll-margin-top: 90px;
}

.article-body h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.18rem;
}

.article-body p {
  margin-bottom: 1.2rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.4rem;
  padding-left: 1.4rem;
}

.article-body li {
  margin-bottom: 0.45rem;
}

.article-body strong {
  font-weight: 700;
}

.article-body a {
  color: var(--accent);
  border-bottom: 1px solid rgba(178, 58, 43, 0.35);
}

.article-body a:hover {
  border-color: var(--accent);
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figure img {
  border-radius: 14px;
  border: 1px solid var(--line);
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.4rem;
  border-left: 3px solid var(--gold);
  background: rgba(255, 253, 248, 0.7);
  color: #4b4a45;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.7;
}

.article-body th,
.article-body td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: var(--surface-2);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.article-body .table-wrap table {
  min-width: 620px;
}

.toc {
  margin: 0 0 2.2rem;
  padding: 1.3rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.7);
}

.toc-title {
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.toc ol {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem 2rem;
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.86rem;
  line-height: 1.7;
}

.toc a {
  color: #4b4a45;
  border-bottom: 1px solid transparent;
}

.toc a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.lead-box,
.example-box,
.caution-box {
  margin: 1.5rem 0 2rem;
  padding: 1.2rem 1.4rem;
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.8);
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.8;
}

.lead-box {
  border-left: 3px solid var(--gold);
}

.example-box {
  background: #f7f0e2;
}

.example-title {
  margin-bottom: 0.5rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.caution-box {
  background: #fbf1e9;
  border-color: #ead6c6;
}

.caution-box p:last-child,
.lead-box ul:last-child,
.example-box ul:last-child {
  margin-bottom: 0;
}

.book-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.5rem 0 1.8rem;
}

.book-card {
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.book-label {
  margin-bottom: 0.35rem;
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.book-title {
  margin-bottom: 0.2rem;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
}

.book-meta {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.book-note {
  margin-bottom: 0.5rem;
  color: #4b4a45;
  font-size: 0.86rem;
}

.ref-list {
  margin: 1.5rem 0 2rem;
  padding-left: 1.2rem;
  font-size: 0.84rem;
  line-height: 1.8;
}

.ref-title {
  margin-bottom: 0.5rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.faq {
  margin-top: 1rem;
}

.faq details {
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.faq summary::marker {
  color: var(--accent);
}

.faq details p {
  margin: 0.7rem 0 0;
  color: #4b4a45;
  font-size: 0.9rem;
}

.article-end {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.05rem;
  color: #4b4a45;
}

.article-cta {
  margin: 3rem 0;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 85% 0%, rgba(178, 58, 43, 0.1), transparent 18rem),
    var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.article-cta p {
  color: var(--muted);
}

.related {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.article-credit {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.article-credit a {
  border-bottom: 1px solid var(--line);
}

.credit-list {
  list-style: none;
  margin: 2rem 0;
  padding: 0;
}

.credit-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  color: #4b4a45;
  font-size: 0.9rem;
}

.credit-list a {
  color: var(--accent);
  border-bottom: 1px solid rgba(178, 58, 43, 0.35);
}

.credits-page {
  width: min(760px, calc(100% - 40px));
}

@media (max-width: 860px) {
  .featured-card,
  .blog-teaser {
    grid-template-columns: 1fr;
  }

  .featured-media {
    min-height: 260px;
    aspect-ratio: 16 / 9;
  }

  .featured-media img {
    position: static;
  }

  .blog-teaser img {
    min-height: 220px;
    max-height: 300px;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .toc ol {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .article-page {
    width: min(100% - 28px, 860px);
    padding-top: 24px;
  }

  .article-header h1 {
    font-size: 1.8rem;
  }

  .article-body {
    font-size: 0.96rem;
    line-height: 1.9;
  }

  .featured-body,
  .post-body {
    padding: 1.2rem;
  }

  .article-body .table-wrap table {
    min-width: 540px;
  }
}

/* Auth and account */

.guest-banner {
  margin: 1.2rem 0 1.8rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid #e6cdb8;
  border-radius: 12px;
  background: #fbf1e9;
  color: #6b4a32;
  font-size: 0.86rem;
  line-height: 1.8;
}

.guest-banner a {
  color: var(--accent);
  font-weight: 700;
  margin-left: 0.3rem;
  border-bottom: 1px solid rgba(178, 58, 43, 0.35);
}

.auth-page {
  display: flex;
  justify-content: center;
  padding-top: 56px;
}

.auth-card {
  width: min(440px, 100%);
  padding: clamp(1.6rem, 5vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-card .lead {
  font-size: 0.9rem;
}

.auth-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.4rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
  color: #4b4a45;
  font-size: 0.8rem;
  font-weight: 600;
}

.form-field input {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 400;
}

.form-field input:focus {
  outline: 3px solid rgba(178, 58, 43, 0.15);
  border-color: var(--accent);
}

.auth-submit {
  width: 100%;
  margin-top: 0.3rem;
}

.auth-alt {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.auth-alt a,
.tiny a {
  color: var(--accent);
  border-bottom: 1px solid rgba(178, 58, 43, 0.35);
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.account-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
  margin: 0.8rem 0 0;
  font-size: 0.9rem;
}

.account-list dt {
  color: var(--muted);
}

.account-list dd {
  margin: 0;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-top: 0.8rem;
  text-align: center;
}

.account-stats span {
  display: block;
  color: var(--accent);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.7rem;
  line-height: 1.2;
}

.account-stats small {
  color: var(--muted);
  font-size: 0.7rem;
}

@media (max-width: 560px) {
  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Palace editor and locus photos */

.panel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: flex-end;
}

.palace-page {
  width: min(860px, calc(100% - 40px));
}

.palace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.palace-head h1 {
  margin-bottom: 0.2rem;
}

.imagery-guide,
.add-spot-section {
  margin: 1.5rem 0 2rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
}

.imagery-guide h2,
.add-spot-section h2 {
  font-size: 1.35rem;
}

.imagery-guide ul {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  color: #4b4a45;
  font-size: 0.88rem;
  line-height: 1.8;
}

.imagery-guide li {
  margin-bottom: 0.35rem;
}

.spot-section {
  margin: 1.5rem 0;
}

.spot-list {
  margin-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.spot-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.spot-photo {
  width: 104px;
  height: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}

.spot-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spot-placeholder {
  color: var(--gold);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.3rem;
}

.spot-main {
  min-width: 0;
}

.spot-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.spot-title span {
  color: var(--gold);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.68rem;
}

.spot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.spot-actions form {
  margin: 0;
}

.photo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}

.file-button input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-button:hover {
  border-color: var(--gold);
}

.btn-small {
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.74rem;
  box-shadow: none;
}

.btn-icon {
  min-width: 38px;
  padding-inline: 0.55rem;
}

.btn-danger {
  border-color: #e3c3bd;
  color: #8c2b20;
  background: #fdf4f2;
}

.btn-danger:hover {
  border-color: var(--accent);
  background: #fbe9e6;
}

.add-spot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.8rem;
  margin-top: 1rem;
}

.add-spot .form-field {
  flex: 1 1 260px;
}

.add-spot .btn {
  flex: 0 0 auto;
}

.locus-photo[hidden] {
  display: none;
}

.locus-photo {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.example-hint {
  margin: 0.2rem 0 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--gold);
  background: rgba(169, 133, 62, 0.08);
  color: #5b513d;
  font-size: 0.84rem;
  line-height: 1.7;
}

@media (max-width: 560px) {
  .palace-page {
    width: min(100% - 28px, 860px);
  }

  .palace-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .spot-row {
    grid-template-columns: 84px 1fr;
    gap: 0.8rem;
  }

  .spot-photo {
    width: 84px;
    height: 76px;
  }

  .spot-actions {
    gap: 0.35rem;
  }

  .file-button {
    font-size: 0.7rem;
  }

  .panel-links {
    justify-content: flex-start;
  }
}
