/* Cursor Maker — pastel pixel stationery */
:root {
  --ink: #3d86c6;
  --acc: #8fd0f7;
  --soft: #d4eefd;
  --deep: #1b5584;
  --paper: #fcfeff;
  --cream: #f2f9ff;
  --text: color-mix(in srgb, var(--deep) 78%, #141c26);
  --line: color-mix(in srgb, var(--ink) 48%, #fff);
  --shade: color-mix(in srgb, var(--ink) 26%, transparent);
  --r: 12px;
  --listw: 88px;
  --cur-arrow: auto;
  --cur-hand: pointer;
  --cur-text: text;
  --cur-cross: crosshair;
  --cur-no: not-allowed;
  --cur-move: move;
  color-scheme: light;
}

* { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: var(--ink) var(--cream); }
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-track { background: var(--cream); border: 1px solid var(--line); border-radius: 4px; }
  ::-webkit-scrollbar-thumb {
    background: var(--acc); border: 2px solid var(--ink); border-radius: 4px;
    box-shadow: inset 2px 2px 0 color-mix(in srgb, var(--paper) 75%, transparent);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--soft); border-color: var(--deep); }
  ::-webkit-scrollbar-thumb:active { background: var(--ink); }
  ::-webkit-scrollbar-corner { background: var(--cream); }
}
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Galmuri11", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 12px; line-height: 18px;
  font-synthesis: none;
  font-kerning: none;
  color: var(--text);
  background-color: var(--cream);
  background-image:
    linear-gradient(90deg, color-mix(in srgb, var(--soft) 52%, transparent) 50%, transparent 50%),
    linear-gradient(color-mix(in srgb, var(--soft) 52%, transparent) 50%, transparent 50%);
  background-size: 44px 44px;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .4s;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* own-cursor skin (values come from the pack) */
body.skin, body.skin * { cursor: var(--cur-arrow); }
body.skin button, body.skin label, body.skin .tog, body.skin summary { cursor: var(--cur-hand); }
body.skin input[type="text"] { cursor: var(--cur-text); }
body.skin button:disabled { cursor: var(--cur-no); }
body.skin .item *, body.skin .pv * { cursor: inherit; }

