:root {
  --bg: #14161a;
  --surface: #1e2127;
  --surface-2: #2a2e36;
  --line: #3a3f49;
  --text: #f1f2f4;
  --muted: #a4abb8;
  --accent: #b6ee3e;
  --accent-ink: #18200a;
  --danger: #ff8b7e;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Noto Sans JP", "Yu Gothic UI", "Hiragino Sans", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }

button, .file-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
button:hover, .file-btn:hover { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  padding: 9px 20px;
}
button.small { padding: 3px 10px; font-size: 13px; }
button.danger { color: var(--danger); }

input:not([type]), input[type="text"], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
}
textarea { resize: vertical; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}
.brand-mark {
  width: 20px;
  height: 20px;
  background: var(--accent);
  box-shadow: 5px 5px 0 #5e8a14;
  margin-right: 5px;
}
.brand { white-space: nowrap; flex: none; }
.top-actions button, .top-actions .status { white-space: nowrap; }
.brand-tag { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 4px; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.status { color: var(--muted); font-size: 13px; margin: 0; }
.status.error { color: var(--danger); }

.app {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  padding: 20px;
  align-items: start;
}

.canvas-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  line-height: 0;
}
.canvas-frame.dragging { outline: 3px dashed var(--accent); outline-offset: -3px; }
#main {
  width: 100%;
  height: auto;
  display: block;
  cursor: grab;
  touch-action: none;
}
#main.grabbing { cursor: grabbing; }

