/* Thin Section Scope: the Petrography Desk (a specimen view with whole/detail switching, observation notes, a
   formation-story panel after Check, and the specimen log). Art by art.js; colors from the --tss-* properties. */
html {
  --tss-accent: #46624a; --tss-ink: #1b2a20; --tss-panel1: #f5f7f2; --tss-panel2: #e8ede3; --tss-card: #ffffff;
  --tss-chip: #ffffff; --tss-chip-on: #dfe9da; --tss-chip-line: #a9b8a6; --tss-ok: #13704a; --tss-bad: #b3261e;
  --tss-wood1: #7a5536; --tss-wood2: #4f3522; --tss-note: #fffbe9; --tss-note-line: #e4d9a8;
}
html[data-theme="dark"] {
  --tss-accent: #9ccc9f; --tss-ink: #e6efe4; --tss-panel1: #1b231d; --tss-panel2: #141a16; --tss-card: #1b231d;
  --tss-chip: #161d18; --tss-chip-on: #2a3d2d; --tss-chip-line: #44544a; --tss-ok: #4fd08c; --tss-bad: #ff8a80;
  --tss-wood1: #4a3423; --tss-wood2: #2c1f15; --tss-note: #2a2717; --tss-note-line: #4b4526;
}
.tss { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 456px; gap: 12px; padding: 10px; font-size: 16px; color: var(--tlg-text, #172d38); }
.tss *, .tss *::before, .tss *::after { box-sizing: border-box; }
.tss p { margin: 0; }
.tss button, .tss select { font: inherit; }
.tss :focus-visible { outline: 3px solid #d08a00; outline-offset: 2px; }

/* scene */
.tss-scene { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; padding: 8px; border-radius: 14px; color: #f4efe6;
  background: linear-gradient(160deg, var(--tss-wood1), var(--tss-wood2)); box-shadow: inset 0 0 0 3px rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.18); overflow: hidden; }
.tss-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tss-sign { padding: 2px 12px; border-radius: 6px; background: #2e3a31; color: #e9f2e6; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: inset 0 -2px 0 rgba(0,0,0,.35); }
.tss-tag { padding: 1px 10px; border-radius: 999px; background: rgba(0,0,0,.35); font-weight: 700; }
.tss-bench { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; min-height: 0; }
.tss-scopecol { display: flex; flex-direction: column; gap: 6px; width: 344px; }
.tss-pane { width: 344px; height: 344px; border-radius: 12px; background: #0b0d0c; box-shadow: 0 4px 10px rgba(0,0,0,.45); }
.tss-pane:focus-visible { outline-offset: 3px; }
.tss-scope { display: block; width: 100%; height: 100%; border-radius: 12px; }
.tss-view-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tss-viewbtn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 4px 8px; border: 2px solid #c9d6c4; border-radius: 10px;
  background: #e9f0e5; color: #1b2a20; font-weight: 700; cursor: pointer; }
.tss-viewbtn svg { width: 20px; height: 20px; flex: none; }
.tss-viewbtn[aria-pressed="true"] { background: #2e3a31; color: #ffffff; border-color: #ffd23f; box-shadow: inset 0 0 0 2px #ffd23f; }
.tss-viewbtn:disabled { cursor: default; opacity: .8; }
.tss-view-note { line-height: 1.3; color: #f4efe6; }
.tss-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; overflow: auto; }
.tss-notes { padding: 8px 10px; border-radius: 6px; color: #2b2615; line-height: 1.3; box-shadow: 0 3px 6px rgba(0,0,0,.35);
  background: linear-gradient(175deg, var(--tss-note), var(--tss-note-line)); border-top: 6px solid rgba(182, 122, 0, .55); }
html[data-theme="dark"] .tss-notes { color: #f3ecd2; }
.tss-notes-h { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #6b4a1f; margin-bottom: 4px !important; }
html[data-theme="dark"] .tss-notes-h { color: #f1c97a; }
.tss-clue { font-weight: 700; margin-bottom: 4px !important; }
.tss-noteline + .tss-noteline { margin-top: 2px; }
.tss.is-revealed .tss-noteline:last-child { display: none; }
.tss-story { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 8px; align-items: start; padding: 6px 8px 8px; border-radius: 10px; background: #1f2a22; color: #f0f4ee; box-shadow: 0 3px 6px rgba(0,0,0,.35); animation: tssIn .4s ease both; }
.tss-story[hidden] { display: none; }
.tss-story-h { grid-column: 1 / -1; font-weight: 800; }
.tss-story-h span { font-weight: 600; opacity: .85; }
.tss-story-svg { display: block; width: 150px; height: auto; border-radius: 6px; }
.tss-story-cap { line-height: 1.25; }
.tss.is-revealed .tss-view-controls { display: none; }
.tss-about { color: #f4efe6; }
.tss-about summary { cursor: pointer; font-weight: 700; }
.tss-about p { margin-top: 4px !important; line-height: 1.35; max-width: 70ch; }

/* callouts (after Check, practice only) */
.tss-co-line { stroke: #ffd23f; stroke-width: 2.5; fill: none; }
.tss-co-ring { fill: none; stroke: #ffd23f; stroke-width: 3.5; }
.tss-co-box { fill: #fffdf3; stroke: #1b2a20; stroke-width: 2; }
.tss-co-t { font: 700 19px/1 var(--tlg-font, system-ui, sans-serif); fill: #1b2a20; }
.tss-callouts { animation: tssIn .5s ease both; }

/* story animations: every element ends in its final state (fill-mode both) */
.st-t { font: 700 19px/1 var(--tlg-font, system-ui, sans-serif); fill: #ffffff; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 3px; }
.st-grow, .st-pop { transform-box: fill-box; transform-origin: center; animation: stGrow .7s ease-out both; }
.st-pop { animation-duration: .25s; }
.st-fade { animation: tssIn .7s ease both; }
.st-out { animation: stOut .8s ease both; }
.st-drop { animation: stDrop .9s cubic-bezier(.3,.7,.4,1) both; }
.st-cool { animation: stCool 3.6s ease both; }
.st-glass { animation: stGlass 1.6s ease both; }
.st-steam { animation: stSteam 1.8s ease both; }
.st-froth { animation: stFroth 3s ease both; }
.st-glow { animation: stGlow 1.2s ease-in-out 3 alternate both; }
.st-squash { transform-box: fill-box; transform-origin: bottom; animation: stSquash 1.2s ease 2.3s both; }
.st-push-l { animation: stPushL .7s ease-in-out 3 alternate both; }
.st-push-r { animation: stPushR .7s ease-in-out 3 alternate both; }
.st-rot { transform-box: fill-box; transform-origin: center; animation: stRot 1.4s ease both; }
.st-move { animation: stMove 1.4s ease both; }
@keyframes tssIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes stOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes stGrow { from { transform: scale(.1); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes stDrop { from { transform: translateY(-80px); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes stCool { from { fill: #ff8a2a; } to { fill: #5b3a2c; } }
@keyframes stGlass { from { fill: #ff8a2a; } to { fill: #121217; } }
@keyframes stSteam { from { opacity: 0; transform: translateY(8px); } 50% { opacity: .9; } to { opacity: .35; transform: translateY(-6px); } }
@keyframes stFroth { from { fill: #ff8a2a; } to { fill: #cfcabd; } }
@keyframes stGlow { from { fill: #e2672a; } to { fill: #ffb347; } }
@keyframes stSquash { from { transform: scaleY(1.45); } to { transform: scaleY(1); } }
@keyframes stPushL { from { transform: translateX(-6px); } to { transform: translateX(4px); } }
@keyframes stPushR { from { transform: translateX(6px); } to { transform: translateX(-4px); } }
@keyframes stRot { from { transform: rotate(var(--r, 45deg)) scale(.7); } to { transform: rotate(0deg) scale(1.1); } }
@keyframes stMove { from { transform: none; } to { transform: translateY(var(--dy, 0px)); } }

/* specimen log */
.tss-log { display: flex; flex-direction: column; gap: 7px; min-height: 0; overflow: auto; padding: 8px 12px 10px; color: var(--tss-ink);
  background: linear-gradient(var(--tss-panel1), var(--tss-panel2)); border: 3px solid var(--tss-accent); border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.tss-kicker { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tss-accent); }
.tss-step { display: grid; gap: 3px; }
.tss-step-h { display: flex; align-items: center; gap: 8px; font-weight: 700; line-height: 1.2; }
.tss-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--tss-accent); color: #fff; font-weight: 800; }
html[data-theme="dark"] .tss-n { color: #10180f; }
.tss-step.is-done .tss-n { background: var(--tss-ok); }
.tss-mark { margin-left: auto; font-weight: 800; font-size: 18px; }
.tss-mark.is-ok { color: var(--tss-ok); }
.tss-mark.is-bad { color: var(--tss-bad); }
.tss-select { width: 100%; min-width: 0; min-height: 42px; padding: 6px 8px; border: 2px solid var(--tss-chip-line); border-radius: 10px; background: var(--tss-chip); color: var(--tss-ink); cursor: pointer; }
.tss-select:hover:not(:disabled) { border-color: var(--tss-accent); }
.tss-select.is-key { border-color: var(--tss-ok); box-shadow: inset 0 0 0 2px var(--tss-ok); }
.tss-select.is-wrong { border-color: var(--tss-bad); border-style: dashed; }
.tss-select:disabled { cursor: default; opacity: 1; }
.tss-key { color: var(--tss-ok); font-weight: 700; line-height: 1.25; }
.tss-key[hidden] { display: none; }
.tss-chips { display: grid; gap: 4px; }
.tss-chips--family { grid-template-columns: repeat(3, auto); justify-content: start; }
.tss-chips--family .tss-chip { padding-right: 22px; }
.tss-chips--name { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tss-chip { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; min-height: 36px; padding: 2px 16px 2px 7px; border: 2px solid var(--tss-chip-line); border-radius: 10px;
  background: var(--tss-chip); color: var(--tss-ink); line-height: 1.1; text-align: left; cursor: pointer; }
.tss-chip svg { width: 16px; height: 16px; flex: none; color: var(--tss-accent); }
.tss-chip-l { min-width: 0; }
.tss-chip:hover:not(:disabled) { border-color: var(--tss-accent); }
.tss-chip.is-on { border-color: var(--tss-accent); background: var(--tss-chip-on); font-weight: 700; box-shadow: inset 0 0 0 1px var(--tss-accent); }
.tss-chip.is-on .tss-chip-m::before { content: '●'; color: var(--tss-accent); font-size: 12px; }
.tss-chip-m { position: absolute; right: 4px; font-weight: 800; }
.tss-chip.is-key { border-color: var(--tss-ok); box-shadow: inset 0 0 0 2px var(--tss-ok); }
.tss-chip.is-key .tss-chip-m, .tss-chip.is-wrong .tss-chip-m { font-size: 16px; }
.tss-chip.is-key .tss-chip-m { color: var(--tss-ok); }
.tss-chip.is-key .tss-chip-m::before, .tss-chip.is-wrong .tss-chip-m::before { content: none; }
.tss-chip.is-wrong { border-color: var(--tss-bad); border-style: dashed; }
.tss-chip.is-wrong .tss-chip-m { color: var(--tss-bad); }
.tss-chip:disabled { cursor: default; opacity: 1; }

/* Briefing example */
.tss-ex { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.tss-ex figure { margin: 0; text-align: center; }
.tss-ex svg { display: block; width: 180px; height: 180px; margin: 0 auto 4px; }
.tss-ex figcaption { font-weight: 700; }

@media (max-width: 1180px) and (min-width: 901px) {
  .tss { grid-template-columns: minmax(0, 1fr) 420px; }
  .tss-scopecol, .tss-pane { width: 300px; }
  .tss-pane { height: 300px; }
}
@media (max-width: 900px) {
  .tss { position: static; grid-template-columns: 1fr; }
  .tss-scene { overflow: visible; }
  .tss-bench { grid-template-columns: 1fr; }
  .tss-scopecol { width: 100%; max-width: 420px; margin: 0 auto; }
  .tss-pane { width: 100%; height: auto; aspect-ratio: 1; }
  .tss-side, .tss-log { overflow: visible; }
}
@media (max-width: 420px) {
  .tss { padding: 6px; }
  .tss-chips--name { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tss-chips--family { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tss *, .tss *::before, .tss *::after { animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
