/* ── Reset & Tokens ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Background layers ── */
  --bg:        #0d1117;
  --surface:   #161b27;
  --surface2:  #1f2535;
  --border:    #2a3050;

  /* ── Accent — Periodic Table (violet) ── */
  --accent:    #a78bfa;
  --accent-lo: rgba(167,139,250,.22);

  /* ── Semantic colours — DO NOT CHANGE ── */
  --green:     #3ddc84;
  --red:       #ff5555;
  --gold:      #f5c842;

  /* ── Typography ── */
  --text:      #dde3f0;
  --text-dim:  #6b7a99;
  --font:      'Segoe UI', system-ui, sans-serif;
  --mono:      'Courier New', monospace;

  /* ── Layout ── */
  --radius:    12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  padding: 0 16px;
}

#app { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* ── Header ─── */
header { text-align: center; padding: 4px 0; }
header h1 {
  font-size: 1.8rem; font-weight: 700;
  background: linear-gradient(120deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.subtitle { color: var(--text-dim); font-size: 0.85rem; margin-top: 3px; }

/* ── Controls bar ─── */
.controls-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.ctrl-group  { display: flex; align-items: center; gap: 8px; }
.ctrl-label  { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); white-space: nowrap; }
.ctrl-value  { font-size: 0.82rem; color: var(--accent); font-weight: 600; min-width: 40px; }

/* ── Pill tabs ─── */
.pill-tabs { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; gap: 2px; }
.pill {
  padding: 5px 13px; border: none; background: transparent; color: var(--text-dim);
  border-radius: 6px; cursor: pointer; font-size: 0.81rem;
  transition: background .18s, color .18s, box-shadow .18s;
}
.pill.active { background: var(--accent); color: #fff; box-shadow: 0 0 12px var(--accent-lo); }
.pill:hover:not(.active) { background: var(--surface2); color: var(--text); }

/* ── Buttons ─── */
.btn { padding: 8px 18px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.84rem; font-weight: 600; transition: filter .18s, box-shadow .18s, opacity .18s; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { filter: brightness(1.12); box-shadow: 0 0 12px var(--accent-lo); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }

/* ── Sliders ─── */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 6px;
  background: var(--surface2); border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 6px var(--accent-lo);
}

/* ── Canvas card ─── */
.canvas-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
  overflow-x: clip;
}
.canvas-card canvas { display: block; width: 100%; height: auto; touch-action: pan-y; }

/* ── SEO article ─── */
.seo-article {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px; line-height: 1.7;
}
.seo-article h2 { font-size: 1.3rem; color: var(--accent); margin-bottom: 12px; }
.seo-article h3 { font-size: 1.05rem; color: var(--text); margin: 18px 0 8px; }
.seo-article p { font-size: 0.92rem; color: var(--text-dim); margin-bottom: 10px; }
.seo-article a { color: var(--accent); text-decoration: none; }
.seo-article a:hover { text-decoration: underline; }


.seo-article h4 { font-size: .95rem; color: var(--text); margin: 14px 0 6px; }
.seo-article ul { margin: 0 0 10px 18px; color: var(--text-dim); font-size: .92rem; } .seo-article li { margin-bottom: 4px; }
.pt-art-table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 6px 0 12px; }
.pt-art-table th, .pt-art-table td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; color: var(--text-dim); }
.pt-art-table th { background: var(--surface2); color: var(--text); }