/* ------------------------------------------------------------ layout */
.app { height: 100%; padding: 10px; gap: 10px; }
.app[data-mode="land"] {
  display: grid;
  grid-template-columns: var(--listw) minmax(0, 1fr) minmax(250px, 320px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "list ed side";
}
.app[data-mode="land"].roomy { --listw: 206px; }
.app[data-mode="port"] {
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
}
.app[data-mode="port"] > * { flex: none; }
.top { grid-area: top; }
.list { grid-area: list; }
.editor { grid-area: ed; }
.side { grid-area: side; }

/* --------------------------------------------------------- windows */
.win {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r);
  box-shadow: 4px 4px 0 var(--shade);
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pop .55s cubic-bezier(.3, 1.45, .5, 1) both;
}
.list { animation-delay: .06s; }
.editor { animation-delay: .12s; }
.side { animation-delay: .18s; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.wbar {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  height: 26px; padding: 0 8px 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0;
  color: var(--deep);
  background: repeating-linear-gradient(90deg, var(--soft) 0 2px, transparent 2px 4px) 0 50% / 100% 8px no-repeat, var(--cream);
  border-bottom: 2px solid var(--line);
}
.wbar > span { background: var(--cream); padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbar em { font-style: normal; font-weight: 700; color: var(--text); background: var(--cream); padding: 0 6px; font-size: 12px; white-space: nowrap; }
.wbar i { margin-left: auto; width: 10px; height: 10px; flex: none; border: 2px solid var(--line); border-radius: 3px; background: #fff; box-shadow: -14px 0 0 -2px #fff, -14px 0 0 0 var(--line), -28px 0 0 -2px #fff, -28px 0 0 0 var(--line); }
.app.short .wbar { display: none; }
/* ------------------------------------------------------------ header */
.top {
  flex-direction: row; align-items: center; gap: 10px;
  padding: 7px 10px;
}
.top .btn { flex: none; }
.logo { display: flex; align-items: center; gap: 8px; flex: none; }
#logoCur { width: 40px; height: 40px; }
#logoTxt { height: 27px; }
.status { margin-left: auto; font-size: 12px; font-weight: 700; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app.narrow #logoTxt { display: none; }
.app.narrow .top { gap: 4px; }
.app.narrow .top .btn:not(.help) { padding-left: 6px; padding-right: 6px; }
.app.short .top { padding: 4px 8px; }
.app.short #logoCur { width: 32px; height: 32px; }

/* ----------------------------------------------------------- buttons */
.btn {
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  padding: 7px 14px; font-weight: 700; font-size: 12px; white-space: nowrap;
  box-shadow: 0 3px 0 var(--line);
  transition: transform .08s, box-shadow .08s, background-color .15s;
}
.btn:hover { background: var(--cream); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--acc); border-color: var(--deep); color: var(--deep); box-shadow: 0 3px 0 var(--deep); }
.btn.primary:hover { background: color-mix(in srgb, var(--acc) 85%, #fff); }
.btn.primary:active { box-shadow: 0 1px 0 var(--deep); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn.danger { color: #c0364f; }
.btn:disabled { opacity: .45; }
.row { display: flex; flex-wrap: wrap; gap: 6px; }

/* -------------------------------------------------------------- list */
.list-in {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 8px; display: grid; gap: 6px; align-content: start;
  grid-template-columns: 1fr;
}
.item {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  border: 2px solid transparent; border-radius: 10px; background: none;
  padding: 3px; text-align: left; min-width: 0;
}
.item canvas {
  width: 48px; height: 48px; flex: none; border-radius: 7px;
  background: conic-gradient(#eef4fa 25%, #fff 0 50%, #eef4fa 0 75%, #fff 0) 0 0 / 12px 12px;
  outline: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
}
.item span { font-size: 12px; font-weight: 700; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { display: block; font-size: 12px; opacity: .72; font-weight: 700; }
.item:hover { background: var(--cream); }
.item.on { border-color: var(--ink); background: var(--soft); }
.item.on canvas { animation: bob .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bob { 40% { transform: translateY(-4px) rotate(-4deg); } }
.app:not(.roomy) .item { justify-content: center; }
.app:not(.roomy) .item span { display: none; }

.app[data-mode="port"] .list { flex: none; }
.app[data-mode="port"] .list .wbar { display: none; }
.app[data-mode="port"] .list-in {
  grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 56px;
  overflow-x: auto; overflow-y: hidden; padding: 6px;
}
.app[data-mode="port"] .item { justify-content: center; padding: 2px; }
.app[data-mode="port"] .item canvas { width: 44px; height: 44px; }

/* ------------------------------------------------------------ editor */
.editor { min-height: 0; }
.board {
  flex: 1; min-height: 0; position: relative;
  display: grid; place-items: center;
  background: radial-gradient(color-mix(in srgb, var(--soft) 70%, transparent) 1.2px, transparent 1.6px) 0 0 / 14px 14px;
  overflow: hidden;
}
#ed {
  display: block; border-radius: 4px; touch-action: none;
  box-shadow: 0 0 0 2px var(--line), 5px 5px 0 2px var(--shade);
}
.app[data-mode="port"] .editor { flex: none; }
.app[data-mode="port"] .board { flex: none; aspect-ratio: 1 / 1; max-height: 78dvh; }

.edfoot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-top: 2px solid var(--line); background: var(--cream);
}
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 5px 12px; font-weight: 700; font-size: 12px; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button.on { background: var(--acc); color: var(--deep); }
.pvs { margin-left: auto; display: flex; gap: 6px; flex: none; }

/* frame strip */
.frames { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; }
.fthumbs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; padding: 3px 2px; }
.fthumb {
  position: relative; flex: none; width: 34px; height: 34px; padding: 0;
  border: 2px solid var(--line); border-radius: 10px;
  background: conic-gradient(#eef4fa 25%, #fff 0 50%, #eef4fa 0 75%, #fff 0) 0 0 / 8px 8px;
}
.fthumb canvas { width: 30px; height: 30px; display: block; }
.fthumb b { position: absolute; right: -3px; bottom: -4px; min-width: 15px; height: 15px; border-radius: 5px; padding: 0 2px; background: #fff; border: 1.5px solid var(--line); font: 700 12px/1 "Galmuri11", monospace; text-align: center; color: var(--text); }
.fthumb.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--soft); }
.fthumb.on b { background: var(--acc); border-color: var(--deep); color: var(--deep); }
.fbtn {
  flex: none; width: 28px; height: 28px; padding: 0;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  font-weight: 700; font-size: 24px; line-height: 1; color: var(--deep);
  box-shadow: 0 3px 0 var(--line);
}
.fbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.fbtn:disabled { opacity: .35; }
.fbtn.play { position: relative; background: var(--soft); }
.fbtn { display: grid; place-items: center; }
.fbtn .pix { width: 14px; height: 14px; }
.edfoot { flex-wrap: wrap; row-gap: 6px; }
.app.narrow .frames, .app[data-mode="port"] .frames { order: 3; flex-basis: 100%; }
/* short landscape (e.g. an embedded player): keep one footer row so the canvas stays big */
.app.short[data-mode="land"] .pvs { display: none; }
.app.short[data-mode="land"] .frames { order: 0; flex-basis: auto; }
.app.short[data-mode="land"] .edfoot { flex-wrap: nowrap; padding: 5px 8px; gap: 6px; }
.app.short[data-mode="land"] .seg { flex: none; }
.app.short[data-mode="land"] .seg button { padding: 5px 8px; white-space: nowrap; }
.app.short[data-mode="land"] .fthumbs { min-width: 40px; }
.app.short[data-mode="land"] { grid-template-columns: var(--listw) minmax(0, 1fr) minmax(232px, 300px); }

/* ANI badge on list thumbnails */
.item .ani {
  position: absolute; left: 2px; top: 35px; width: 16px; height: 16px;
  display: grid; place-items: center; padding: 0 0 0 1px;
  background: var(--acc); color: var(--deep); border-radius: 50%; box-shadow: 0 1px 0 var(--deep); pointer-events: none;
}
.item .ani .pix { width: 6px; height: 10px; }
.app[data-mode="port"] .item .ani { left: 1px; top: 31px; }
.pv { width: 44px; height: 38px; border-radius: 8px; display: grid; place-items: center; border: 2px solid var(--line); }
.pv canvas { width: 32px; height: 32px; }
.pv.light { background: #fff; }
.pv.dark { background: #26303a; }

/* -------------------------------------------------------------- side */
.tabs { flex: none; display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 2px solid var(--line); background: var(--cream); }
.tabs button {
  flex: 1; border: 2px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: #fff; padding: 6px 4px; font-weight: 700; font-size: 12px; margin-bottom: -2px;
  opacity: .7;
}
.tabs button.on { opacity: 1; background: var(--paper); border-color: var(--line); padding-bottom: 8px; color: var(--deep); }
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.app[data-mode="port"] .side { flex: none; }
.app[data-mode="port"] .pane { overflow: visible; }

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tools button {
  position: relative;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  padding: 8px 4px; font-weight: 700; font-size: 12px;
  box-shadow: 0 3px 0 var(--line);
}
.tools button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; white-space: nowrap; padding: 6px 1px 5px; line-height: 14px; }
.tools button kbd { position: absolute; top: 3px; right: 5px; font: 400 12px/1 "Galmuri11", monospace; opacity: .55; }
.tools button.on { background: var(--soft); border-color: var(--ink); color: var(--deep); box-shadow: 0 3px 0 var(--ink); }
.app.coarse .tools button kbd { display: none; }

.colors { display: flex; gap: 8px; align-items: stretch; }
.cur-color {
  position: relative; flex: none; width: 58px; border-radius: 10px;
  border: 2px solid var(--deep); display: flex; align-items: flex-end; justify-content: center; overflow: hidden;
  background: linear-gradient(var(--pick, #3a2620), var(--pick, #3a2620)), conic-gradient(#dfe7ee 25%, #fff 0 50%, #dfe7ee 0 75%, #fff 0) 0 0 / 10px 10px;
}
.cur-color input { position: absolute; inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); opacity: 0; }
.cur-color span { font: 700 12px/1 "Galmuri11", monospace; background: rgba(255, 255, 255, .85); padding: 2px 3px; border-radius: 4px 4px 0 0; }
.swatches { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.sw { aspect-ratio: 1; border-radius: 6px; border: 2px solid rgba(0, 0, 0, .08); padding: 0; min-width: 0; }
.sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; transform: scale(1.08); }
.recent { display: flex; gap: 4px; min-height: 18px; }
.recent .sw { width: 18px; height: 18px; aspect-ratio: auto; border-radius: 50%; }
.recent:empty::before { content: "Recent colors appear here"; font-size: 12px; opacity: .7; font-weight: 700; }

.tog { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; position: relative; user-select: none; }
.tog input { position: absolute; opacity: 0; pointer-events: none; }
.tog span { width: 30px; height: 18px; border-radius: 9px; background: #dfe7ee; border: 2px solid var(--line); position: relative; transition: background .15s; flex: none; }
.tog span::after { content: ""; position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 0 var(--line); transition: transform .15s; }
.tog input:checked + span { background: var(--acc); }
.tog input:checked + span::after { transform: translateX(12px); }
.tog input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.toggles { gap: 14px; }

.hint { margin: 0; font-size: 12px; line-height: 18px; opacity: .8; }
.hint b { color: var(--deep); }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.theme {
  border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  box-shadow: 0 3px 0 var(--line);
}
.theme .dots { display: flex; gap: 3px; }
.theme .dots i { width: 13px; height: 13px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .12); }
.theme.on { border-color: var(--ink); background: var(--cream); }

.motions { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.motion {
  border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 4px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 700;
  box-shadow: 0 3px 0 var(--line);
}
.motion canvas { width: 40px; height: 40px; }
.motion:active { transform: translateY(2px); box-shadow: 0 0 0 var(--line); }
.field { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.field select {
  flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 9px; background: #fff;
  padding: 5px 8px; font: inherit; font-weight: 700; color: var(--text);
}

/* ------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  backdrop-filter: blur(2px);
}
.dlg { width: min(440px, 100%); max-height: calc(100% - 8px); animation-duration: .4s; }
.dlg .wbar { height: 32px; font-size: 12px; }
.dlg .x { margin-left: auto; border: 2px solid var(--line); background: #fff; border-radius: 8px; width: 26px; height: 24px; color: var(--deep); padding: 0; font-size: 12px; font-weight: 700; line-height: 1; }
.dlg-in { padding: 14px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; font-size: 12px; }
.dlg-in p { margin: 0; line-height: 18px; }
.dlg-in .small { font-size: 12px; opacity: .75; line-height: 18px; }
.dlg-in code { font-size: 12px; background: var(--cream); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.dlg-in hr { border: 0; border-top: 2px dashed var(--line); margin: 2px 0; width: 100%; }
.dlg-in .row { justify-content: flex-end; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 8px; }
.steps li { counter-increment: s; display: flex; gap: 10px; align-items: baseline; line-height: 18px; font-size: 12px; }
.steps li::before {
  content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 7px;
  background: var(--acc); color: var(--deep); font-weight: 700; font-size: 12px;
  display: grid; place-items: center; box-shadow: 0 2px 0 var(--deep);
}
.steps em { font-style: normal; font-weight: 700; color: var(--deep); }

/* ------------------------------------------------ draw pane extras */
.sub {
  margin: 0 0 -4px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0; color: var(--deep); opacity: .8;
}
.sub::after { content: ""; flex: 1; border-top: 2px dotted var(--line); }
.pad {
  margin-top: auto; flex: none; position: relative; min-height: 120px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 2px dashed var(--line); border-radius: 12px; overflow: hidden;
}
.pad i { display: block; }
.pad .light { background: #fff; }
.pad .dark { background: #26303a; }
.pad .check { background: conic-gradient(var(--soft) 25%, #fff 0 50%, var(--soft) 0 75%, #fff 0) 0 0 / 16px 16px; }
.pad span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px;
  text-align: center; font-size: 12px; font-weight: 700; line-height: 16px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); border-top: 2px dashed var(--line);
}
.app:not([data-mode="land"]) .pad, .app:not(.tall) .pad { display: none; }
body.skin .pad * { cursor: inherit; }

/* portrait quick toolbar (tools stay next to the canvas) */
.quick, .quick-pal { display: none; }
.app[data-mode="port"] .quick {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px;
  padding: 8px 10px 3px; border-top: 2px solid var(--line); background: var(--cream);
}
.quick button {
  min-width: 0; height: 40px; padding: 0 2px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  font-weight: 700; font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden;
  box-shadow: 0 3px 0 var(--line);
}
.quick button.on { background: var(--soft); border-color: var(--ink); color: var(--deep); box-shadow: 0 3px 0 var(--ink); }
.quick button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.quick button:disabled { opacity: .45; }
.quick .ti { display: grid; place-items: center; }
.quick .qcolor { background: var(--pick, #3a2620); border-color: var(--deep); }
.app[data-mode="port"] .quick-pal:not([hidden]) {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  padding: 8px 10px 4px; background: var(--cream);
}
.app[data-mode="port"] .edfoot { border-top-style: dashed; }

/* bigger touch targets on phones / touch screens */
.app[data-mode="port"] .seg button, .app.coarse .seg button { padding: 10px 16px; font-size: 12px; }
.app[data-mode="port"] .fbtn, .app.coarse .fbtn { width: 40px; height: 40px; font-size: 24px; }
.app[data-mode="port"] .fbtn .pix, .app.coarse .fbtn .pix { width: 18px; height: 18px; }
.app[data-mode="port"] .fthumb, .app.coarse .fthumb { width: 40px; height: 40px; }
.app[data-mode="port"] .fthumb canvas, .app.coarse .fthumb canvas { width: 36px; height: 36px; }
.app[data-mode="port"] .btn.sm, .app.coarse .btn.sm { min-height: 40px; padding: 8px 12px; }
.app[data-mode="port"] .recent .sw, .app.coarse .recent .sw { width: 28px; height: 28px; }

/* Keep drawing, quick tools, layers and frames visible in a 400px player. */
.app.short[data-mode="port"] { padding: 8px; gap: 6px; }
.app.short[data-mode="port"] .top { position: sticky; top: 0; z-index: 4; }
.app.short[data-mode="port"] .list-in { grid-auto-columns: 48px; padding: 4px; }
.app.short[data-mode="port"] .item canvas { width: 36px; height: 36px; }
.app.short[data-mode="port"] .item .ani { top: 25px; }
.app.short[data-mode="port"] .board { aspect-ratio: auto; height: max(144px, calc(100dvh - 244px)); max-height: none; }
.app.short[data-mode="port"] .quick { padding: 6px 8px 3px; gap: 4px; }
.app.short[data-mode="port"] .pvs { display: none; }
.app.short[data-mode="port"] .edfoot { flex-wrap: nowrap; padding: 5px 6px; gap: 6px; }
.app.short[data-mode="port"] .seg { flex: none; }
.app.short[data-mode="port"] .seg button { padding: 7px 8px; }
.app.short[data-mode="port"] .frames { order: 0; flex-basis: auto; }
.app.short[data-mode="port"] .fthumbs { min-width: 40px; }

/* shortcut list in the last tutorial step */
.keys { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 7px 8px; align-items: center; font-size: 12px; line-height: 16px; }
.keys kbd {
  justify-self: start; min-width: 26px;
  font: 700 12px/1 "Galmuri11", monospace; color: var(--deep); text-align: center; white-space: nowrap;
  background: var(--cream); border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 4px 6px;
}

/* ---------------------------------------------------------- tutorial */
.btn.help { width: 34px; height: 34px; padding: 0; font-size: 24px; line-height: 1; font-weight: 700; color: var(--deep); flex: none; }
.btn.ghost { border-color: transparent; box-shadow: none; background: none; opacity: .7; padding-left: 4px; padding-right: 4px; }
.btn.ghost:hover { opacity: 1; background: none; }

/* ------------------------------------------------- background music */
.btn.bgm { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; color: var(--deep); flex: none; }
.btn.bgm .ti { grid-area: 1 / 1; }
.btn.bgm[aria-pressed="true"] { background: var(--soft); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.btn.bgm[aria-pressed="true"]:active { box-shadow: 0 1px 0 var(--ink); }
.btn.bgm[aria-pressed="true"] .off, .btn.bgm[aria-pressed="false"] .on { visibility: hidden; }
.btn.bgm[aria-pressed="false"] { color: color-mix(in srgb, var(--text) 70%, #fff); }
body.skin .credit a { cursor: var(--cur-hand); }
/* very narrow phones: the extra header button must not push Export off-screen */
@media (max-width: 399px) {
  .app.narrow .top .status { display: none; }
  .app.narrow .top .btn.bgm, .app.narrow .top .btn.help { width: 30px; }
  .app.narrow .top .btn:not(.help):not(.bgm) { padding-left: 4px; padding-right: 4px; }
}
.credit {
  flex: none; margin: 0; padding: 4px 10px 5px;
  border-top: 2px dashed var(--line); background: var(--cream);
  font-size: 12px; line-height: 16px; font-weight: 700; text-align: right;
  color: color-mix(in srgb, var(--text) 72%, #fff);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.credit a { color: var(--deep); text-decoration: underline dotted; text-underline-offset: 2px; padding: 2px 0; }
.credit a:hover { color: var(--ink); }
.app[data-mode="port"] .credit { padding: 8px 10px; }
.app[data-mode="port"] .credit a { padding: 8px 2px; }

.coach { position: fixed; inset: 0; z-index: 25; }
.coach.center { background: color-mix(in srgb, var(--ink) 30%, rgba(20, 30, 45, .2)); }
.coach-ring {
  position: fixed; pointer-events: none; border-radius: 14px;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 100vmax color-mix(in srgb, var(--ink) 30%, rgba(20, 30, 45, .2));
  transition: top .35s cubic-bezier(.3, 1.2, .5, 1), left .35s cubic-bezier(.3, 1.2, .5, 1), width .35s cubic-bezier(.3, 1.2, .5, 1), height .35s cubic-bezier(.3, 1.2, .5, 1);
}
.coach-ring::after {
  content: ""; position: absolute; inset: -9px; border-radius: 18px;
  border: 2px dashed #fff; opacity: .9;
  animation: ringPulse 1.3s ease-in-out infinite;
}
@keyframes ringPulse { 50% { transform: scale(1.025); opacity: .35; } }
.coach.center .coach-ring { display: none; }

.coach-card {
  position: fixed; width: min(330px, calc(100vw - 24px));
  padding: 12px 14px 12px; gap: 8px;
  box-shadow: 4px 4px 0 var(--shade), 0 10px 30px rgba(20, 50, 80, .18);
  transition: top .35s cubic-bezier(.3, 1.2, .5, 1), left .35s cubic-bezier(.3, 1.2, .5, 1);
  animation-duration: .45s;
}
.coach-head { display: flex; align-items: center; gap: 10px; }
#coachPet {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  background: var(--cream); border: 2px solid var(--line);
  animation: petBob 1.6s ease-in-out infinite;
}
@keyframes petBob { 50% { transform: translateY(-3px) rotate(-3deg); } }
.coach-step { display: inline-block; font: 700 12px/1 "Galmuri11", monospace; letter-spacing: 0; color: var(--deep); background: var(--acc); border-radius: 6px; padding: 3px 6px; box-shadow: 0 2px 0 var(--deep); }
.coach-card h3 { margin: 5px 0 0; font-size: 12px; font-weight: 700; color: var(--deep); line-height: 18px; }
.coach-card p { margin: 0; font-size: 12px; line-height: 18px; }
.coach-card p b { color: var(--deep); }
.coach-foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.coach-dots { display: flex; gap: 4px; margin-right: auto; }
.coach-dots i { width: 7px; height: 7px; border-radius: 2px; background: var(--soft); transition: width .2s, background-color .2s; }
.coach-dots i.on { width: 16px; background: var(--acc); }
.app.short ~ .coach .coach-card { padding: 9px 12px; gap: 5px; }
.app.short ~ .coach #coachPet { width: 36px; height: 36px; }
/* long steps (shortcut list) stay inside short viewports: the text scrolls, the buttons stay visible */
.coach-card { max-height: calc(100dvh - 24px); }
.coach-card p { min-height: 0; overflow-y: auto; }
.app.short ~ .coach .keys { gap: 3px 8px; }

/* ------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 18px; z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--paper); border: 2px solid var(--ink); color: var(--deep);
  border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: 12px;
  box-shadow: 3px 3px 0 var(--shade); max-width: calc(100vw - 24px); white-space: normal; text-align: center;
  transition: opacity .2s, transform .25s cubic-bezier(.3, 1.5, .5, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* pixel icons (drawn by app.js) */
.ti { display: inline-grid; place-items: center; flex: none; font-style: normal; }
.pix { display: block; }
.pix .o { fill: currentColor; }
.pix .a { fill: var(--acc); }
.pix .b { fill: var(--soft); }
.pix .w { fill: #fff; }
.tools button.on .pix .o, .quick button.on .pix .o { fill: var(--deep); }

/* start-over buttons */
.restart { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.restart .btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 9px; white-space: normal; line-height: 16px; text-align: center; }
.restart .ti canvas { width: 48px; height: 48px; border-radius: 8px; background: conic-gradient(#eef4fa 25%, #fff 0 50%, #eef4fa 0 75%, #fff 0) 0 0 / 12px 12px; }

/* opacity */
.opacity { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.opacity input { flex: 1; min-width: 0; accent-color: var(--ink); }
.opacity b { width: 36px; text-align: right; font-weight: 700; color: var(--deep); }

/* pack name inside the export dialog */
.dlg-in .field.name input {
  flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 9px; background: #fff;
  padding: 6px 9px; font: inherit; font-weight: 700; color: var(--text); outline: none;
}
.dlg-in .field.name input:focus { border-color: var(--ink); }
.dlg-in .field.name input::placeholder { color: color-mix(in srgb, var(--text) 45%, #fff); }
