/* Pangaea Puzzle: the Gondwana Reconstruction Room (a backlit light table with a 3 × 3 grid, a specimen drawer of
   schematic continent pieces, a reference card and a fossil key). Art by art.js, colors from the --pp-* properties
   below (light and dark). */
html {
  --pp-wall: #e9e1d2; --pp-wood1: #a8743f; --pp-wood2: #7a4f26; --pp-glow1: #fbfcf4; --pp-glow2: #dfe9e4; --pp-grid: rgba(40, 70, 80, .45);
  --pp-line: #2a1d12; --pp-coast: #3b2a17; --pp-land1: #d9c58f; --pp-land2: #b99a5b; --pp-land3: #8d6f3a; --pp-glyph-line: #1f160d;
  --pp-meso: #2f6fb0; --pp-cyno: #e07a1f; --pp-lystro: #8a5a2b; --pp-glosso: #2f8a3a; --pp-rock: #b4472a; --pp-ice: #1f6fa8;
  --pp-north: #b3261e; --pp-card: #fffaf0; --pp-card2: #efe6d6; --pp-ink: #23180e; --pp-accent: #7b4515; --pp-ok: #13704a; --pp-bad: #b3261e;
  --pp-chip: #ffffff; --pp-chip-on: #f3e3cf; --pp-ov-halo: rgba(255, 255, 255, .85); --pp-panel1: #fbf6ee; --pp-panel2: #f0e6d6;
  --pp-cell: 122px;
}
html[data-theme="dark"] {
  --pp-wall: #2a2620; --pp-wood1: #5b3c1f; --pp-wood2: #3a2512; --pp-glow1: #2b3a3c; --pp-glow2: #1c2729; --pp-grid: rgba(190, 225, 230, .35);
  --pp-line: #0b0805; --pp-coast: #f0e2c4; --pp-land1: #b49c62; --pp-land2: #8f7440; --pp-land3: #6a5228; --pp-glyph-line: #120c06;
  --pp-meso: #6aa9e8; --pp-cyno: #ff9d4d; --pp-lystro: #c99363; --pp-glosso: #5fcf6c; --pp-rock: #ff7a5a; --pp-ice: #7cc4f5;
  --pp-north: #ff7d73; --pp-card: #1f1b16; --pp-card2: #2c261f; --pp-ink: #f2eadf; --pp-accent: #e0a46a; --pp-ok: #4fd08c; --pp-bad: #ff8a80;
  --pp-chip: #1a1612; --pp-chip-on: #3a2a1a; --pp-ov-halo: rgba(20, 24, 26, .85); --pp-panel1: #221d18; --pp-panel2: #1a1612;
}
.pp { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 10px; color: var(--tlg-text); font-size: 16px; }
.pp button { font: inherit; }
.pp-controls { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: auto; padding: 8px 12px;
  background: linear-gradient(var(--pp-panel1), var(--pp-panel2)); color: var(--pp-ink); border: 3px solid var(--pp-accent); border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.pp-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; overflow: auto; }