.stage-foot {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  align-items: flex-start;
}
.phone { margin: 0; flex: none; }
.phone canvas { width: 168px; height: 94.5px; display: block; border-radius: 6px; }
.phone figcaption { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tips { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
kbd {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  font: inherit;
  font-size: 12px;
}

.tool-previews { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.tool-previews:empty { display: none; }
.tool-preview { margin: 0; min-width: 0; max-width: 100%; }
.tool-preview canvas { display: block; max-width: 100%; height: auto !important; }
.tool-preview figcaption { color: var(--muted); font-size: 12px; margin-top: 4px; }
[data-tool="icon"] .canvas-frame, [data-tool="stand"] .canvas-frame { max-width: 560px; margin: 0 auto; }
[data-tool="poster"] .canvas-frame { max-width: 500px; margin: 0 auto; }
[data-tool="poster"] .tpl-grid, [data-tool="nengajo"] .tpl-grid, [data-tool="wallpaper"] .tpl-grid { grid-template-columns: repeat(3, 1fr); }
[data-tool="nengajo"] .canvas-frame { max-width: 440px; margin: 0 auto; }
[data-tool="wallpaper"] .canvas-frame { max-width: 300px; margin: 0 auto; }
[data-tool="overlay"] .canvas-frame, [data-tool="stand"] .canvas-frame {
  background: repeating-conic-gradient(#565b66 0% 25%, #3a3f49 0% 50%) 0 0 / 28px 28px;
}
.feed { margin-top: 24px; }
.feed-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.feed-screen {
  --feed-bg: #0f0f0f;
  --feed-text: #f1f1f1;
  --feed-muted: #aaaaaa;
  background: var(--feed-bg);
  color: var(--feed-text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  font-family: Roboto, "Noto Sans JP", "Yu Gothic UI", sans-serif;
}
.feed-screen.light { --feed-bg: #ffffff; --feed-text: #0f0f0f; --feed-muted: #606060; }
.feed-heading { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.feed-heading:not(:first-child) { margin-top: 24px; }
.feed-home { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feed-side { display: grid; gap: 8px; max-width: 420px; }
.feed-card { min-width: 0; }
.feed-thumb { position: relative; line-height: 0; }
.feed-thumb canvas { width: 100%; height: auto; display: block; border-radius: 10px; }
.feed-time {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.feed-meta { display: flex; gap: 10px; margin-top: 10px; min-width: 0; }
.feed-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.feed-text { min-width: 0; }
.feed-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.feed-sub { color: var(--feed-muted); font-size: 12px; line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.feed-side .feed-card { display: flex; gap: 8px; }
.feed-side .feed-thumb { flex: none; width: 168px; }
.feed-side .feed-thumb canvas { border-radius: 8px; }
.feed-side .feed-meta { margin-top: 0; }
.feed-side .feed-avatar { display: none; }
.feed-side .feed-title { font-size: 14px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.history { display: flex; gap: 6px; }
button:disabled { opacity: .4; cursor: default; border-color: var(--line); }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.section-title { font-size: 14px; margin: 0 0 4px; }
.section-gap { margin-top: 20px; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tpl-grid button { padding: 0 0 5px; overflow: hidden; font-size: 13px; }
.tpl-grid canvas { width: 100%; height: auto; display: block; margin-bottom: 5px; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.sticker-pick {
  width: 100%;
  height: 100%;
  padding: 8px 4px 5px;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sticker-pick img { width: 48px; height: 48px; object-fit: contain; display: block; margin: 0 auto 4px; }
#effectGrid img { background: #3f64a8; border-radius: 3px; }
.sticker-editor { border-top: 1px solid var(--line); padding-top: 14px; }
.sticker-editor[hidden] { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1 1 auto;
  white-space: nowrap;
  font-size: 13px;
  background: none;
  border: 0;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  padding: 11px 0;
  color: var(--muted);
  font-weight: 700;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.tab-body { padding: 16px; }
.tab-body[hidden] { display: none; }

.field { margin-bottom: 14px; }
.field > label, .label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 5px; }
.field > label.file-btn { display: inline-block; color: var(--text); font-size: 14px; margin-bottom: 0; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.label-row .label { margin: 0; }
.inline { display: flex; gap: 8px; }
.inline button { flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 4px 11px; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.random-row { margin-top: 8px; }
.chips button.on,.styles button.on, .bg-grid button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.styles button {
  padding: 6px 0;
  background: #565d6b;
  font-family: "Dela Gothic One", sans-serif;
  font-size: 19px;
  line-height: 1.3;
}

.span-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.span-custom { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bg-grid button { height: 48px; padding: 0; overflow: hidden; }
.bg-grid canvas { width: 100%; height: 100%; display: block; }

#biomeGrid button { position: relative; }
.bg-name {
  position: absolute;
  left: 3px;
  bottom: 3px;
  background: rgba(0, 0, 0, .68);
  color: #fff;
  border-radius: 3px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 1.5;
}

.bg-library { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bg-library:empty { display: none; }
.lib-item { position: relative; }
.lib-pick { display: block; width: 100%; height: 48px; padding: 0; overflow: hidden; }
.lib-pick.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lib-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  background: rgba(0, 0, 0, .7);
  color: #fff;
}

.mychar-list { display: grid; gap: 6px; }
.mychar-list:empty { display: none; }
.mychar-row { display: flex; align-items: center; gap: 4px; }
.mychar-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 8px; text-align: left; font-size: 13px; overflow: hidden; white-space: nowrap; }
.mychar-pick canvas { flex: none; width: 28px; height: 28px; image-rendering: pixelated; border-radius: 3px; }

.layer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.layer-row { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
.layer-row[draggable="true"] { cursor: grab; }
.layer-row.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.layer-row.layer-fixed { color: var(--muted); padding: 8px; font-size: 13px; gap: 8px; }
.layer-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px; text-align: left; font-size: 13px; overflow: hidden; white-space: nowrap; }
.layer-kind { flex: none; color: var(--muted); font-size: 11px; width: 3em; }

.works-dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.works-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.works-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.work-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-width: 0; }
.work-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.work-open { display: block; width: 100%; padding: 0; overflow: hidden; line-height: 0; aspect-ratio: 16 / 9; background: var(--bg); }
.work-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-name { margin-top: 8px; }
.work-date { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }

.share-dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(420px, calc(100vw - 32px)); }
.share-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.share-actions { display: grid; gap: 8px; margin-bottom: 12px; }
.share-actions button[hidden] { display: none; }
.share-note { margin-bottom: 8px; }
#shareStatus { margin: 0 0 12px; }

.slider { margin-bottom: 10px; }
.slider-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.slider input { width: 100%; accent-color: var(--accent); margin: 2px 0 0; }

.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.field.checks > label { color: var(--text); margin: 0; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.color-row[hidden] { display: none; }
.field.color-row > label { display: flex; align-items: center; gap: 6px; margin: 0; }
input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }

.about, .article { width: 100%; max-width: 780px; margin: 0 auto; padding: 32px 20px; line-height: 1.8; }
.about { border-top: 1px solid var(--line); margin-top: 16px; }
.about h2, .article h2 { font-size: 20px; line-height: 1.4; margin: 32px 0 10px; }
.about h2:first-child { margin-top: 0; }
.about h3, .article h3 { font-size: 15px; margin: 18px 0 2px; }
.about p, .article p { margin: 0 0 12px; }
.about ol, .about ul, .article ol, .article ul { margin: 0 0 12px; padding-left: 22px; }
.about a, .article a { color: var(--accent); }
.article h1 { font-size: 28px; line-height: 1.4; margin: 0 0 16px; }
.article-top { padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.article-top a { color: var(--text); font-weight: 900; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.article-sample { width: 100%; height: auto; display: block; border-radius: var(--radius); margin: 0 0 16px; }
.article-cta { display: inline-block; background: var(--accent); color: var(--accent-ink) !important; font-weight: 700; text-decoration: none; border-radius: var(--radius); padding: 10px 20px; }

.info-list { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 8px 12px; margin: 0 0 12px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
/* Footer: related services as cards up top, site menu as small links below. */
.foot { margin-top: 32px; background: #101215; border-top: 1px solid var(--line); color: var(--muted); }
.foot-services { max-width: 1120px; margin: 0 auto; padding: 28px 16px 24px; }
.foot-services.foot-research { padding-top: 4px; }
.foot-services h2 { color: var(--text); font-size: 18px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.foot-services h2::before { content: ""; width: 10px; height: 10px; background: var(--accent); border-radius: 2px; }
.foot-lead { margin: 0 0 16px; font-size: 13px; }
.svc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.svc { display: flex; align-items: center; gap: 10px; height: 100%; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.svc:hover { border-color: var(--accent); transform: translateY(-1px); }
.svc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.svc[aria-current="page"] { border-color: var(--accent); background: rgba(182, 238, 62, .08); }
.svc-text { display: flex; flex-direction: column; min-width: 0; }
.svc-text strong { font-size: 14px; line-height: 1.4; }
.svc-text small { color: var(--muted); font-size: 11px; line-height: 1.4; }

/* Each icon is drawn at the shape of the image that tool makes. */
.svc-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.svc-icon::before { content: ""; display: block; border: 2px solid var(--accent); border-radius: 3px; background: rgba(182, 238, 62, .18); }
.svc-wide::before { width: 32px; height: 18px; }
.svc-banner::before { width: 32px; height: 11px; }
.svc-square::before { width: 24px; height: 24px; }
.svc-round::before { width: 26px; height: 26px; border-radius: 50%; }
.svc-frame::before { width: 32px; height: 18px; background: none; border-style: dashed; }
.svc-tall::before { width: 17px; height: 24px; }
.svc-cube::before { width: 22px; height: 22px; border-radius: 3px; background: linear-gradient(#f6f3ea 0 55%, #1f3b2a 55%); }
.svc-search::before { width: 16px; height: 16px; border-radius: 50%; background: none; border-width: 3px; box-shadow: 7px 7px 0 -5px var(--accent); }

.foot-bottom { border-top: 1px solid var(--line); max-width: 1120px; margin: 0 auto; padding: 14px 16px 20px; font-size: 12px; }
.foot-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-bottom: 8px; }
.foot-menu-title { color: var(--muted); font-weight: 700; }
.foot-menu a { color: var(--text); font-size: 13px; }
.foot-menu a[aria-current="page"] { color: var(--accent); }
.foot-note { margin: 0; }

@media (max-width: 639px) {
  .svc { gap: 6px; padding: 10px 8px; }
  .svc-icon { width: 26px; transform: scale(.78); }
  .svc-text strong { font-size: 13px; }
}
@media (min-width: 640px) {
  .svc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .svc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Two-column layout only: the panel scrolls on its own while the page keeps scrolling the left side. */
@media (min-width: 921px) {
  :root { --header-h: 60px; }
  .top { position: sticky; top: 0; z-index: 10; height: var(--header-h); padding-top: 0; padding-bottom: 0; }
  .top-actions { flex-wrap: nowrap; }
  .panel {
    position: sticky;
    top: calc(var(--header-h) + 20px);
    height: calc(100vh - var(--header-h) - 40px);
    display: flex;
    flex-direction: column;
  }
  .tabs { flex: none; }
  .tab-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--line) transparent;
  }
}

@media (max-width: 1500px) {
  .brand-tag { display: none; }
}

/* The header stays on one row in the two-column layout, so the status text gives way first. */
@media (min-width: 921px) and (max-width: 1240px) {
  #saveInfo, #exportInfo { display: none; }
}

@media (max-width: 920px) {
  .history { flex-wrap: wrap; }
  .top-actions { justify-content: flex-start; }
  .app { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .top { padding: 10px 16px; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .feed-home { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .stage-foot { flex-direction: column; }
  .feed-fields { grid-template-columns: minmax(0, 1fr); }
  .feed-side .feed-thumb { width: 45%; }
}

/* Reference thumbnail from the plan research page (reference.js). Shown only, never drawn into the canvas. */
.ref-panel { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ref-thumb { flex: none; width: 160px; line-height: 0; border-radius: 6px; overflow: hidden; background: #000; }
.ref-thumb-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.ref-body { min-width: 0; flex: 1; }
.ref-label { margin: 0; color: var(--accent); font-size: 12px; font-weight: 700; }
.ref-title { display: block; color: var(--text); font-size: 13px; font-weight: 700; line-height: 1.4; margin: 2px 0 6px; text-decoration: none; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ref-title:hover { text-decoration: underline; }
.ref-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.ref-toggle, .ref-opacity { display: inline-flex; align-items: center; gap: 6px; }
.ref-opacity input { width: 110px; }
.ref-opacity input:disabled { opacity: .4; }
.ref-note { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.ref-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; z-index: 1; }
.ref-overlay[hidden] { display: none; }
@media (max-width: 560px) {
  .ref-panel { flex-direction: column; }
  .ref-thumb { width: 100%; }
}
.ref-panel[hidden], .ref-restore[hidden] { display: none; }
.ref-restore { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 6px 10px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); font-size: 12px; color: var(--muted); }
.ref-restore-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-restore-title { color: var(--text); }
.ref-restore button { flex: none; }

/* Slider value boxes: type a number instead of dragging. */
.slider-head { align-items: center; gap: 8px; }
.slider-value { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.slider-num { width: 68px; padding: 2px 6px; font: inherit; font-size: 13px; text-align: right; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; -moz-appearance: textfield; }
.slider-num::-webkit-inner-spin-button, .slider-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.slider-num:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.slider-unit { color: var(--muted); font-size: 12px; min-width: 1em; }

/* Showcase gallery (gallery.js). */
.gallery-cta { margin: 0; padding: 6px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; font-size: 13px; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); }
.gallery-cta a { color: var(--accent); font-weight: 700; text-decoration: none; }
.gallery-cta a:hover { text-decoration: underline; }
.gallery { width: 100%; max-width: 1400px; margin: 0 auto; padding: 32px 20px 8px; scroll-margin-top: 70px; }
.gallery-head h2 { font-size: 22px; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.gallery-head h2::before { content: ""; width: 10px; height: 10px; background: var(--accent); border-radius: 2px; }
.gallery-head p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.gallery-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.gallery-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, transform .15s; }
.gallery-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.gallery-thumb { display: block; padding: 0; border: 0; border-radius: 0; background: #000; cursor: pointer; line-height: 0; }
.gallery-thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.gallery-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; flex: 1; }
.gallery-body h3 { font-size: 15px; margin: 0; }
.gallery-body p { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.gallery-open { margin-top: auto; width: 100%; }
@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* "Usage" page copy boxes and the credit request shown after export. */
.usage-copy { display: flex; align-items: stretch; gap: 8px; margin: 0 0 12px; }
.usage-copy pre { flex: 1; min-width: 0; margin: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-family: inherit; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: var(--text); }
.usage-copy button { flex: none; align-self: flex-start; }
.credit-nudge { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: min(360px, calc(100vw - 32px)); padding: 14px 40px 14px 16px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 13px; line-height: 1.6; }
.credit-nudge p { margin: 0 0 8px; color: var(--muted); }
.credit-nudge .credit-nudge-title { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.credit-nudge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.credit-nudge-more { color: var(--text); font-size: 12px; }
.credit-nudge-close { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.credit-nudge-close:hover { color: var(--text); }

/* Free-material pages: downloads shown on a grey checkerboard so both white and dark materials stay visible. */
.material-files { list-style: none; padding: 0 !important; margin: 0 0 16px; display: grid; gap: 14px; }
.material-file { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.material-file img { width: 100%; height: auto; display: block; border-radius: 6px; background: repeating-conic-gradient(#7d828b 0 25%, #666b74 0 50%) 0 0 / 24px 24px; object-fit: contain; aspect-ratio: 16 / 9; }
.material-file h3 { margin: 0 0 2px !important; }
.material-file p { color: var(--muted); font-size: 13px; margin: 0 0 8px !important; }
.material-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.material-actions a { display: inline-block; border-radius: var(--radius); padding: 8px 16px; font-weight: 700; text-decoration: none; font-size: 14px; }
.material-actions .dl { background: var(--accent); color: var(--accent-ink) !important; }
.material-actions .edit { border: 1px solid var(--line); color: var(--text, #fff) !important; }
.material-grid { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; }
.material-grid a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit !important; font-weight: 700; }
.material-grid a:hover { border-color: var(--accent); }
.material-grid img { width: 100%; height: auto; display: block; }
.material-grid span { display: block; padding: 8px 10px; font-size: 14px; }
@media (min-width: 640px) { .material-file { grid-template-columns: 240px minmax(0, 1fr); align-items: center; } }

/* Plan-idea pages: live examples of one plan type from the research database. */
.idea-videos { list-style: none; padding: 0 !important; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.idea-video { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.idea-video a { display: block; color: var(--text) !important; text-decoration: none; }
.idea-video img { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.idea-video strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.5; padding: 8px 10px 0; }
.idea-video p { margin: 0 !important; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.idea-nums { display: flex; gap: 10px; padding-bottom: 10px !important; }
.idea-hit { color: var(--accent); font-weight: 700; }
.idea-list { columns: 2; column-gap: 28px; }
@media (max-width: 560px) { .idea-list { columns: 1; } }

/* Plan insights (idea pages): number tiles, bar charts, word chips, strongest channels, and the hub ranking. */
.ins-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 0 0 18px; }
.ins-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.ins-tile strong { display: block; font-size: 22px; line-height: 1.3; color: var(--accent); }
.ins-tile span { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.ins-tile.up strong, .ins-table .up { color: #6fe08a; }
.ins-tile.down strong, .ins-table .down { color: #ffb56b; }
.ins-block { margin: 0 0 20px; }
.ins-bars { list-style: none; padding: 0 !important; margin: 0 0 6px !important; display: grid; gap: 6px; }
.ins-bars li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 7.5em; gap: 10px; align-items: center; font-size: 13px; }
.ins-track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.ins-fill { display: block; height: 100%; background: #6b7380; border-radius: 6px; }
.ins-bars li.best .ins-fill { background: var(--accent); }
.ins-bars li.best .ins-label { font-weight: 700; }
.ins-bars li.few { color: var(--muted); }
.ins-value { text-align: right; color: var(--muted); font-size: 12px; }
.ins-note { color: var(--muted); font-size: 12px; }
.ins-words { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px !important; }
.ins-words li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.ins-words a { font-weight: 700; text-decoration: none; }
.ins-words small { color: var(--muted); margin-left: 6px; }
.ins-channels { list-style: none; padding: 0 !important; display: grid; gap: 8px; margin: 0 0 6px !important; }
.ins-channels li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.ins-channels a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text) !important; font-weight: 700; min-width: 0; }
.ins-channels img { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.ins-channels small { color: var(--muted); flex: none; }
.ins-table-wrap { overflow-x: auto; }
.ins-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ins-table th, .ins-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.ins-table thead th { color: var(--muted); font-size: 12px; font-weight: 400; }
@media (max-width: 560px) { .ins-bars li { grid-template-columns: 6.5em minmax(0, 1fr) 6.5em; } }

/* Insight charts: the accent marks the point, gray is context; hairline grid, 1x reference line. */
.ins-track { position: relative; }
.ins-one { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; border-radius: 1px; }
.ins-one-key { display: inline-block; width: 2px; height: 12px; background: var(--text); opacity: .55; vertical-align: -1px; }
.ins-fill { border-radius: 0 4px 4px 0; }
.ins-bars li { outline-offset: 2px; border-radius: 4px; }
.ins-bars li:not(.few):hover .ins-fill, .ins-rank li:hover .ins-fill { filter: brightness(1.2); }
.ins-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ins-svg text { font-family: inherit; }
.ins-grid { stroke: var(--surface-2); stroke-width: 1; }
.ins-axis { stroke: var(--line); stroke-width: 1; }
.ins-ref { stroke: var(--text); stroke-opacity: .45; stroke-width: 1.5; }
.ins-tick { fill: var(--muted); font-size: 11px; }
.ins-capval { fill: var(--text); font-size: 13px; font-weight: 700; }
.ins-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ins-line-main { stroke: var(--accent); }
.ins-line-all { stroke: #8b93a1; }
.ins-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.ins-col { fill: #6b7380; }
.ins-cross { stroke: var(--muted); stroke-width: 1; }
.ins-spread { fill: #6b7380; outline: none; }
.ins-spread.hot { fill: var(--accent); }
.ins-spread:hover, .ins-spread:focus { filter: brightness(1.2); }
.ins-allmark { stroke: var(--text); stroke-width: 2; stroke-linecap: round; opacity: .8; }
.ins-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.ins-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ins-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--muted); vertical-align: middle; }
.ins-key.main { background: var(--accent); }
.ins-key.all { background: #8b93a1; }
.ins-key.bar { width: 10px; height: 10px; border-radius: 2px; background: #6b7380; }
.ins-key.hot { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.ins-key.none { display: none; }
.ins-legend .ins-key.all { background: var(--text); opacity: .8; height: 2px; }
.ins-tip { position: fixed; z-index: 50; pointer-events: none; background: #0d0f12; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12px; color: var(--muted); box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: 240px; }
.ins-tip p { margin: 0; display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.ins-tip strong { color: var(--text); font-size: 13px; }
.ins-tip-title { color: var(--text); font-weight: 700; }
.ins-rank-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 0 0 4px; padding: 0 4px; }
.ins-rank { list-style: none; padding: 0 !important; margin: 0 0 12px !important; display: grid; gap: 4px; }
.ins-rank li { display: grid; grid-template-columns: 1.5em 9.5em minmax(60px, 1fr) 4.2em 96px 6.5em; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--surface-2); font-size: 14px; }
.ins-rank-no { color: var(--muted); font-variant-numeric: tabular-nums; }
.ins-rank-name { font-weight: 700; text-decoration: none; }
.ins-rank-val { font-variant-numeric: tabular-nums; text-align: right; }
.ins-rank .ins-fill { background: #6b7380; }
.ins-rank li.best .ins-fill { background: var(--accent); }
.ins-rank-trend { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ins-rank-trend.up { color: #6fe08a; }
.ins-rank-trend.down { color: #ffb56b; }
.ins-spark { width: 96px; height: 28px; display: block; }
.ins-spark .ins-ref { stroke-width: 1; stroke-dasharray: none; }
.ins-spark-none { color: var(--muted); text-align: center; }
.ins-details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
@media (max-width: 640px) {
  .ins-rank li { grid-template-columns: 1.5em minmax(0, 1fr) auto; grid-template-areas: "no name val" ". bar bar" ". spark trend"; row-gap: 4px; }
  .ins-rank-no { grid-area: no; } .ins-rank-name { grid-area: name; } .ins-rank-val { grid-area: val; }
  .ins-rank .ins-track { grid-area: bar; } .ins-rank .ins-spark, .ins-rank .ins-spark-none { grid-area: spark; } .ins-rank-trend { grid-area: trend; text-align: right; }
}
.ins-capval.inside { fill: #ffffff; }
.ins-capval.inside.on-accent { fill: var(--accent-ink); }

/* Trends dashboard (trends.html). Reuses the insight chart pieces (.ins-*) from the plan-idea pages. */
.article.tr-page { max-width: 980px; }
.tr-section { margin: 34px 0 0; }
.tr-section h2 { margin-top: 0 !important; }
.tr-lead { color: var(--muted); font-size: 14px; }
.tr-wait { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 14px; }
.tr-area { fill: var(--accent); fill-opacity: .1; }
.tr-stack:hover rect, .tr-stack:focus rect { filter: brightness(1.15); }
.tr-stack { outline: none; }
.tr-rank li { grid-template-columns: 1.5em minmax(8em, 15em) minmax(60px, 1fr) 4.8em 6.5em; }
.tr-ch, .tr-video { display: flex; align-items: center; gap: 8px; min-width: 0; text-decoration: none; color: var(--text) !important; font-weight: 700; }
.tr-ch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-ch img { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.tr-video { flex-direction: column; align-items: flex-start; gap: 0; }
.tr-video span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
.tr-video small { color: var(--muted); font-weight: 400; font-size: 11px; }
@media (max-width: 640px) {
  .tr-rank li { grid-template-columns: 1.5em minmax(0, 1fr) auto; grid-template-areas: "no name val" ". bar bar" ". trend trend"; row-gap: 4px; }
  .tr-rank .ins-rank-no { grid-area: no; } .tr-rank .tr-ch, .tr-rank .tr-video { grid-area: name; } .tr-rank .ins-rank-val { grid-area: val; }
  .tr-rank .ins-track { grid-area: bar; } .tr-rank .ins-rank-trend { grid-area: trend; }
}

/* School pages: lesson plans (lesson-*.html) and their printable worksheets. */
.lesson-crumb { font-size: 13px; margin: 0 0 6px !important; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px !important; }
.lesson-meta span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: 13px; color: var(--muted); }
.lesson-meta span:first-child { color: var(--accent); border-color: var(--accent); }
.lesson-flow { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 12px; }
.lesson-flow th, .lesson-flow td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.lesson-flow thead th { color: var(--muted); font-size: 12px; font-weight: 400; }
.lesson-flow td:first-child { white-space: nowrap; color: var(--accent); font-weight: 700; }
.lesson-flow tbody th { white-space: nowrap; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 0; font-size: 14px; }
.school-tools { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.school-tools a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--text) !important; }
.school-tools a:hover { border-color: var(--accent); }
.school-tools span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.worksheet { margin: 32px 0 0; }
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ws-head h2 { margin: 0 !important; }
.ws-sheet { background: #ffffff; color: #1d1d1f; border-radius: var(--radius); padding: 24px; margin: 12px 0 8px; line-height: 1.6; }
.ws-sheet h3 { color: #1d1d1f; font-size: 15px; margin: 18px 0 8px !important; }
.ws-title { font-size: 20px; font-weight: 900; margin: 0 0 4px !important; }
.ws-name { border-bottom: 1px solid #1d1d1f; padding-bottom: 6px; margin: 0 0 16px !important; }
.ws-row { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 12px; align-items: end; margin: 0 0 14px; }
.ws-row.tall, .ws-row.sketch { align-items: start; }
.ws-label { font-weight: 700; font-size: 14px; }
.ws-label small { font-weight: 400; color: #555; }
.ws-line { display: block; min-height: 30px; border-bottom: 1px solid #1d1d1f; font-size: 13px; color: #555; }
.ws-boxes { font-size: 26px; letter-spacing: 2px; color: #1d1d1f; }
.ws-area { display: block; min-height: 84px; border: 1px solid #1d1d1f; border-radius: 4px; }
.ws-frame { display: block; aspect-ratio: 16 / 9; border: 2px solid #1d1d1f; border-radius: 4px; max-width: 420px; }
.ws-check { list-style: none; padding: 0 !important; margin: 0 0 14px !important; }
.ws-check li { padding-left: 1.6em; position: relative; margin: 4px 0; }
.ws-check li::before { content: "□"; position: absolute; left: 0; }
.ws-table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; }
.ws-table th, .ws-table td { border: 1px solid #1d1d1f; padding: 8px; height: 38px; text-align: left; }
.ws-table th { background: #f0f0f0; }
.ws-sheet a { color: #1d1d1f !important; }
@media (max-width: 560px) { .ws-row { grid-template-columns: minmax(0, 1fr); } .ws-sheet { padding: 16px; } }

@media print {
  body.print-worksheet { background: #ffffff !important; }
  body.print-worksheet > *:not(main) { display: none !important; }
  body.print-worksheet main > *:not(.worksheet) { display: none !important; }
  body.print-worksheet .worksheet > *:not(.ws-sheet) { display: none !important; }
  body.print-worksheet main, body.print-worksheet .worksheet { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  body.print-worksheet .ws-sheet { padding: 0; margin: 0; border-radius: 0; }
  @page { size: A4 portrait; margin: 14mm; }
}
