:root {
  color-scheme: light;
  --paper: #f4eee2;
  --card: #fffaf1;
  --ink: #29231d;
  --muted: #63594f;
  --line: #d9cbbc;
  --accent: #872f26;
  --serif: "Songti SC", "Noto Serif CJK SC", Baskerville, Georgia, serif;
  --sans: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 1rem/1.65 var(--sans);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
:focus-visible, .button:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; }
.bar, main, footer { width: min(calc(100% - 2rem), 43rem); margin-inline: auto; }
.bar {
  min-height: 4.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1rem;
  border-bottom: 1px solid var(--line);
}
.brand { font: 700 1.2rem var(--serif); color: var(--ink); margin-right: auto; text-decoration: none; }
.back, nav, footer { font-size: .85rem; }
nav { display: flex; gap: .5rem; }
nav a { text-decoration: none; padding: .4rem .3rem; }
nav [aria-current="page"] { text-decoration: underline; text-underline-offset: .3em; font-weight: 700; }
.intro { max-width: 36rem; padding: clamp(2rem, 7vw, 3.75rem) 0 1.4rem; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.18; margin: 0; }
h1 { font-size: clamp(2.15rem, 7vw, 3.95rem); letter-spacing: -.025em; }
.intro p { max-width: 46ch; margin: .85rem 0 0; color: var(--muted); }
.card {
  padding: clamp(1.1rem, 4vw, 2rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
}
.instructions { max-width: 48ch; margin: 0 0 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.button {
  position: relative;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .57rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--accent); color: white; }
.button input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.button:has(input:disabled) { opacity: .65; }
.privacy, figcaption, .clear { font-size: .86rem; }
.privacy { color: var(--muted); margin: .75rem 0 0; }
#status, #error { margin: .75rem 0 0; }
#status:empty, #error:empty { margin: 0; }
#error { color: var(--accent); font-weight: 650; }
figure { width: fit-content; max-width: 100%; margin: 1.2rem 0 0; }
canvas { display: block; max-width: 100%; width: auto; height: auto; max-height: 29rem; object-fit: contain; border-radius: 4px; }
figcaption { color: var(--muted); margin-top: .45rem; }
figcaption small { display: block; margin-top: .2rem; }
figcaption input { accent-color: var(--accent); }
.clear { font-family: inherit; color: var(--accent); background: none; border: 0; padding: .65rem 0 0; text-decoration: underline; cursor: pointer; }
.reading { margin-top: 1.05rem; }
.reading h2 { font-size: 1.5rem; }
.reading .method { color: var(--muted); font-size: .85rem; }
#element-name { color: var(--accent); margin-top: .55rem; font-size: clamp(1.55rem, 6vw, 2.4rem); }
.reading p { margin: .5rem 0; }
.measurement-title { font-size: 1.22rem; margin-top: 1.35rem; }
dl { margin: .55rem 0 0; }
dl div { padding: .75rem 0; border-top: 1px solid var(--line); }
dt { font-size: .86rem; color: var(--muted); }
dd { margin: .1rem 0 0; }
.next { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem 1rem; margin-top: 1rem; }
.next p { margin: 0; }
footer {
  padding: 1rem 0 2rem;
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
footer p { margin: 0; }
@media (max-width: 31rem) {
  .actions .button { flex: 1 1 11rem; }
}

figcaption label { display: inline-block; margin-inline-end: 1rem; }
#photo.editing { cursor: crosshair; }
.line-editor { margin-top: .8rem; }
.line-editor p { margin: .2rem 0 .7rem; }
.line-editor button:disabled { opacity: .55; cursor: default; }
.line-panel { border-top: 1px solid var(--line); padding: .95rem 0; }
.line-panel h3 { display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; }
.line-panel h3::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: currentColor; }
.line-heart h3 { color: #ad2839; }
.line-head h3 { color: #2055a1; }
.line-life h3 { color: #246949; }
.line-fate h3 { color: #795aad; }
.line-panel .line-source, .line-panel .line-empty { font-size: .87rem; color: var(--muted); }
.line-panel button { min-height: 44px; }
.line-panel .actions { gap: .45rem; }
.line-panel .action-link { border: 0; background: none; color: var(--accent); text-decoration: underline; font: inherit; font-size: .87rem; cursor: pointer; padding: 0 .45rem 0 0; }
.line-panel .action-link[aria-pressed="true"] { font-weight: 700; }
.shape-reading { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.shape-reading summary { color: var(--accent); cursor: pointer; font-weight: 650; min-height: 44px; }
.measurement-title { line-height: 1.3; margin-bottom: .25rem; }