.pp-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--pp-accent); }
.pp-step, .pp-step-b { display: grid; gap: 4px; }
.pp-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.pp-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pp-accent); color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .pp-n { color: #1a1008; }
.pp-step.is-done .pp-n { background: var(--pp-ok); }
.pp-mark { margin-left: auto; font-weight: 800; white-space: nowrap; }
.pp-mark.is-ok { color: var(--pp-ok); }
.pp-mark.is-bad { color: var(--pp-bad); }
.pp-how { margin: 0; line-height: 1.3; }
.pp-status { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 6px; }
.pp-status li { display: flex; justify-content: space-between; gap: 6px; padding: 1px 6px; border-radius: 6px; border: 1px dashed rgba(123, 69, 21, .45); line-height: 1.35; }
.pp-status li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-status li b { white-space: nowrap; font-style: italic; font-weight: 600; opacity: .85; }
.pp-status li.is-set b, .pp-status li.is-pinned b { font-style: normal; font-weight: 800; opacity: 1; }
.pp-status li.is-set { border-style: solid; }
.pp-chips { display: grid; gap: 3px; }
.pp-chip { position: relative; display: flex; align-items: center; min-height: 34px; padding: 2px 26px 2px 10px; border: 2px solid #b9a58a; border-radius: 10px;
  background: var(--pp-chip); color: var(--pp-ink); font-size: 16px; line-height: 1.15; text-align: left; cursor: pointer; }
html[data-theme="dark"] .pp-chip { border-color: #5a4a38; }
.pp-chip:hover:not(:disabled) { border-color: var(--pp-accent); }
.pp-chip.is-on { border-color: var(--pp-accent); background: var(--pp-chip-on); font-weight: 700; box-shadow: inset 0 0 0 1px var(--pp-accent); }
.pp-chip.is-on::before { content: '●'; margin-right: 6px; color: var(--pp-accent); }
.pp-chip-m { position: absolute; right: 8px; font-weight: 800; }
.pp-chip.is-key { border-color: var(--pp-ok); box-shadow: inset 0 0 0 2px var(--pp-ok); }
.pp-chip.is-key .pp-chip-m { color: var(--pp-ok); }
.pp-chip.is-wrong { border-color: var(--pp-bad); border-style: dashed; }
.pp-chip.is-wrong .pp-chip-m { color: var(--pp-bad); }
.pp-chip:disabled { cursor: default; opacity: 1; }
.pp button:focus-visible, .pp .pdz-token:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }

/* request card */
.pp-brief { flex: none; padding: 5px 12px; border: 2px solid var(--pp-accent); border-radius: 12px; background: var(--pp-panel1); color: var(--pp-ink); }
.pp-brief p { margin: 0; line-height: 1.35; }
.pp-brief-a { font-size: 18px; }
.pp-fchip { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.pp-gl { width: 26px; height: 22px; vertical-align: middle; flex: none; }

/* scene */
.pp-scene { flex: none; border-radius: 12px; overflow: hidden; border: 2px solid var(--pp-line); background: var(--pp-wall); }
.pp-room { position: relative; height: 40px; }
.pp-room-svg { display: block; width: 100%; height: 40px; }
.pp-room-sign { position: absolute; left: 12px; top: 5px; padding: 2px 12px; border-radius: 6px; background: var(--pp-accent); color: #fff; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 2px 0 var(--pp-line); }
html[data-theme="dark"] .pp-room-sign { color: #1a1008; }
.pp-table { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 8px 10px 10px; background: linear-gradient(var(--pp-wood1), var(--pp-wood2)); }
.pp-boardwrap { display: grid; gap: 4px; }
.pp-boardhead { display: flex; align-items: center; gap: 8px; color: #fff8ec; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.pp-compass svg { display: block; width: 34px; height: 34px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.pp-compass-n { font-size: 9px; font-weight: 800; fill: #fff; font-family: var(--tlg-font); }
.pp-boardhead-t { font-size: 17px; }
.pp-tag { margin-left: auto; padding: 0 8px; border-radius: 999px; background: rgba(0,0,0,.35); font-size: 16px; font-weight: 700; }
.pp-board { position: relative; display: grid; grid-template-columns: repeat(3, var(--pp-cell)); grid-template-rows: repeat(3, var(--pp-cell));
  border: 3px solid var(--pp-line); border-radius: 8px; background: radial-gradient(circle at 50% 50%, var(--pp-glow1), var(--pp-glow2)); box-shadow: 0 0 22px rgba(255, 252, 220, .45), inset 0 0 0 2px rgba(255,255,255,.4); }
html[data-theme="dark"] .pp-board { box-shadow: 0 0 18px rgba(120, 200, 210, .18); }
.pp-cell { position: relative; border: 1.5px dashed var(--pp-grid); }
.pp-cell-n { position: absolute; left: 6px; top: 1px; font-size: 16px; font-weight: 800; color: var(--pp-ink); opacity: .7; line-height: 20px; }
.pp-slot { position: absolute; left: 6px; top: 22px; right: 4px; bottom: 4px; }
.pp-slot > .pp-tile { position: absolute; left: 0; top: 0; transform: translate(calc(var(--k, 0) * 12px), calc(var(--k, 0) * 3px)); }
.pp-cell.is-stacked .pp-slot > .pp-tile { box-shadow: -2px 2px 6px rgba(0,0,0,.35); }
.pp-ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

/* pieces */
.pp-tile { position: relative; display: grid; grid-template-rows: auto 1fr; justify-items: center; width: calc(var(--pp-cell) - 16px); height: calc(var(--pp-cell) - 30px); padding: 2px 3px 3px;
  border: 2px solid var(--pp-line); border-radius: 10px; background: linear-gradient(var(--pp-card), var(--pp-card2)); color: var(--pp-ink); font-size: 16px; line-height: 1.1; box-shadow: 0 3px 6px rgba(0,0,0,.28); cursor: grab; }
.pp-tile-n { font-size: 16px; font-weight: 800; line-height: 18px; white-space: nowrap; overflow: hidden; max-width: 100%; }
.pp-tile-art { display: block; width: 62px; height: 62px; align-self: center; transition: transform .3s; }
.pp-land-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pp-tile.is-pinned { cursor: default; border-style: double; border-width: 3px; padding-top: 1px; background: linear-gradient(#fff3d6, #f2dfb5); }
html[data-theme="dark"] .pp-tile.is-pinned { background: linear-gradient(#3a2e1e, #2b2216); }
.pp-tile.is-picked { outline: 4px dashed var(--pp-accent); outline-offset: 3px; }
.pp-tile:disabled { cursor: default; opacity: 1; }
.pp-tile-m { position: absolute; right: 3px; bottom: 2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; }
.pp-tile-m.is-ok { background: var(--pp-ok); }
.pp-tile-m.is-bad { background: var(--pp-bad); }
html[data-theme="dark"] .pp-tile-m { color: #10100c; }
.pp-tile.is-bad { border-style: dashed; border-color: var(--pp-bad); }
.pp-tile.is-ok { border-color: var(--pp-ok); }
.pp-ghost { position: absolute; left: 6px; top: 22px; right: 4px; bottom: 4px; display: grid; place-items: center; text-align: center; border: 3px dashed var(--pp-ok); border-radius: 10px;
  background: rgba(19, 112, 74, .12); color: var(--pp-ink); font-size: 16px; font-weight: 700; pointer-events: none; z-index: 2; animation: pp-pulse 1.2s ease-in-out 3; }
@keyframes pp-pulse { 50% { background: rgba(19, 112, 74, .3); } }

/* side: drawer, reference, legend */
.pp-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.2); color: #fff8ec; }
.pp-side-h { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .04em; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.pp-tray { display: grid; grid-template-columns: repeat(2, calc(var(--pp-cell) - 16px)); gap: 8px; min-height: calc(var(--pp-cell) - 30px); padding: 4px; border-radius: 8px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.18) 0 2px, transparent 2px 14px), rgba(40, 25, 10, .35); box-shadow: inset 0 3px 8px rgba(0,0,0,.45); }
.pp-tray-slot { min-height: calc(var(--pp-cell) - 30px); }
.pp-tray-slot:empty { border: 2px dashed rgba(255, 248, 236, .35); border-radius: 10px; }
.pp-tray-empty { margin: 0; font-size: 16px; }
.pp-lower { display: flex; gap: 10px; align-items: flex-start; }
.pp-ref { flex: none; }
.pp-ref-g { display: grid; grid-template-columns: repeat(3, 32px); grid-template-rows: repeat(3, 28px); gap: 2px; margin-top: 3px; padding: 3px; border-radius: 6px; background: var(--pp-card); }
.pp-ref-c { display: grid; place-items: center; border: 1px dashed var(--pp-grid); border-radius: 4px; font-size: 16px; font-weight: 800; color: var(--pp-ink); }
.pp-ref-c.has { background: var(--pp-card2); border-style: solid; border-color: var(--pp-coast); }
.pp-ref-c.is-af { background: #f2dfb5; color: #23180e; }
.pp-legend { list-style: none; margin: 0; padding: 4px 6px; display: grid; gap: 1px; border-radius: 6px; background: var(--pp-card); color: var(--pp-ink); min-width: 0; }
.pp-legend li { display: flex; align-items: center; gap: 4px; font-size: 16px; line-height: 1.2; }

/* reveal overlay */
.pp-ov-range { fill: none; stroke-width: 16; stroke-linecap: round; opacity: .5; stroke-dasharray: 400; stroke-dashoffset: 400; animation: pp-draw 1s ease-out forwards; animation-delay: calc(var(--i, 0) * .25s); }
.pp-ov-dot { opacity: 0; animation: pp-fade .4s ease-out .9s forwards; }
.pp-ov-rock { fill: none; stroke: var(--pp-rock); stroke-width: 10; stroke-linejoin: round; stroke-linecap: round; opacity: .85; stroke-dasharray: 600; stroke-dashoffset: 600; animation: pp-draw 1.2s ease-out .5s forwards; }
.pp-ov-rock2 { fill: none; stroke: #fff4e0; stroke-width: 3; stroke-dasharray: 4 6; opacity: 0; animation: pp-fade .4s ease-out 1.5s forwards; }
.pp-ov-ice { fill: none; stroke: var(--pp-ice); stroke-width: 5; stroke-linecap: round; opacity: 0; animation: pp-fade .5s ease-out 1.1s forwards; }
.pp-ov-icecentre { fill: #fff; stroke: var(--pp-ice); stroke-width: 4; opacity: 0; animation: pp-fade .4s ease-out 1s forwards; }
@keyframes pp-draw { to { stroke-dashoffset: 0; } }
@keyframes pp-fade { to { opacity: 1; } }
.pp-board.is-revealed .pp-cell { border-color: rgba(40, 70, 80, .2); }

.pp-about { flex: none; padding: 2px 10px; border: 1px solid var(--tlg-border); border-radius: 8px; }
.pp-about summary { cursor: pointer; min-height: 32px; font-weight: 700; display: flex; align-items: center; }
.pp-about p { margin: 4px 0; }

/* briefing example */
.pp-ex { display: grid; gap: 8px; }
.pp-ex-svg { border-radius: 10px; border: 2px solid var(--pp-line); width: 100% !important; max-width: 540px; height: auto !important; max-height: none; }
.pp-ex-t { font-size: 16px; font-weight: 800; fill: #fff8ec; font-family: var(--tlg-font); }
.pp-ex-n { font-size: 13px; font-weight: 700; fill: var(--pp-ink); opacity: .7; font-family: var(--tlg-font); }
.pp-ex-l { font-size: 13px; font-weight: 800; fill: var(--pp-ink); font-family: var(--tlg-font); }
.pp-ex-tbl, .pp-ex table { border-collapse: collapse; font-size: 16px; }
.pp-ex th, .pp-ex td { padding: 3px 8px; border-bottom: 1px solid var(--tlg-border); text-align: left; }

@media (max-width: 900px) {
  html { --pp-cell: min(122px, calc((100vw - 76px) / 3)); }
  .pp { position: static; grid-template-columns: 1fr; }
  .pp-controls, .pp-right { overflow: visible; }
  .pp-table { grid-template-columns: 1fr; justify-items: center; }
  .pp-side { width: 100%; box-sizing: border-box; }
  .pp-tray { grid-template-columns: repeat(auto-fill, calc(var(--pp-cell) - 16px)); }
  .pp-tile-art { width: 54px; height: 54px; }
  .pp-tile-n { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pp *, .pp *::before { animation: none !important; transition: none !important; }
  .pp-ov-range, .pp-ov-rock { stroke-dashoffset: 0; }
  .pp-ov-dot, .pp-ov-rock2, .pp-ov-ice, .pp-ov-icecentre { opacity: 1; }
}
