:root {
  --bg: #ffffff; --text: #231f20; --muted: #5a616b; --line: #e3e6ea;
  --accent: #00674c; --card: #eef5f2; --ar: #00674c; --ar-text: #ffffff;
}
/* Dark colours: follow the device unless the reader picks a mode with the toggle (saved in localStorage). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121417; --text: #eef0f3; --muted: #a9b0b9; --line: #2a2e34;
    --accent: #5cc49d; --card: #18211e; --ar: #5cc49d; --ar-text: #0d1117; }
}
:root[data-theme="dark"] { --bg: #121417; --text: #eef0f3; --muted: #a9b0b9; --line: #2a2e34;
    --accent: #5cc49d; --card: #18211e; --ar: #5cc49d; --ar-text: #0d1117; }
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif; }
.bar { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line); }
.logo { height: 56px; width: auto; display: block; background: #fff; border-radius: 6px; padding: 3px 5px; box-sizing: content-box; }
.bar-left { display: flex; gap: 8px; align-items: center; }
.theme { font: inherit; font-size: 15px; color: var(--accent); background: transparent; cursor: pointer;
  padding: 8px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 999px; }
.lang { font-size: 15px; color: var(--accent); text-decoration: none; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 999px; }
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 48px; }
h1 { font-size: 1.45rem; line-height: 1.3; margin: 16px 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 6px; }
section { padding: 18px 0; border-top: 1px solid var(--line); }
model-viewer { width: 100%; height: 58vh; min-height: 320px; max-height: 560px;
  background: var(--card); border-radius: 14px; --poster-color: transparent; }
.ar-btn { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: var(--ar); color: var(--ar-text); border: 0; border-radius: 999px;
  padding: 14px 22px; font: 600 16px/1 inherit; min-height: 48px; white-space: nowrap; }
.progress { position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress.done { opacity: 0; transition: opacity .4s; }
.hint { color: var(--muted); font-size: 15px; margin: 8px 0 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 8px 0 12px; font-size: 15px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  margin-right: 6px; vertical-align: -2px; border: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.stats div { background: var(--card); border-radius: 12px; padding: 12px; }
.stats strong { display: block; font-size: 1.2rem; }
.stats span { font-size: 14px; color: var(--muted); }
.small { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
a { color: var(--accent); }
ul { padding-left: 1.2em; }
.disclaimer { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.hotspot { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #fff; padding: 0;
  background: var(--ar); color: var(--ar-text); font: 700 18px/40px system-ui, sans-serif;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; position: relative; }
.hotspot:not([data-visible]), model-viewer.playing .hotspot { opacity: 0; pointer-events: none; }
model-viewer.labels-off .hotspot { display: none; }
.hotspot .note { display: none; }
.hotspot .label { display: none; position: absolute; left: 50%; top: 34px; transform: translateX(-50%);
  background: rgba(20,22,26,.92); color: #fff; border-radius: 8px; padding: 6px 10px;
  font: 600 14px/1.3 system-ui, -apple-system, "Hiragino Sans", sans-serif; white-space: nowrap; }
.hotspot.open { background: #fff; color: #00674c; border-color: var(--accent); transform: scale(1.15); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.controls button { flex: 1 1 auto; min-height: 44px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: 600 15px/1.2 inherit; cursor: pointer; }
.controls button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.controls .play { flex-basis: 100%; background: var(--ar); color: var(--ar-text); border: 0; }
.cite { font-size: .7em; line-height: 0; margin-left: 1px; }
.cite a { text-decoration: none; }
.xray, .areas { margin: 12px 0; }
.areas img { width: 100%; height: auto; border-radius: 10px; display: block; background: #fff; }
.areas figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.xray img { width: 100%; height: auto; border-radius: 10px; display: block; }
.xray figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.credit { overflow-wrap: anywhere; }
.refs ol { padding-left: 1.4em; font-size: 13px; color: var(--muted); }
.refs li { margin-bottom: 6px; overflow-wrap: anywhere; }
.problem { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; color: var(--text); font-size: 16px; }
.info { background: var(--card); border-radius: 12px; padding: 8px 12px; margin: 8px 0 0; border-left: 4px solid var(--accent); cursor: pointer; }
.info[hidden] { display: none; }
.info h3 { font-size: 1rem; margin: 0 0 4px; }
.info .num { display: inline-block; width: 24px; height: 24px; line-height: 24px; border-radius: 50%; text-align: center;
  background: var(--ar); color: var(--ar-text); font-size: 13px; margin-right: 8px; }
.info ul { margin: 0; font-size: 14px; line-height: 1.45; }
.ar-more { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.ar-more[hidden] { display: none; }
.ar-more button { flex: 1 1 auto; min-height: 44px; padding: 8px 12px; border-radius: 999px; border: 0;
  background: var(--ar); color: var(--ar-text); font: 600 15px/1.2 inherit; cursor: pointer; }
/* Justified text, as asked. Hyphens help English lines not to stretch too much on phones. */
main p, main li, figcaption { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
main ul, main ol, .info, .info li, .refs li { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.controls, .ar-more { text-align: left; hyphens: manual; -webkit-hyphens: manual; }
.important { background: #fff7e0; border: 2px solid #d9a400; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.important h2 { color: #6b4e00; }
.important p { margin: 0; color: #231f20; }

/* Caption for the current step of the animation. */
.anim-step { position: absolute; left: 10px; right: 10px; top: 10px; margin: 0; padding: 6px 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-weight: 600; text-align: left; pointer-events: none; }