/* INTERLINK-START  header quick-links (the site's standard block) */
.head-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap;justify-content:flex-end;}
.btn-link{display:inline-flex;align-items:center;gap:7px;padding:5px 12px;border-radius:8px;font-size:.82rem;font-weight:700;text-decoration:none;cursor:pointer;background:var(--surface2,#1f2535);color:var(--text,#dde3f0);border:1.5px solid var(--border,#2a3050);white-space:nowrap;transition:border-color .18s,background .18s,color .18s;}
.btn-link:hover{border-color:var(--accent,#4fc3f7);background:var(--accent-lo,rgba(79,195,247,.18));color:#fff;}
.btn-link img{width:20px;height:20px;border-radius:4px;flex:none;}
.btn-link .lbl{line-height:1;}
@media (max-width: 1100px) { .btn-link .lbl { display: none; } .btn-link { padding: 5px 9px; } }
/* INTERLINK-END */

/* ═══ Periodic Table Game — Explore ═══ */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); color: var(--text); padding: 6px 10px; border-radius: 8px; }
.mode-section[hidden] { display: none; }
.pt-soon { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; }
.pt-soon h2 { color: var(--accent); margin-bottom: 8px; }
.pt-soon p { color: var(--text-dim); }

/* toolbar */
.pt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.pt-field { display: flex; align-items: center; gap: 8px; }
.pt-field select { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .86rem; }
.pt-temp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* the temperature controls show only under a colouring that depends on temperature (PTCore.tempMatters) */
.pt-temp[hidden] { display: none !important; }
#pt-temp-out[hidden], #pt-temp-down[hidden], #pt-temp-up[hidden] { display: none !important; }
.m-sheet-tabs button[hidden] { display: none !important; }
.pt-temp input[type="range"] { width: 220px; }
.pt-step { padding: 4px 11px; min-width: 32px; font-size: 1rem; line-height: 1; }
#pt-temp-out { font: 600 .86rem var(--font); color: var(--accent); min-width: 140px; }
.pt-presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pt-chip { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .76rem; cursor: pointer; }
.pt-chip:hover { border-color: var(--accent); }

/* the table */
.pt-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow-x: clip; }
.pt-grid-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
.pt-grid { display: grid; grid-template-columns: repeat(18, minmax(46px, 1fr)); grid-template-rows: repeat(7, auto) 14px repeat(2, auto); gap: 3px; min-width: 860px; position: relative; }
.pt-tile { position: relative; aspect-ratio: 1 / 1.08; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; padding: 3px 4px; cursor: pointer; font-family: var(--font); color: #0d1117; text-align: left; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.pt-tile:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px rgba(255,255,255,.35); z-index: 2; }
.pt-tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; z-index: 3; }
.pt-tile[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(255,255,255,.45); z-index: 3; }
.pt-tile .z { font-size: .62rem; font-weight: 600; opacity: .85; line-height: 1; }
.pt-tile .sym { font-size: 1.15rem; font-weight: 800; line-height: 1; }
.pt-tile .nm { font-size: .54rem; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.pt-tile .st { position: absolute; top: 3px; right: 4px; font-size: .56rem; font-weight: 700; padding: 0 3px; border-radius: 3px; background: rgba(13,17,23,.55); color: #fff; }
.pt-tile.dark { color: #f1f4fa; }
.pt-gap { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: 6px; font-size: .62rem; color: var(--text-dim); }
.pt-feature { grid-row: 1 / 4; grid-column: 3 / 13; display: flex; align-items: center; gap: 16px; padding: 4px 14px; color: var(--text); pointer-events: none; }
.pt-feature .big { width: 96px; height: 96px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #0d1117; flex: none; }
.pt-feature .big b { font-size: 2.3rem; line-height: 1; }
.pt-feature .big span { font-size: .72rem; }
.pt-feature .txt h2 { font-size: 1.15rem; }
.pt-feature .txt p { font-size: .8rem; color: var(--text-dim); margin-top: 3px; }
.pt-feature .txt .val { color: var(--accent); font-weight: 700; font-size: .95rem; margin-top: 4px; }

/* legend */
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 10px; font-size: .78rem; color: var(--text-dim); }
.pt-legend .sw { display: inline-flex; align-items: center; gap: 5px; }
.pt-legend .sw i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.pt-legend .ramp { height: 10px; width: 260px; border-radius: 5px; }
.pt-legend .nodata i { background: #2a2f3a; border: 1px solid var(--border); }
.pt-hint { font-size: .78rem; color: var(--text-dim); margin-top: 6px; }

/* the element card: slides out over the far half of the table, inside the table card (never fixed, so it cannot
   cover an ad); app.js places it (PTFly). On a phone it sits in the page under the table. */
.pt-panel { position: absolute; z-index: 6; margin: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid #39425a; border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.55); padding: 8px 12px; overflow-y: auto; overscroll-behavior: contain; container-type: inline-size; animation: pt-fly-r .24s ease-out; }
.pt-panel[hidden] { display: none; }
.pt-panel.from-left { animation-name: pt-fly-l; }
@keyframes pt-fly-r { from { transform: translateX(56px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pt-fly-l { from { transform: translateX(-56px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pt-panel { animation: none; } }
.pt-p-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.pt-p-head { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pt-p-head h2 { font-size: 1.1rem; line-height: 1.2; }
.pt-p-sym { flex: none; width: 42px; height: 42px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.25rem; }
.pt-p-head .tag { font-size: .7rem; padding: 2px 7px; border-radius: 999px; background: var(--surface2); color: var(--text); }
.pt-p-head code { font-family: var(--mono); color: var(--accent); font-size: .8rem; }
.pt-fly-x { flex: none; min-width: 36px; min-height: 36px; padding: 0; font-size: 1.4rem; line-height: 1; }
.pt-p-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px; align-items: start; margin-bottom: 8px; }
.pt-p-atom { padding: 4px; position: relative; }
.pt-p-atom .pt-spin { position: absolute; top: 6px; left: 6px; z-index: 1; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; font-size: .62rem; line-height: 1; letter-spacing: -1px; background: rgba(13,17,23,.85); }
.pt-p-atom canvas { cursor: pointer; border-radius: 8px; }
.pt-p-atom canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pt-p-side { display: grid; gap: 7px; align-content: start; min-width: 0; }
.pt-lens { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pt-lens-b, .pt-spin { min-height: 34px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 600 .78rem var(--font); cursor: pointer; }
.pt-lens-b:hover, .pt-spin:hover { border-color: var(--accent); }
.pt-lens-b.active { background: var(--accent); border-color: var(--accent); color: #0d1117; }
.pt-spin[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.pt-lens-b:focus-visible, .pt-spin:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pt-p-say { font-size: .76rem; line-height: 1.42; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; min-height: 4.4em; }
.pt-p-fig { margin: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.pt-p-fig figcaption, .pt-p-figcap { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 4px; }
.pt-p-fig canvas { width: 100%; height: auto; display: block; }
.pt-p-cap { font-size: .74rem; color: var(--text-dim); margin-top: 4px; line-height: 1.4; }
.pt-p-nums { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 5px; }
.pt-p-nums dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.pt-n { min-width: 0; padding: 2px 6px; border-radius: 6px; background: var(--surface); }
.pt-n.wide { grid-column: 1 / -1; }
.pt-n.two { grid-column: span 2; }
.pt-n dt { color: var(--text-dim); font-size: .64rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-n dd { color: var(--text); font-weight: 600; font-size: .78rem; line-height: 1.3; cursor: help; overflow-wrap: anywhere; }
.pt-n.wide dd { font-weight: 500; }
.pt-p-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.pt-p-facts .pt-n { background: var(--bg); border: 1px solid var(--border); padding: 4px 8px; }
.pt-p-facts[hidden] { display: none; }
@container (max-width: 470px) { .pt-p-main { grid-template-columns: minmax(0, 1fr); } .pt-p-nums dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 768px) { .pt-temp input[type="range"] { width: 150px; } }
@media (max-width: 500px) { header h1 { font-size: 1.3rem; } }

/* ═══ Element Odyssey (Game mode, ptarcade.js) ═══ */
.og-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.og-head h2 { color: var(--accent); font-size: 1.25rem; }
.og-head p { color: var(--text-dim); font-size: .86rem; margin-top: 4px; }
.og { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: clip; }
.og-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.og-rank { font-size: .9rem; white-space: nowrap; }
.og-xp { position: relative; flex: 1 1 200px; min-width: 160px; height: 22px; background: var(--bg); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.og-xp i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #6d28d9, var(--accent)); }
.og-xp em { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 .74rem var(--font); font-style: normal; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.og-tally { font-size: .82rem; color: var(--text-dim); white-space: nowrap; }
.og-mapbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.og-daily, .og-btn { min-height: 38px; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: 600 .86rem var(--font); cursor: pointer; }
.og-btn.primary, .og-daily { background: var(--accent); color: #0d1117; border-color: var(--accent); }
.og-btn:disabled { opacity: .4; cursor: not-allowed; }
.og-btn:focus-visible, .og-pill:focus-visible, .og-daily:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.og-regions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.og-region { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--rc) 16%, transparent), transparent 60%); }
.og-region header { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.og-remo { font-size: 1.7rem; line-height: 1; }
.og-region h3 { font-size: 1rem; color: var(--rc); }
.og-region header p { font-size: .76rem; color: var(--text-dim); margin-top: 2px; }
.og-stagelist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.og-pill { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 600 .78rem var(--font); text-align: left; cursor: pointer; }
.og-pill:hover:not(.locked) { border-color: var(--rc); }
.og-pill.boss { border-color: color-mix(in srgb, var(--rc) 60%, var(--border)); }
.og-pill.locked { opacity: .5; cursor: help; }
.og-hint { min-height: 1.3em; margin: -4px 0 8px; color: var(--gold); font-size: .86rem; }
.og-hint:empty { margin: 0; min-height: 0; }
.og-pemo { font-size: 1rem; }
.og-ptitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.og-stars i { font-style: normal; color: #3a4152; font-size: .82rem; }
.og-stars i.on { color: var(--gold); }
.og-foot { font-size: .76rem; color: var(--text-dim); margin-top: 10px; }
.og-link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; min-height: 36px; padding: 0 4px; }
.og-brief, .og-result { max-width: 560px; margin: 10px auto; text-align: center; }
.og-bemo { font-size: 2.6rem; }
.og-brief h3, .og-result h3 { font-size: 1.3rem; margin: 6px 0; }
.og-goal { font-size: .95rem; margin-bottom: 8px; }
.og-idea, .og-learn { font-size: .84rem; color: var(--text-dim); margin-bottom: 6px; text-align: left; }
.og-bossnote { color: var(--red); font-weight: 700; margin: 6px 0; }
.og-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.og-hud { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--text-dim); margin-bottom: 8px; }
.og-prompt { font-size: 1rem; font-weight: 600; margin-bottom: 10px; line-height: 1.45; }
.og-board { min-height: 120px; }
.og-fb { min-height: 1.4em; margin-top: 10px; font-size: .88rem; line-height: 1.45; }
.og-fb.good { color: var(--green); }
.og-fb.bad { color: #ff8a80; }
.og-fb.pop { animation: og-pop .35s ease-out; }
@keyframes og-pop { from { transform: scale(1.05); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .og-fb.pop { animation: none; } }
.og-result p { color: var(--text-dim); margin: 6px 0; }
.og-result .og-stars i { font-size: 1.8rem; }
.og-badges span { display: inline-block; margin: 2px 4px; padding: 3px 8px; border-radius: 999px; background: var(--surface2); color: var(--text); font-size: .8rem; }
.og-card { display: grid; grid-template-columns: 76px 160px 1fr; gap: 10px; align-items: center; text-align: left; margin: 12px auto 0; padding: 10px; border-radius: 12px; border: 2px solid #8d6e63; background: var(--bg); max-width: 520px; }
.og-card.silver { border-color: #b0bec5; } .og-card.gold { border-color: var(--gold); box-shadow: 0 0 14px rgba(245,200,66,.35); }
.og-ctile { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 76px; border-radius: 8px; background: var(--surface2); }
.og-ctile b { font-size: 1.6rem; }
.og-ctile span { font-size: .66rem; color: var(--text-dim); }
.og-card p { font-size: .8rem; color: var(--text-dim); }
@media (max-width: 768px) { .og-regions { grid-template-columns: 1fr; } }
@media (max-width: 500px) { .og-stagelist { grid-template-columns: 1fr; } .og-card { grid-template-columns: 64px 1fr; } .og-card canvas { display: none; } }

/* Element Odyssey — boards */
.og-swipe { display: none; margin: 4px 0 0; color: var(--text-dim); font-size: .78rem; text-align: right; }
body.pt-m .og-swipe { display: block; }
.og-mtwrap { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 4px; }
.og-mt { display: grid; grid-template-columns: repeat(18, 36px); grid-auto-rows: 38px; gap: 2px; width: max-content; margin: 0 auto; }
.og-mt.big { grid-template-columns: repeat(18, 44px); grid-auto-rows: 46px; gap: 3px; }
.og-mtile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 5px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: 600 .62rem var(--font); padding: 0; cursor: pointer; }
.og-mtile b { font-size: .82rem; line-height: 1; }
.og-mt.big .og-mtile b { font-size: 1rem; }
.og-mtile i { position: absolute; top: 1px; left: 3px; font-style: normal; font-size: .5rem; color: var(--text-dim); }
.og-mtile em { font-style: normal; font-size: .48rem; color: var(--text-dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.og-mtile:hover:not(:disabled) { border-color: var(--accent); }
.og-mtile.fixed { cursor: default; background: var(--bg); color: var(--text-dim); }
.og-mtile.blank { border-style: dashed; background: transparent; }
.og-mtile.gap { border: 1px dashed var(--gold); color: var(--gold); background: transparent; font-size: 1rem; cursor: default; }
.og-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.og-opts.two { grid-template-columns: 1fr 1fr; }
.og-opt, .og-q, .og-prop { min-height: 42px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: 600 .86rem var(--font); text-align: left; cursor: pointer; }
.og-opt[aria-pressed="true"], .og-chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-lo); }
.og-tray { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.og-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 40px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: 600 .84rem var(--font); cursor: pointer; text-align: left; }
.og-how { margin: 0 0 8px; color: var(--text-dim); font-size: .82rem; }
.og-how.nudge { animation: ogNudge .5s; color: var(--gold); }
@keyframes ogNudge { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .og-how.nudge { animation: none; } }
.og-chip em { font-style: normal; font-weight: 400; font-size: .72rem; color: var(--text-dim); }
.og-chip.tile { align-items: center; min-width: 44px; }
.og-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.og-bin { border: 1px dashed var(--border); border-radius: 10px; padding: 6px; min-height: 90px; }
.og-binbtn { width: 100%; min-height: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--accent); font: 700 .84rem var(--font); cursor: pointer; }
.og-binlist { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.og-seq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 6px 10px; border: 1px dashed var(--border); border-radius: 10px; font-weight: 700; }
.og-seq i { font-style: normal; color: var(--text-dim); }
.og-seq em { color: var(--text-dim); font-weight: 400; font-size: .84rem; }
.og-seq.good { border-color: var(--green); } .og-seq.bad { border-color: var(--red); }
.og-sub { font-size: .8rem; color: var(--text-dim); margin: 10px 0 6px; }
.og-qs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; }
.og-q b.yes { color: var(--green); } .og-q b.no { color: #ff8a80; }
.og-num { width: 160px; min-height: 42px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 600 1rem var(--font); }
.og-num.good { border-color: var(--green); } .og-num.bad { border-color: var(--red); }
.og-chart { display: block; width: 100%; height: auto; margin: 0 auto 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.og-duel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.og-tcard { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.og-tcard header { font-size: .95rem; } .og-tcard header b { font-size: 1.3rem; color: var(--accent); margin-right: 4px; }
.og-prop { display: flex; justify-content: space-between; gap: 8px; }
.og-prop.static { cursor: default; background: transparent; }
.og-prop span { font-weight: 400; color: var(--text-dim); }
.good { border-color: var(--green) !important; box-shadow: 0 0 0 2px rgba(61,220,132,.25); }
.bad { border-color: var(--red) !important; box-shadow: 0 0 0 2px rgba(255,85,85,.25); }
.shake { animation: og-shake .3s; }
@keyframes og-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
@media (max-width: 500px) { .og-opts { grid-template-columns: 1fr; } .og-duel { grid-template-columns: 1fr; } }

/* ═══ 3D landscape (pt3d.js) ═══ */
.pt-view .pill { padding: 6px 12px; }
.pt-land { position: relative; }
#pt-land-cv { display: block; width: 100%; height: clamp(380px, 56vw, 620px); border-radius: 10px; background: #0d1117; cursor: grab; touch-action: none; }
/* read by screen readers, not shown */
.pt-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#pt-land-cv:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#pt-land-hud { position: absolute; left: 0; top: 0; width: 100%; height: clamp(380px, 56vw, 620px); pointer-events: none; }
.pt-land-bar { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.pt-land-bar .btn { min-height: 34px; padding: 4px 12px; }
.pt-land-tip { color: var(--text-dim); font-size: .78rem; margin-top: 6px; }
.pt-land-msg { background: rgba(255,85,85,.1); border: 1px solid rgba(255,85,85,.4); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: .86rem; }
body.pt-m .pt-view { display: none; }

/* ═══ Why? lessons (ptwhy.js plan, ptwhyplay.js chalk player) ═══ */
.pt-why-btn { background: var(--accent); color: #fff; min-height: 34px; }
.pt-why-btn:disabled { background: var(--surface2); color: var(--text-dim); cursor: not-allowed; border: 1px solid var(--border); }
.pt-why { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.pt-why-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pt-why-head h3 { color: var(--accent); font-size: 1.08rem; line-height: 1.35; }
.pt-why-x { padding: 2px 12px; font-size: 1.2rem; min-height: 34px; }
.pt-why-pair { color: var(--text-dim); font-size: .84rem; margin: 4px 0 10px; }
.pt-why-pair b { color: var(--text); }
#pt-why-cv { display: block; width: 100%; border-radius: 10px; background: #121a17; }
.pt-why-say { margin: 10px 2px; line-height: 1.55; min-height: 3.1em; }
.pt-why-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pt-why-bar .btn { min-height: 36px; }
.pt-why-step { color: var(--text-dim); font-size: .8rem; margin-left: auto; }
.pt-tile.why-a { box-shadow: 0 0 0 3px var(--gold), 0 0 12px rgba(245,200,66,.5); z-index: 3; }
.pt-tile.why-b { box-shadow: 0 0 0 3px var(--accent), 0 0 12px var(--accent-lo); z-index: 3; }

/* ═══ Quiz (ptquiz.js + the view in app.js) ═══ */
.pt-qz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.pt-qz-head h2 { color: var(--accent); font-size: 1.25rem; margin-bottom: 4px; }
.pt-qz-head p { color: var(--text-dim); font-size: .9rem; margin-bottom: 14px; }
.pt-qz-levels { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pt-qz-levels .pill { border: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-start; padding: 8px 14px; min-height: 44px; }
.pt-qz-levels .pill small { font-size: .7rem; font-weight: 400; opacity: .8; }
.pt-qz-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 18px; min-height: 160px; }
.pt-qz-note { color: var(--text-dim); margin-bottom: 12px; }
.pt-qz-prog { color: var(--text-dim); font-size: .8rem; margin-bottom: 6px; }
.pt-qz-q { font-size: 1.08rem; line-height: 1.45; margin-bottom: 14px; }
.pt-qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pt-qz-opt { display: flex; align-items: flex-start; gap: 10px; text-align: left; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; min-height: 48px; font: 500 .92rem var(--font); cursor: pointer; }
.pt-qz-opt b { color: var(--accent); flex: none; }
.pt-qz-opt:hover:not(:disabled) { border-color: var(--accent); }
.pt-qz-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pt-qz-opt:disabled { cursor: default; opacity: .75; }
.pt-qz-opt.right { border-color: var(--green); background: rgba(61,220,132,.12); opacity: 1; }
.pt-qz-opt.wrong { border-color: var(--red); background: rgba(255,85,85,.12); opacity: 1; }
.pt-qz-why { border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.5; font-size: .9rem; }
.pt-qz-why.ok { background: rgba(61,220,132,.1); } .pt-qz-why.no { background: rgba(255,85,85,.1); }
.pt-qz-why b { margin-right: 4px; }
.pt-qz-done { text-align: center; padding: 10px; }
.pt-qz-done h3 { font-size: 2.2rem; color: var(--accent); }
.pt-qz-done p { color: var(--text-dim); margin: 8px 0 14px; }
@media (max-width: 600px) { .pt-qz-opts { grid-template-columns: 1fr; } .pt-qz { padding: 14px; } .pt-qz-card { padding: 14px; } }

/* ═══ Phone layout (mobile-ui.js) ══════════════════════════════
   Scoped to body.pt-m, which mobile-ui.js sets only while the screen is
   ≤ 720 px — none of this can reach desktop. The dock is sticky inside
   #sec-explore, never position:fixed on the page (a fixed bottom bar stopped
   the Auto Ads anchor ad on utm-testing). */
.m-stage-tabs, .m-dock, .m-setchip { display: none; }
@media (max-width: 720px) {
  body.pt-m header { padding: 0; }
  body.pt-m header h1 { font-size: 1.15rem; line-height: 1.2; }
  body.pt-m .subtitle { font-size: 0.7rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.pt-m .m-banner { padding: 6px; gap: 6px; flex-direction: row; flex-wrap: nowrap; align-items: stretch; }
  body.pt-m .m-banner .ctrl-label { display: none; }
  body.pt-m .m-banner .ctrl-group { display: block; flex: 1; }
  body.pt-m .m-banner { flex-wrap: wrap; }
  body.pt-m .m-banner .head-actions { display: flex; flex-wrap: nowrap; gap: 6px; margin: 0; width: 100%; }
  body.pt-m .m-banner .head-actions > a { flex: 1 1 0; min-width: 0; height: 38px; padding: 0 !important; justify-content: center; border-radius: 9px; }
  body.pt-m .m-banner .btn-link .lbl { display: none; }
  body.pt-m .m-banner .btn-link img { width: 22px; height: 22px; }
  body.pt-m #mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  body.pt-m #mode-tabs .pill { min-height: 36px; padding: 0 4px; font-size: 0.8rem; font-weight: 700; }
  body.pt-m .m-setchip {
    display: flex; align-items: center; gap: 6px; width: 100%; min-height: 38px; padding: 6px 10px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
    font: 600 .78rem var(--font); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  }
  body.pt-m .m-setchip[aria-expanded="true"] { border-color: var(--accent); }
  body.pt-m:is([data-view="game"], [data-view="quiz"]) .m-setchip { display: none; }
  body.pt-m .pt-tools { display: none; }

  /* stage: the table pans inside its card; the selected element sits under it */
  body.pt-m .pt-card { padding: 6px; }
  body.pt-m .pt-grid { grid-template-columns: repeat(18, 38px); grid-template-rows: repeat(7, 38px) 8px repeat(2, 38px); gap: 2px; min-width: 0; width: max-content; }
  body.pt-m .pt-tile { aspect-ratio: auto; height: 38px; padding: 2px 3px; justify-content: center; align-items: center; text-align: center; }
  body.pt-m .pt-tile .z { position: absolute; top: 2px; left: 3px; font-size: .5rem; }
  body.pt-m .pt-tile .sym { font-size: .95rem; }
  body.pt-m .pt-tile .nm { display: none; }
  body.pt-m .pt-tile .st { font-size: .46rem; top: 1px; right: 2px; }
  body.pt-m .pt-gap { font-size: .48rem; }
  body.pt-m .pt-feature { pointer-events: auto; padding: 8px 2px 2px; gap: 10px; }
  body.pt-m .pt-feature .big { width: 64px; height: 64px; }
  body.pt-m .pt-feature .big b { font-size: 1.6rem; }
  body.pt-m .pt-hint { display: none; }
  body.pt-m .pt-card > .pt-why-btn { display: block; width: 100%; min-height: 44px; margin-top: 6px; }
  body.pt-m .pt-why { padding: 10px; }
  body.pt-m .pt-why-bar .btn { min-height: 44px; flex: 1; }
  body.pt-m .pt-why-step { width: 100%; text-align: center; margin: 0; }
  body.pt-m .pt-legend .ramp { width: 120px; }
  body.pt-m .pt-panel { position: static; margin-top: 8px; box-shadow: none; overflow: visible; animation: none; }

  /* dock: sticky inside the simulator, lifted above an anchor ad */
  body.pt-m .m-dock {
    display: block; position: sticky; bottom: var(--m-anchor, 0px); z-index: 60;
    margin-top: 8px; padding: 0 0 env(safe-area-inset-bottom); pointer-events: none;
  }
  body.pt-m .m-dock > * { pointer-events: auto; }
  body.pt-m .m-bar {
    display: flex; gap: 6px; align-items: stretch; margin: 0 0 8px; padding: 6px;
    background: rgba(18,22,32,0.94); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 -6px 24px rgba(0,0,0,.45);
  }
  body.pt-m .m-run { flex: 1; display: flex; gap: 6px; align-items: stretch; min-width: 0; }
  body.pt-m .m-run .pt-step { flex: none; width: 52px; min-height: 46px; font-size: 1.3rem; background: var(--surface2); color: var(--text); border: 1.5px solid var(--border); border-radius: 10px; }
  body.pt-m .m-run #pt-temp-out { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: .8rem; line-height: 1.15; }
  body.pt-m .m-setup {
    flex: none; width: 58px; min-height: 46px; border-radius: 10px;
    border: 2px solid var(--border); background: var(--surface2); color: var(--text);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    font-family: inherit; cursor: pointer;
  }
  body.pt-m .m-setup-ic { font-size: 1.05rem; line-height: 1; }
  body.pt-m .m-setup-lbl { font-size: 0.6rem; font-weight: 700; letter-spacing: .03em; }
  body.pt-m .m-setup[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #0d1117; }
  body.pt-m .m-sheet {
    display: flex; flex-direction: column; margin: 0 0 6px; overflow: hidden;
    background: rgba(22,27,38,0.97); backdrop-filter: blur(10px);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 -8px 30px rgba(0,0,0,.5);
  }
  body.pt-m .m-sheet[hidden] { display: none; }
  body.pt-m .m-sheet-tabs { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); }
  body.pt-m .m-sheet-tabs button { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--text-dim); font-family: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
  body.pt-m .m-sheet-tabs button[aria-selected="true"] { background: var(--surface2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
  body.pt-m .m-pane { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
  body.pt-m .m-pane[hidden] { display: none; }
  body.pt-m .m-pane .pt-field { flex-direction: column; align-items: stretch; }
  body.pt-m .m-pane .pt-field select { min-height: 42px; font-size: .9rem; }
  body.pt-m .m-pane #pt-temp { width: 100%; height: 8px; }
  body.pt-m .m-pane .pt-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  body.pt-m .m-pane .pt-chip { min-height: 40px; font-size: .84rem; }
  body.pt-m .m-pane .ctrl-group { display: block; }
  body.pt-m .m-pane #unit-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  body.pt-m .m-pane #unit-tabs .pill { min-height: 40px; }
}
