:root {
  color-scheme: light dark;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #f5f4ed;
  --surface: #fdfcf7;
  --ink: #222c25;
  --muted: #4d5d51;
  --line: #cbd2c6;
  --accent: #245f47;
  --button: #245f47;
  --button-ink: #fffdf5;
  --tint: #e1ead7;
  --warning: #8a3d2c;
  --warning-surface: #faece2;
  --sheet: #fbfaf3;
  --ruling: #d0dccc;
  background: var(--paper);
  color: var(--ink);
}

html[lang="ja"], .language [lang="ja"] { font-family: "Pretendard JP Variable", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif; }

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171c19;
    --surface: #1e2621;
    --ink: #e9eee6;
    --muted: #bccbbd;
    --line: #495950;
    --accent: #aee2c1;
    --button: #aee2c1;
    --button-ink: #153327;
    --tint: #253a30;
    --warning: #ffc6ad;
    --warning-surface: #392820;
    --sheet: #2e3c34;
    --ruling: #586e61;
  }
}

.language [lang="ko"] { font-family: "Pretendard Variable", Pretendard, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-inline-size: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
p { line-height: 1.55; }
a { color: var(--accent); text-underline-offset: .2em; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: .68; }
button, input, a { -webkit-tap-highlight-color: color-mix(in srgb, var(--accent), transparent 82%); }
h1, h2, h3, dd { overflow-wrap: anywhere; }
.skip { position: absolute; z-index: 2; top: .8rem; left: 1rem; padding: .75rem; background: var(--surface); transform: translateY(-160%); }
.skip:focus { transform: none; }

.top { border-bottom: 1px solid var(--line); }
.top-inner {
  max-width: 72rem;
  margin-inline: auto;
  padding: .72rem clamp(.9rem, 4vw, 2.4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 740; }
.brand a { color: var(--ink); text-decoration: none; min-height: 42px; display: inline-flex; align-items: center; }
.brand-name { border-left: 1px solid var(--line); padding-left: .7rem; }
.language { display: flex; gap: .1rem; flex-wrap: wrap; }
.language a { color: var(--muted); font-size: .85rem; padding: .75rem .47rem; text-decoration: none; }
.language [aria-current] { color: var(--accent); font-weight: 750; text-decoration: underline; }

.home { width: min(100% - clamp(1.8rem, 8vw, 4.8rem), 58rem); margin: clamp(2.2rem, 7vw, 6rem) auto 5rem; }
.hero { display: grid; grid-template-columns: 1fr minmax(10rem, .48fr); align-items: center; gap: 1.5rem; padding-bottom: clamp(1.7rem, 4vw, 3.2rem); }
.intro h1 { font-size: clamp(2.4rem, 5.2vw, 4.15rem); line-height: 1.06; font-weight: 760; letter-spacing: -.055em; white-space: pre-line; margin: 0; word-break: keep-all; }
.intro p { color: var(--muted); font-size: clamp(1rem, 2.3vw, 1.23rem); max-width: 32rem; margin: 1.15rem 0 0; word-break: keep-all; }
.illustration {
  position: relative;
  min-height: 10rem;
  height: 100%;
  max-height: 13.5rem;
  border-radius: 50%;
  isolation: isolate;
  display: grid;
  place-items: center;
}
.illustration::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(90%, 14rem);
  aspect-ratio: 1.35;
  border-radius: 50%;
  background: var(--tint);
}
.sheet {
  grid-area: 1/1;
  width: clamp(5.1rem, 13vw, 7.9rem);
  aspect-ratio: .82;
  background: var(--sheet);
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 60%);
  border-radius: .45rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .9rem .8rem;
  box-shadow: 0 8px 20px rgb(15 41 28 / .08);
}
.sheet-back { transform: translate(-26%, 4%) rotate(-15deg); }
.sheet-front { transform: translate(23%, -5%) rotate(10deg); }
.sheet i, .sheet b { display: block; height: .23rem; border-radius: 1rem; background: var(--ruling); }
.sheet i:nth-of-type(2n) { width: 76%; }
.sheet b { width: 56%; height: .7rem; margin-bottom: .28rem; background: var(--accent); }

.workspace, .result { padding: clamp(1rem, 4vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: 1.15rem; }
form label { display: block; font-weight: 720; margin-bottom: .55rem; }
.form-row, .secret-row { display: flex; gap: .65rem; align-items: stretch; }
input {
  min-width: 0;
  flex: 1;
  font-size: 16px;
  min-height: 52px;
  padding: .7rem .9rem;
  border-radius: .6rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
input::placeholder { color: var(--muted); opacity: 1; }
[aria-invalid="true"] { border-color: var(--warning); }
.primary, .quiet { font-weight: 720; border-radius: .6rem; min-height: 44px; padding: .65rem .95rem; }
.primary { border: 1px solid var(--button); background: var(--button); color: var(--button-ink); min-height: 52px; }
.primary:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--button-ink); }
.quiet { background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.quiet:hover { border-color: var(--accent); }
.notes { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: .9rem; color: var(--muted); font-size: .92rem; }
.notes p { margin: 0; }
.notes p + p { margin-top: .35rem; }
.error { color: var(--warning); font-weight: 650; }
.progress { color: var(--accent); }
.progress:not(:empty)::before {
  content: ""; display: inline-block; width: .75rem; height: .75rem; margin-right: .5rem;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 100%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .progress:not(:empty)::before { animation: none; } }
[role="status"], [role="alert"] { margin: 0; }
[role="status"]:not(:empty), [role="alert"]:not(:empty) { margin-top: .6rem; }

.result { margin-top: 1rem; }
.result-status { color: var(--accent); font-weight: 750; margin: 0; }
.result h2 { font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.2; letter-spacing: -.025em; margin: .5rem 0; }
.source-info { display: grid; gap: .25rem; color: var(--muted); }
.dates { display: flex; flex-wrap: wrap; gap: .65rem 1.75rem; color: var(--muted); }
.dates dt { font-weight: 700; font-size: .81rem; }
.dates dd { margin: .25rem 0 0; font-variant-numeric: tabular-nums; }
.outputs { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.outputs li { display: grid; grid-template-columns: minmax(5.5rem, 8rem) minmax(0, 1fr) auto; align-items: center; gap: .55rem; border-bottom: 1px solid var(--line); padding: .5rem 0; }
.format-name { font-weight: 710; }
.secret { background: var(--warning-surface); border: 1px solid color-mix(in srgb, var(--warning), transparent 60%); margin-top: 1.4rem; padding: 1rem; border-radius: .7rem; }
.secret h3 { color: var(--warning); margin: 0; }
.secret p { margin-block: .45rem; }
.secret-row { justify-content: space-between; align-items: center; }
.secret a { color: var(--warning); }

.reading { width: min(100% - clamp(1.8rem, 8vw, 4rem), 46rem); margin: clamp(1.5rem, 5vw, 4rem) auto; }
.provenance { padding: .8rem 1rem; border-left: 3px solid var(--accent); background: var(--tint); color: var(--muted); }
.provenance p { margin: 0 0 .3rem; }
.provenance strong { color: var(--ink); margin-right: .35rem; }
.provenance details { margin-top: .5rem; }
.provenance summary { cursor: pointer; }
.article-header { margin: 2rem 0 1.5rem; }
.article-header h1, .message h1 { font-size: clamp(1.9rem, 5.5vw, 3.3rem); line-height: 1.14; letter-spacing: -.035em; margin: 0 0 .75rem; }
.article-header p { color: var(--muted); font-size: 1.12rem; }
.article-body { font: 1.08rem/1.75 Georgia, "Noto Serif CJK KR", "Noto Serif CJK JP", serif; overflow-wrap: anywhere; }
.article-body p { line-height: inherit; margin: 0 0 1em; }
.article-body h2, .article-body h3, .article-body h4 { line-height: 1.3; margin: 1.5em 0 .55em; }
.article-body blockquote { border-left: 3px solid var(--line); color: var(--muted); margin: 1rem 0; padding-left: 1rem; }
.article-body img { display: block; max-width: 100%; height: auto; margin: 1rem auto; }
.article-body pre, .article-body table { max-width: 100%; overflow-x: auto; }
.article-body pre, .image-fallback { display: block; background: var(--surface); padding: .75rem; border: 1px solid var(--line); border-radius: .5rem; }
.article-body table { display: block; border-collapse: collapse; }
.article-body td, .article-body th { border: 1px solid var(--line); padding: .35rem .6rem; }
.article-body a { overflow-wrap: anywhere; }
.article-footer { border-top: 1px solid var(--line); padding: .5rem 0 1rem; margin-top: 2.5rem; }
.article-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.message form { margin: 1.5rem 0; }
.danger { color: var(--warning); background: var(--warning-surface); border-color: var(--warning); }

@media (max-width: 560px) {
  .hero { display: block; position: relative; }
  .illustration { display: none; }
  .form-row { flex-direction: column; }
  .outputs li { grid-template-columns: minmax(0, 1fr) auto; }
  .outputs li a { grid-row: 2; }
  .outputs li button { grid-column: 2; grid-row: 1 / 3; }
}
