/* counter.html — the add / edit counter form and its คลัง dock, new theme.
   Loaded after counter-v2.css. Markup is js/counter.js's renderEditor family
   (ce-* classes). The team is laid out as the same lane the counter cards
   use (css/counter-v2.css .cv-lane): pets on top in round frames, then 5
   columns with the back row raised and the front row lowered. */

/* ===== Tier / accent colours (same hues as css/castle.css) ===== */
:is(.ce-slot, .ce-avatar, .ce-gear) { --tier: 250, 250, 250; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="0"] { --tier: 251, 146, 60; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="1"] { --tier: 245, 166, 35; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="2"] { --tier: 232, 121, 249; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="3"] { --tier: 167, 139, 250; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="4"] { --tier: 129, 140, 248; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="5"] { --tier: 248, 113, 113; }
:is(.ce-slot, .ce-avatar, .ce-gear)[data-tier="6"] { --tier: 96, 165, 250; }
.counter-page .ce { --back: 244, 114, 182; --front: 96, 165, 250; --g: 190, 242, 100; }

/* ===== Shell ===== */
.counter-page .counter-editor.ce { overflow: hidden; isolation: isolate; }
.counter-page .ce > .ce-glow { position: absolute; }
.counter-page .ce:hover > .ce-glow { opacity: .55; }
.counter-page .ce > .counter-editor-form { position: relative; z-index: 1; }
/* a faint grid in the top-right corner, fading out (like the Tools cards) */
.counter-page .ce::before {
  content: ''; position: absolute; inset: 0 0 auto auto; width: min(620px, 70%); height: 320px; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(90% 90% at 100% 0%, #000 10%, transparent 70%); mask-image: radial-gradient(90% 90% at 100% 0%, #000 10%, transparent 70%);
}
.counter-page .ce .counter-editor-form.dock-open { padding-bottom: calc(min(46vh, 430px) + 36px); }
.counter-page .ce .counter-editor-form.dock-collapsed { padding-bottom: 80px; }

/* ===== Head: title + "ตีทีม" strip, progress pills on the right ===== */
.ce-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 24px; flex-wrap: wrap; }
.ce-title { font-size: clamp(26px, 2.6vw, 40px); line-height: 1.1; letter-spacing: -.01em; }
.ce-vs { display: flex; align-items: center; gap: 0; margin-top: 12px; }
.ce-vs:empty { display: none; }
.ce-vs-tag {
  margin-right: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(244, 63, 94, .12); color: #fb7185; font: 700 11.5px 'Anuphan', sans-serif;
}
.ce-vs .ce-avatar { width: 34px; height: 34px; margin-left: -6px; box-shadow: 0 0 0 2px #0a0a0a; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.ce-vs .ce-avatar:first-of-type { margin-left: 0; }
.ce-vs .ce-avatar:hover { transform: translateY(-3px); z-index: 1; }

.ce-progress { display: flex; gap: 8px; flex-wrap: wrap; }
.ce-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: #121212; border: 1px solid var(--h-line); color: var(--h-muted);
  font: 600 12.5px 'Anuphan', sans-serif; transition: border-color .3s, color .3s, background .3s;
}
.ce-pill b { font: 700 12px 'Inter', sans-serif; font-variant-numeric: tabular-nums; color: var(--h-fg); }
.ce-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #525252; transition: background .3s, box-shadow .3s; }
.ce-pill.is-full { border-color: rgba(190, 242, 100, .35); color: var(--h-fg); background: rgba(190, 242, 100, .06); }
.ce-pill.is-full .ce-pill-dot { background: var(--h-lime); box-shadow: 0 0 10px var(--h-lime); }

/* Shared small portrait with a tier ring */
.ce-avatar {
  position: relative; display: block; flex-shrink: 0; width: 28px; height: 28px; border-radius: 9px; overflow: hidden; background: #0a0a0a;
}
.ce-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); }
.ce-avatar::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1.5px rgba(var(--tier), .85); }
.ce-avatar.sm { width: 22px; height: 22px; border-radius: 7px; }
.ce-avatar.lg { width: 54px; height: 54px; border-radius: 15px; box-shadow: 0 10px 22px rgba(0, 0, 0, .5), 0 0 18px rgba(var(--tier), .18); }
.ce-avatar.lg::after { box-shadow: inset 0 0 0 1.5px rgba(var(--tier), .85), inset 0 -16px 18px -14px rgba(var(--tier), .8); }

/* ===== Numbered steps ===== */
.ce-step { margin-top: 34px; }
.ce-step-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ce-step-num {
  display: grid; place-items: center; min-width: 34px; height: 24px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--h-line); background: #0d0d0d; color: var(--h-muted);
  font: 800 11px 'JetBrains Mono', monospace; letter-spacing: .04em;
  transition: background .35s, color .35s, border-color .35s, box-shadow .35s;
}
.ce-step-head h3 { margin: 0; font: 800 17px 'Anuphan', sans-serif; color: var(--h-fg); }
.ce-step-head em { flex: 1 1 40px; height: 1px; background: linear-gradient(90deg, var(--h-line), transparent); }
.ce-step-head small { font: 500 12px 'Anuphan', sans-serif; color: #7a7a7a; }
/* A step's number lights lime once there's something in it. */
.ce-step:is(
  :has(#counterNameInput:not(:placeholder-shown)),
  :has(#counterPatternChoices),
  :has(.ce-count.is-full),
  :has(.ce-stat.has-val, .ce-kit-slot.is-filled),
  :has(#counterTeamNoteInput:not(:placeholder-shown))
) .ce-step-num {
  background: var(--h-lime); border-color: var(--h-lime); color: #0a0a0a; box-shadow: 0 0 16px rgba(190, 242, 100, .35);
}

/* ===== 01 name ===== */
.ce-field { position: relative; }
.ce-field-ico { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: #6b6b6b; pointer-events: none; transition: color .25s, rotate .4s cubic-bezier(.34, 1.56, .64, 1); }
.ce-field:focus-within .ce-field-ico { color: var(--h-lime); rotate: -12deg; }
.ce-input {
  width: 100%; box-sizing: border-box; padding: 14px 18px; border-radius: 16px;
  background: #0b0b0b; border: 1px solid var(--h-line); color: var(--h-fg);
  font: 600 14.5px 'Anuphan', sans-serif; transition: border-color .25s, box-shadow .25s, background .25s;
}
.ce-field .ce-input { padding-left: 46px; }
.ce-input::placeholder { color: #5c5c5c; font-weight: 500; }
.ce-input:hover { border-color: rgba(250, 250, 250, .2); }
.ce-input:focus { outline: none; border-color: var(--h-lime-line); background: #0d0d0d; box-shadow: 0 0 0 4px rgba(190, 242, 100, .1); }

/* ===== 02 pattern cards: the pattern drawn as a mini lane ===== */
.ce-patterns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ce-pattern {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 12px 14px; overflow: hidden;
  border-radius: 18px; background: #0c0c0c; border: 1px solid var(--h-line); color: var(--h-muted); cursor: pointer;
  font: inherit; transition: border-color .25s, background .25s, color .25s, transform .35s cubic-bezier(.23, 1, .32, 1), box-shadow .35s;
}
.ce-pattern::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 70% at 50% 0%, rgba(190, 242, 100, .12), transparent 70%); opacity: 0; transition: opacity .35s;
}
.ce-pattern:hover { transform: translateY(-3px); border-color: rgba(250, 250, 250, .25); color: var(--h-fg); }
.ce-pattern:active { transform: translateY(-1px) scale(.98); }
.ce-pattern:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-pattern.is-on { border-color: var(--h-lime-line); color: var(--h-fg); background: #0f110b; box-shadow: 0 0 0 3px rgba(190, 242, 100, .1), 0 14px 30px rgba(0, 0, 0, .45); }
.ce-pattern.is-on::before { opacity: 1; }
.ce-pattern-lane { display: grid; grid-template-columns: repeat(5, 20px); gap: 5px; height: 36px; margin-bottom: 4px; }
.ce-pip {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px;
  font: 800 10px 'Inter', sans-serif; color: #fff; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.ce-pip.is-back { align-self: start; background: rgba(var(--back), .85); }
.ce-pip.is-front { align-self: end; background: rgba(var(--front), .9); }
.ce-pip.is-none { background: transparent; }
.ce-pattern:not(.is-on) .ce-pip { filter: saturate(.35) brightness(.75); }
.ce-pattern:hover .ce-pip:nth-child(1) { transform: translateY(-3px); transition-delay: 0s; }
.ce-pattern:hover .ce-pip:nth-child(2) { transform: translateY(-3px); transition-delay: .04s; }
.ce-pattern:hover .ce-pip:nth-child(3) { transform: translateY(-3px); transition-delay: .08s; }
.ce-pattern:hover .ce-pip:nth-child(4) { transform: translateY(-3px); transition-delay: .12s; }
.ce-pattern:hover .ce-pip:nth-child(5) { transform: translateY(-3px); transition-delay: .16s; }
.ce-pattern-name { position: relative; font: 800 13.5px 'Anuphan', sans-serif; }
.ce-pattern-sub { position: relative; font: 500 11.5px 'Anuphan', sans-serif; color: #7a7a7a; }

/* ===== 03 stage: pets on top, then the lane ===== */
.ce-stage {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding: 26px clamp(14px, 2vw, 30px) 20px; border-radius: 24px; border: 1px solid var(--h-line);
  background-color: #090909;
  background-image: radial-gradient(60% 55% at 50% 100%, rgba(190, 242, 100, .05), transparent 70%), radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: auto, 18px 18px;
}
.ce-stage > div { width: 100%; display: flex; flex-direction: column; align-items: center; }

/* pets */
.ce-pets {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 18px; border-radius: 999px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--h-line);
}
.ce-pets-label { margin-right: 4px; font: 700 12px 'Anuphan', sans-serif; color: var(--h-muted); }
.ce-pet {
  position: relative; display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  background: #0b0b0b; color: #5a5a5a; cursor: pointer;
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s, color .25s;
}
.ce-pet.is-main { width: 58px; height: 58px; }
.ce-pet.is-empty { border: 1.5px dashed rgba(250, 250, 250, .16); }
.ce-pet.is-empty .ce-plus { width: 16px; height: 16px; transition: rotate .45s cubic-bezier(.23, 1, .32, 1); }
.ce-pet.is-empty:hover { color: var(--h-fg); border-color: rgba(250, 250, 250, .4); }
.ce-pet.is-empty:hover .ce-plus { rotate: 90deg; }
.ce-pet.is-filled { box-shadow: 0 8px 18px rgba(0, 0, 0, .5); }
.ce-pet.is-filled img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; transform: scale(1.12); }
.ce-pet.is-filled::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; box-shadow: inset 0 0 0 1.5px rgba(244, 114, 182, .6); }
.ce-pet.is-main.is-filled { box-shadow: 0 0 18px rgba(234, 179, 8, .22), 0 10px 20px rgba(0, 0, 0, .5); }
.ce-pet.is-main.is-filled::after { box-shadow: inset 0 0 0 2px rgba(234, 179, 8, .8); }
.ce-pet.is-main.is-empty { border-color: rgba(234, 179, 8, .35); }
.ce-pet:hover { transform: translateY(-3px); }
.ce-pet:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 3px; }
.ce-pet-remove { top: -3px; right: -3px; }

/* the lane */
.ce-lane {
  --slot: clamp(62px, 6.4vw, 96px);
  --dotcol: 26px;
  position: relative; display: grid; grid-template-columns: repeat(5, calc(var(--slot) + var(--dotcol) + 6px)); gap: clamp(6px, .9vw, 14px); align-items: start;
}
.ce-lane::after {
  content: ''; position: absolute; left: -24px; right: -24px; bottom: -10px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14) 20%, rgba(255, 255, 255, .14) 80%, transparent);
}
.ce-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* portrait + its A / U / L column to the right, like the old editor */
.ce-col-main { display: flex; align-items: center; gap: 6px; }
.ce-col .ce-row-tag { margin-right: calc(var(--dotcol) + 6px); }
.ce-col.is-front { padding-top: calc(var(--slot) * .45); }
.ce-row-tag { font: 600 10.5px 'Anuphan', sans-serif; color: #5f5f5f; }
.ce-col.is-back .ce-row-tag { color: rgba(var(--back), .6); }
.ce-col.is-front .ce-row-tag { color: rgba(var(--front), .7); }

.ce-slot {
  position: relative; display: grid; place-items: center; width: var(--slot); height: var(--slot); border-radius: 18px;
  background: #0b0b0b; color: #5f5f5f; cursor: pointer; -webkit-user-select: none; user-select: none;
  transition: transform .35s cubic-bezier(.23, 1, .32, 1), box-shadow .3s, border-color .25s, color .25s, opacity .25s;
}
.ce-slot:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 3px; }
.ce-slot.is-empty { border: 1.5px dashed rgba(250, 250, 250, .16); }
.ce-slot.is-empty .ce-plus { transition: rotate .45s cubic-bezier(.23, 1, .32, 1), scale .3s; }
.ce-slot.is-empty:hover { color: var(--h-fg); border-color: rgba(250, 250, 250, .42); transform: translateY(-3px); }
.ce-slot.is-empty:hover .ce-plus { rotate: 90deg; scale: 1.1; }
.ce-slot.is-locked {
  cursor: not-allowed; color: #3d3d3d; border: 1px solid rgba(255, 255, 255, .06);
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .025) 0 6px, transparent 6px 12px), #0b0b0b;
}
.ce-slot.is-locked:hover { transform: none; color: #5a5a5a; border-color: rgba(255, 255, 255, .1); }
.ce-slot.is-filled { overflow: hidden; cursor: grab; box-shadow: 0 12px 26px rgba(0, 0, 0, .55); }
.ce-slot.is-filled:active { cursor: grabbing; }
.ce-slot.is-filled img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.11); transition: transform .45s cubic-bezier(.23, 1, .32, 1); pointer-events: none; }
.ce-slot.is-filled::after {
  content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1.5px rgba(var(--tier), .85), inset 0 -18px 20px -14px rgba(var(--tier), .8);
  transition: box-shadow .3s;
}
.ce-slot.is-filled:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(0, 0, 0, .6), 0 0 22px rgba(var(--tier), .3); }
.ce-slot.is-filled:hover img { transform: scale(1.19); }
.ce-slot-num {
  position: absolute; top: 6px; left: 6px; z-index: 2; padding: 1px 7px; border-radius: 999px;
  font: 700 10px 'JetBrains Mono', monospace; color: #fff; background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.ce-col.is-back .ce-slot-num { box-shadow: inset 0 0 0 1px rgba(var(--back), .7); }
.ce-col.is-front .ce-slot-num { box-shadow: inset 0 0 0 1px rgba(var(--front), .75); }
.ce-slot.is-empty .ce-slot-num { background: transparent; color: #6b6b6b; }
/* waiting for a pick from the คลัง: lime ring that breathes */
.ce-slot.is-waiting, .ce-pet.is-waiting, .ce-kit-slot.is-waiting {
  color: var(--h-lime); border: 1.5px solid var(--h-lime) !important;
  animation: ce-wait 1.6s ease-in-out infinite;
}
@keyframes ce-wait {
  0%, 100% { box-shadow: 0 0 0 3px rgba(190, 242, 100, .14), 0 0 14px rgba(190, 242, 100, .25); }
  50% { box-shadow: 0 0 0 6px rgba(190, 242, 100, .06), 0 0 26px rgba(190, 242, 100, .45); }
}
.ce-slot.is-dragging { opacity: .35; }
.ce-slot.is-dragover { transform: scale(1.06); box-shadow: 0 0 0 2px var(--h-lime), 0 0 24px rgba(190, 242, 100, .35); }
.is-landed { animation: slot-land .45s cubic-bezier(.23, 1, .32, 1); }

/* remove buttons (hero / pet / gear) */
.ce-slot-remove, .ce-pet-remove, .ce-kit-remove {
  position: absolute; z-index: 3; display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer; background: rgba(10, 10, 10, .78); color: #e5e5e5;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; scale: .7; transition: opacity .2s, scale .25s cubic-bezier(.34, 1.56, .64, 1), background .2s, color .2s;
}
/* a bigger invisible hit area around the small circle */
:is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove)::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; }
:is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove) svg { transition: rotate .3s cubic-bezier(.34, 1.56, .64, 1); }
.ce-slot-remove { top: 4px; right: 4px; width: 26px; height: 26px; }
.ce-slot-remove svg { width: 14px; height: 14px; }
.ce-pet-remove { width: 22px; height: 22px; }
.ce-kit-remove { top: -8px; right: -8px; width: 22px; height: 22px; }
:is(.ce-slot, .ce-pet, .ce-kit-slot):is(:hover, :focus-within) > :is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove) { opacity: 1; scale: 1; }
:is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove):hover { background: var(--h-rose); color: #fff; }
:is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove):is(:hover, :focus-visible) svg { rotate: 90deg; }
:is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove):focus-visible { opacity: 1; scale: 1; outline: 2px solid var(--h-lime); }
@media (hover: none) { :is(.ce-slot-remove, .ce-pet-remove, .ce-kit-remove) { opacity: 1; scale: 1; } }

/* A / U / L skill-order buttons, stacked beside each hero. Picked ones turn
   lime with their place in the order (1-3) on a small badge. */
.ce-dots { display: flex; flex-direction: column; gap: 5px; width: var(--dotcol); }
.ce-dots.is-ghost { visibility: hidden; }
.ce-dot {
  position: relative; display: grid; place-items: center; width: var(--dotcol); height: var(--dotcol); padding: 0; border-radius: 9px; cursor: pointer;
  background: #151515; border: 1px solid rgba(255, 255, 255, .24); color: #c4c4c4;
  font: 800 11px 'JetBrains Mono', monospace;
  transition: background .2s, color .2s, border-color .2s, box-shadow .3s, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.ce-dot:hover { color: var(--h-fg); border-color: rgba(255, 255, 255, .5); background: #181818; transform: translateX(2px); }
.ce-dot:active { transform: scale(.9); }
.ce-dot:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-dot.is-full { opacity: .4; }
.ce-dot.is-full:hover { opacity: 1; }
.ce-dot.is-on { background: var(--h-lime); border-color: var(--h-lime); color: #0a0a0a; box-shadow: 0 0 14px rgba(190, 242, 100, .35); animation: ce-dot-on .4s cubic-bezier(.34, 1.56, .64, 1); }
.ce-dot.is-on:hover { background: #d9f99d; }
.ce-dot i {
  position: absolute; top: -6px; right: -7px; display: grid; place-items: center; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: #0a0a0a; color: var(--h-lime); box-shadow: 0 0 0 1px rgba(190, 242, 100, .7);
  font: 800 9px 'Inter', sans-serif; font-style: normal; box-sizing: border-box;
}
@keyframes ce-dot-on { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } }

/* footer under the lane */
.ce-lane-foot { display: flex; align-items: center; justify-content: center; gap: 10px 22px; flex-wrap: wrap; margin-top: 18px; font: 600 12px 'Anuphan', sans-serif; color: var(--h-muted); }
.ce-count { padding: 5px 12px; border-radius: 999px; background: #121212; border: 1px solid var(--h-line); transition: border-color .3s, background .3s; }
.ce-count b { font: 800 13px 'Inter', sans-serif; color: var(--h-fg); }
.ce-count.is-full { border-color: rgba(190, 242, 100, .4); background: rgba(190, 242, 100, .07); }
.ce-count.is-full b { color: var(--h-lime); }
.ce-legend { display: inline-flex; align-items: center; gap: 6px; }
.ce-legend i { width: 8px; height: 8px; border-radius: 3px; }
.ce-legend i.is-back { background: rgb(var(--back)); }
.ce-legend i.is-front { margin-left: 8px; background: rgb(var(--front)); }
.ce-order { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.ce-order-label { margin-right: 2px; }
.ce-order-item { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 3px; border-radius: 999px; background: rgba(190, 242, 100, .07); box-shadow: inset 0 0 0 1px rgba(190, 242, 100, .28); }
.ce-order-item em { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--h-lime); color: #0a0a0a; font: 800 9.5px 'Inter', sans-serif; font-style: normal; }
.ce-order-item b { font: 700 12px 'Anuphan', sans-serif; color: var(--h-fg); white-space: nowrap; }
.ce-order-arrow { font-style: normal; color: #5a5a5a; }
/* the skill's own icon (js/skill-icons.js) between the hero and the number */
.ce-order-skill { width: 26px; height: 26px; margin-left: -2px; border-radius: 7px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }

/* ✦ by ลำดับสกิล: opens the team's skill panel under the lane */
.ce-skill-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px 0 10px; border-radius: 999px; cursor: pointer;
  background: #121212; border: 1px solid rgba(245, 215, 122, .4); color: #f5d77a; font: 700 12px 'Anuphan', sans-serif;
  transition: background .2s, color .2s, border-color .2s, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.ce-skill-toggle:hover { background: rgba(245, 215, 122, .1); border-color: rgba(245, 215, 122, .7); transform: translateY(-1px); }
.ce-skill-toggle:active { transform: scale(.96); }
.ce-skill-toggle:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-skill-toggle.is-open { background: #f5d77a; border-color: #f5d77a; color: #0a0a0a; }

/* the skill panel: under the lane, one group per hero, big icons to tap in order */
.ce-skill-panel {
  margin: 22px auto 0; max-width: 820px; padding: 12px 16px 16px; border-radius: 18px;
  background: #0e0e0e; border: 1px solid var(--h-line);
  animation: ce-skill-in .28s cubic-bezier(.23, 1, .32, 1);
}
@keyframes ce-skill-in { from { opacity: 0; transform: translateY(-6px); } }
.ce-skill-groups { display: flex; justify-content: center; flex-wrap: wrap; row-gap: 14px; margin-top: 12px; }
/* a hairline between heroes, with the same air on both sides of it */
.ce-skill-group { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 24px; }
.ce-skill-group + .ce-skill-group { border-left: 1px solid var(--h-line); }
.ce-skill-who { display: flex; align-items: center; gap: 7px; }
.ce-skill-who b { font: 700 12.5px 'Anuphan', sans-serif; color: var(--h-fg); }
.ce-skill-who em { font: 600 11px 'Anuphan', sans-serif; font-style: normal; color: #6b6b6b; }
.ce-skill-head { display: flex; align-items: center; gap: 8px; }
.ce-skill-head b { font: 700 13px 'Anuphan', sans-serif; color: var(--h-fg); }
.ce-skill-tiles { display: flex; justify-content: center; gap: 12px; }
.ce-skill-hint { flex: 1; min-width: 0; font: 500 11.5px 'Anuphan', sans-serif; color: #6b6b6b; }
.ce-skill-close {
  position: relative; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: #161616; color: #bdbdbd; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); transition: background .2s, color .2s;
}
.ce-skill-close::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
.ce-skill-close:hover { background: #222; color: #fff; }
.ce-skill-close:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-skill-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--h-muted);
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), opacity .2s;
}
.ce-skill-tile:hover { transform: translateY(-2px); color: var(--h-fg); }
.ce-skill-tile:active { transform: scale(.94); }
.ce-skill-tile:focus-visible { outline: none; }
.ce-skill-tile:focus-visible .ce-skill-art { outline: 2px solid var(--h-lime); outline-offset: 3px; }
.ce-skill-tile.is-full { opacity: .45; }
.ce-skill-tile.is-full:hover { opacity: 1; }
.ce-skill-art {
  position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px;
  background: #151515; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.ce-skill-art img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.ce-skill-letter { font: 800 14px 'JetBrains Mono', monospace; color: #c4c4c4; }
.ce-skill-tile.is-on .ce-skill-art { box-shadow: 0 0 0 2px var(--h-lime), 0 0 16px rgba(190, 242, 100, .3); }
.ce-skill-tile.is-on { color: var(--h-lime); }
.ce-skill-art i {
  position: absolute; top: -7px; right: -7px; z-index: 1; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px;
  background: var(--h-lime); color: #0a0a0a; box-shadow: 0 0 0 2px #0e0e0e;
  font: 800 11px 'Inter', sans-serif; font-style: normal; box-sizing: border-box;
}
.ce-skill-name { font: 600 11.5px 'Anuphan', sans-serif; }
.ce-muted { color: #5f5f5f; font-weight: 500; }

/* ===== 04 gear ===== */
.ce-empty {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px; border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, .1); color: #6b6b6b; font: 600 13px 'Anuphan', sans-serif;
}
/* Speed order as a race track (js renderSpeedTrack) */
.ce-speed {
  position: relative; margin-bottom: 16px; padding: 14px 16px 16px; border-radius: 20px; overflow: hidden; isolation: isolate;
  background: #0a0a0a; border: 1px solid var(--h-line); transition: border-color .4s;
}
.ce-speed::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 36px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}
.ce-speed.is-ready { border-color: rgba(34, 211, 238, .3); }
.ce-speed.is-ready::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 120% at 0% 50%, rgba(34, 211, 238, .1), transparent 70%);
}
.ce-speed-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ce-speed-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #22d3ee; background: rgba(34, 211, 238, .12); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .3); }
.ce-speed.is-ready .ce-speed-ico { animation: ce-zap 2.4s ease-in-out infinite; }
@keyframes ce-zap { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-14deg) scale(1.15); } 90% { transform: rotate(10deg) scale(1.1); } }
.ce-speed-head b { font: 800 14px 'Anuphan', sans-serif; color: var(--h-fg); }
.ce-speed-note { padding: 3px 10px; border-radius: 999px; background: rgba(234, 179, 8, .1); color: #facc15; font: 600 11.5px 'Anuphan', sans-serif; }
.ce-speed-note.is-ready { background: rgba(34, 211, 238, .1); color: #67e8f9; }
.ce-speed-hint { margin-left: auto; font: 500 11.5px 'Anuphan', sans-serif; color: #6b6b6b; }
.ce-speed-track { display: flex; align-items: center; }
.ce-runner {
  position: relative; display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; padding: 7px 14px 7px 7px; border-radius: 16px;
  background: #121212; border: 1px solid rgba(255, 255, 255, .07);
  transition: border-color .3s, background .3s, transform .35s cubic-bezier(.23, 1, .32, 1);
}
.ce-runner:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .18); }
.ce-runner .ce-avatar { width: 38px; height: 38px; border-radius: 11px; }
.ce-runner-rank {
  display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: #1c1c1c; color: #6b6b6b; font: 800 12px 'Inter', sans-serif; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.ce-speed.is-ready .ce-runner-rank { background: rgba(34, 211, 238, .14); color: #67e8f9; box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .4); }
.ce-runner-text { display: flex; flex-direction: column; min-width: 0; }
.ce-runner-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 13px 'Anuphan', sans-serif; color: var(--h-fg); }
.ce-runner-text small { font: 700 11.5px 'Inter', 'Anuphan', sans-serif; font-variant-numeric: tabular-nums; color: #67e8f9; }
.ce-runner.is-missing { border-style: dashed; }
.ce-runner.is-missing .ce-runner-text small { color: #6b6b6b; font-weight: 500; font-style: italic; }
.ce-speed.is-ready .ce-runner.is-first { background: linear-gradient(90deg, rgba(190, 242, 100, .1), #121212 70%); border-color: rgba(190, 242, 100, .4); }
.ce-speed.is-ready .ce-runner.is-first .ce-runner-rank { background: var(--h-lime); color: #0a0a0a; box-shadow: 0 0 14px rgba(190, 242, 100, .5); }
.ce-runner-crown {
  position: absolute; top: -9px; right: 10px; padding: 1px 8px; border-radius: 999px;
  background: var(--h-lime); color: #0a0a0a; font: 800 10px 'Anuphan', sans-serif; box-shadow: 0 4px 12px rgba(190, 242, 100, .35);
}
/* the lane between runners: dashes flowing from fast to slow */
.ce-speed-lane { position: relative; flex: 1 1 24px; min-width: 28px; height: 14px; margin: 0 8px; overflow: hidden; }
.ce-speed-lane i {
  position: absolute; top: 0; bottom: 0; left: -14px; right: 12px;
  background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255, 255, 255, .22) 6px 8px, transparent 8px 14px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%); mask-image: linear-gradient(90deg, transparent, #000 30%);
}
.ce-speed-lane::after {
  content: '\203A'; position: absolute; right: 0; top: 50%; translate: 0 -56%; font: 800 18px/1 'Inter', sans-serif; color: #4a4a4a;
}
.ce-speed.is-ready .ce-speed-lane i { background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(34, 211, 238, .6) 6px 8px, transparent 8px 14px); animation: ce-flow .9s linear infinite; }
.ce-speed.is-ready .ce-speed-lane::after { color: #22d3ee; }
@keyframes ce-flow { to { transform: translateX(14px); } }
/* runners dash in when the order is (re)decided */
.ce-speed.is-new .ce-runner { animation: ce-dash .55s cubic-bezier(.23, 1, .32, 1) both; animation-delay: calc(var(--i) * 90ms); }
.ce-speed.is-new .ce-runner-crown { animation: ce-crown .6s cubic-bezier(.34, 1.56, .64, 1) .35s both; }
@keyframes ce-dash { from { opacity: 0; transform: translateX(-26px); filter: blur(4px); } }
@keyframes ce-crown { from { opacity: 0; transform: translateY(6px) scale(.6); } }

.ce-gear-list { display: grid; gap: 16px; }
.ce-gear {
  --g: var(--tier); --mx: 50%; --my: 0%;
  position: relative; isolation: isolate; padding: 18px clamp(14px, 1.6vw, 22px) 20px; border-radius: 22px; overflow: hidden;
  background: #0a0a0a; border: 1px solid var(--h-line);
  transition: border-color .3s, box-shadow .35s;
}
.ce-gear > :not(.ce-light) { position: relative; z-index: 1; }
/* Pointer light + border light (js addGearLight). Fixed-size discs moved
   with transform: moving a card-sized gradient repainted the whole
   page-wide card on every mouse move and lagged while scrolling. */
.ce-light { position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit; overflow: hidden; opacity: 0; transition: opacity .4s; }
.ce-gear:hover > .ce-light { opacity: 1; }
.ce-light i {
  position: absolute; left: 0; top: 0; width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--g), .09), transparent 65%);
  transform: translate3d(-9999px, 0, 0); will-change: transform;
}
.ce-light.edge {
  inset: -1px; padding: 1px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.ce-light.edge i { width: 400px; height: 400px; background: radial-gradient(closest-side, rgba(var(--g), .75), transparent 70%); }
/* tier-coloured wash across the top, fading out */
.ce-gear::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 120px; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--tier), .06), transparent);
}
.ce-gear::after { content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--tier), .7), transparent); }
.ce-gear:hover { border-color: rgba(var(--tier), .28); box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.ce-gear-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ce-gear-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: auto; }
.ce-gear-title b { font: 800 16px 'Anuphan', sans-serif; color: var(--h-fg); }
.ce-gear-title span { font: 500 12px 'Anuphan', sans-serif; color: var(--h-muted); }
.ce-gear-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: #141414; border: 1px solid var(--h-line); color: var(--h-muted); font: 600 12px 'Anuphan', sans-serif; font-variant-numeric: tabular-nums;
}
.ce-gear-badge[hidden] { display: none; }
.ce-gear-badge.is-speed { color: #67e8f9; background: rgba(34, 211, 238, .08); border-color: rgba(34, 211, 238, .3); }
.ce-gear-badge.is-speed b { font: 800 12px 'Inter', sans-serif; }
/* "อ่านค่าจากรูป" — reads the stat screen from a screenshot (js/stat-ocr.js) */
.ce-ocr-btn { cursor: pointer; color: var(--h-fg); transition: border-color .25s, background .25s, color .25s; }
.ce-ocr-btn:hover { border-color: var(--h-lime); color: var(--h-lime); }
.ce-ocr-btn:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-ocr-btn.is-busy { cursor: progress; color: var(--h-lime); border-color: rgba(var(--tier, 250, 250, 250), .4); }
.ce-ocr-btn.is-busy svg { animation: ce-ocr-pulse 1s ease-in-out infinite alternate; }
@keyframes ce-ocr-pulse { to { opacity: .35; } }
.ce-gear > .ce-gear-head { z-index: 3; } /* the ocr menu drops over the card body */
.ce-ocr-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(260px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px;
  background: #111; border: 1px solid var(--h-line); box-shadow: 0 18px 40px rgba(0, 0, 0, .6);
}
.ce-ocr-menu button {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--h-line); background: #181818; color: var(--h-fg);
  font: 600 13px 'Anuphan', sans-serif; text-align: left; cursor: pointer; transition: border-color .2s, color .2s;
}
.ce-ocr-menu button:hover, .ce-ocr-menu button:focus-visible { border-color: var(--h-lime); color: var(--h-lime); outline: none; }
.ce-ocr-menu p { margin: 2px 2px 0; font: 500 12px/1.5 'Anuphan', sans-serif; color: var(--h-muted); }
.ce-ocr-menu kbd { padding: 1px 5px; border-radius: 5px; border: 1px solid var(--h-line); background: #1c1c1c; font: 600 11px 'Inter', sans-serif; color: var(--h-fg); }
.ce-gear.is-ocr-drop { border-color: var(--h-lime); box-shadow: 0 0 0 2px var(--h-lime) inset; }

.ce-gear-body { display: grid; grid-template-columns: minmax(270px, 1fr) minmax(0, 1.75fr); gap: 18px 22px; }
.ce-gear-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; align-self: start; }
.ce-kit { display: flex; flex-direction: column; gap: 22px; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .025); border: 1px solid rgba(255, 255, 255, .06); }
.ce-kit-row { display: flex; align-items: center; gap: 12px; }
.ce-kit-label { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 92px; font: 700 12.5px 'Anuphan', sans-serif; color: var(--h-muted); }
.ce-kit-label svg { color: #8a8a8a; }
.ce-kit-slots { display: flex; gap: 14px; flex-wrap: wrap; }
.ce-ring-pair { position: relative; }
.ce-kit-slot {
  position: relative; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px;
  background: #0d0d0d; color: #5a5a5a; cursor: pointer;
  transition: transform .35s cubic-bezier(.23, 1, .32, 1), border-color .25s, color .25s, box-shadow .3s;
}
/* the slot being hovered sits above its neighbours so its × is never covered by the ring overlay */
:is(.ce-kit-slots > .ce-kit-slot, .ce-ring-pair):is(:hover, :focus-within) { z-index: 4; }
.ce-kit-slot:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-kit-slot.is-empty { border: 1.5px dashed rgba(250, 250, 250, .15); }
.ce-kit-slot.is-empty .ce-plus { width: 18px; height: 18px; transition: rotate .45s cubic-bezier(.23, 1, .32, 1); }
.ce-kit-slot.is-empty:hover { color: var(--h-fg); border-color: rgba(250, 250, 250, .4); transform: translateY(-2px); }
.ce-kit-slot.is-empty:hover .ce-plus { rotate: 90deg; }
.ce-kit-slot.is-filled { box-shadow: 0 8px 18px rgba(0, 0, 0, .45); }
.ce-kit-slot.is-filled img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.ce-kit-slot.is-filled:hover { transform: translateY(-3px) rotate(-2deg); }
/* the "ซ้อน" ring sits on the main ring's corner */
.ce-kit-slot.is-overlay { position: absolute; right: -10px; bottom: -10px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; background: #111; box-shadow: 0 0 0 2px #0a0a0a; }
.ce-kit-slot.is-overlay.is-empty { border-width: 1px; }
.ce-kit-slot.is-overlay.is-filled img { border-radius: 50%; object-fit: cover; }
.ce-kit-slot.is-overlay:hover { transform: scale(1.15); }
.ce-kit-slot.is-overlay .ce-kit-remove { top: -10px; right: -10px; width: 18px; height: 18px; }
.ce-kit-slot.is-overlay .ce-kit-remove svg { width: 10px; height: 10px; }
.ce-ov-plus { font: 700 14px/1 'Inter', sans-serif; }

.ce-gear-note { position: relative; display: flex; flex-direction: column; gap: 6px; }
.ce-note-tag { font: 700 11.5px 'Anuphan', sans-serif; letter-spacing: .04em; color: var(--h-muted); }
.ce-gear-note textarea {
  height: 118px; width: 100%; box-sizing: border-box; resize: none; padding: 10px 14px 10px 40px;
  border: 0; border-radius: 14px; color: #d4d4d4; cursor: default;
  background: linear-gradient(90deg, rgba(var(--tier), .08), transparent 85%);
  font: 500 12.5px/1.65 'Anuphan', sans-serif;
}
.ce-gear-note textarea:focus { outline: none; }
.ce-gear-note textarea::placeholder { color: #5c5c5c; font-style: italic; }
.ce-gear-note::after {
  content: '\201C'; position: absolute; left: 12px; top: 22px; pointer-events: none;
  font: 800 32px/1 Georgia, 'Times New Roman', serif; color: rgba(var(--tier), .6);
}

/* stat rows */
.ce-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-content: start; }
.ce-stat-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ce-stat-group-title { margin: 0 0 4px 4px; font: 700 11.5px 'Anuphan', sans-serif; letter-spacing: .04em; color: #7a7a7a; }
.ce-stat-group-title:not(:first-child) { margin-top: 12px; }
.ce-stat {
  --sc: 250, 250, 250;
  position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(76px, 118px) 26px; align-items: center; gap: 10px;
  padding: 5px 6px 5px 5px; border-radius: 12px; cursor: text; border: 1px solid transparent;
  transition: background .25s, border-color .25s;
}
.ce-stat:hover { background: rgba(255, 255, 255, .035); }
.ce-stat:focus-within { background: rgba(var(--sc), .07); border-color: rgba(var(--sc), .35); }
.ce-stat-ico {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: rgba(var(--sc), .1); color: rgb(var(--sc)); box-shadow: inset 0 0 0 1px rgba(var(--sc), .18);
  transition: background .3s, box-shadow .3s;
}
.ce-stat-ico .st-ico { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.ce-stat:is(:hover, :focus-within) .st-ico { transform: rotate(-10deg) scale(1.15); }
.ce-stat-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13px 'Anuphan', sans-serif; color: var(--h-muted); transition: color .25s; }
.ce-stat-input {
  width: 100%; box-sizing: border-box; padding: 7px 10px; border-radius: 9px; text-align: right;
  background: #0d0d0d; border: 1px solid rgba(255, 255, 255, .08); color: var(--h-fg);
  font: 700 13px 'Inter', 'Anuphan', sans-serif; font-variant-numeric: tabular-nums; transition: border-color .25s, background .25s;
}
.ce-stat-input::placeholder { color: #4a4a4a; }
.ce-stat-input:focus { outline: none; border-color: rgba(var(--sc), .6); background: #0a0a0a; }
.ce-stat.has-val .ce-stat-label { color: var(--h-fg); }
.ce-stat.has-val .ce-stat-ico { background: rgba(var(--sc), .2); box-shadow: inset 0 0 0 1px rgba(var(--sc), .45), 0 0 14px rgba(var(--sc), .2); }
.ce-stat.has-val .ce-stat-input { border-color: rgba(var(--sc), .35); color: rgb(var(--sc)); }
/* ★ เน้น: only starred stats go into the summary; filled-but-unstarred rows go quiet */
.ce-stat-focus {
  display: grid; place-items: center; width: 26px; height: 26px; margin-left: -4px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: #4a4a4a; cursor: pointer; transition: color .2s, background .2s, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.ce-stat:not(.has-val):not(.is-focus) .ce-stat-focus { visibility: hidden; }
.ce-stat-focus:hover { color: #facc15; background: rgba(250, 204, 21, .08); }
.ce-stat-focus:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 1px; }
.ce-stat.is-focus .ce-stat-focus { --star-fill: #facc15; color: #facc15; }
.ce-stat-focus:active { transform: scale(.85); }
.ce-stat.has-val:not(.is-focus) .ce-stat-label { color: var(--h-muted); }
.ce-stat.has-val:not(.is-focus) .ce-stat-ico { background: none; box-shadow: inset 0 0 0 1px rgba(var(--sc), .2); }
.ce-stat.has-val:not(.is-focus) .ce-stat-input { color: #a3a3a3; border-color: var(--h-line); }
.ce-stat.has-val:not(.is-focus)::before { display: none; }
.ce-stat.has-val::before { content: ''; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: rgb(var(--sc)); }

/* detail popup rows: same coloured icons */
.counter-page .hero-stat-row .hero-stat-icon { color: rgb(var(--sc, 250, 250, 250)); }
.counter-page .hero-stat-row .hero-stat-icon .st-ico { width: 15px; height: 15px; }

/* ===== 05 team note: reads as a quote ===== */
.ce-quote { position: relative; }
.ce-quote::before {
  content: '\201C'; position: absolute; left: 16px; top: 8px; z-index: 1; pointer-events: none;
  font: 800 38px/1 Georgia, 'Times New Roman', serif; color: rgba(190, 242, 100, .45);
}
.ce-textarea { min-height: 120px; padding: 16px 18px 16px 50px; line-height: 1.65; resize: vertical; background: linear-gradient(90deg, rgba(190, 242, 100, .04), transparent 70%), #0b0b0b; }

/* ===== actions ===== */
.counter-page .ce-actions { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--h-line); }

/* ===== entry: the form rises in, step by step, each time it opens ===== */
.ce.ce-in .ce-head, .ce.ce-in .ce-step, .ce.ce-in .ce-actions { animation: ce-rise .6s cubic-bezier(.23, 1, .32, 1) both; }
.ce.ce-in .ce-step:nth-of-type(1) { animation-delay: .06s; }
.ce.ce-in .ce-step:nth-of-type(2) { animation-delay: .12s; }
.ce.ce-in .ce-step:nth-of-type(3) { animation-delay: .18s; }
.ce.ce-in .ce-step:nth-of-type(4) { animation-delay: .24s; }
.ce.ce-in .ce-step:nth-of-type(5) { animation-delay: .3s; }
.ce.ce-in .ce-actions { animation-delay: .36s; }
@keyframes ce-rise { from { opacity: 0; transform: translateY(18px); filter: blur(5px); } }

/* ===== คลัง dock ===== */
.counter-page .palette-dock.ce-dock {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(calc(105rem - 32px), calc(100vw - 32px)); max-height: min(46vh, 430px); padding: 0 clamp(14px, 1.6vw, 22px) 14px;
  background: rgba(10, 10, 10, .9); border: 1px solid var(--h-line); border-radius: 26px;
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 -10px 60px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: ce-dock-in .5s cubic-bezier(.23, 1, .32, 1);
}
.counter-page .palette-dock.ce-dock.collapsed { max-height: none; }
@keyframes ce-dock-in { from { opacity: 0; translate: 0 24px; } }
.ce-dock .palette-dock-body { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; }
.ce-dock.collapsed .palette-dock-body { display: none; }
.counter-page .ce-dock .ce-dock-head { position: static; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 10px; background: transparent; }
.ce-dock-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ce-dock-kicker { padding: 4px 10px; border-radius: 8px; background: #1a1a1a; font: 800 11px 'JetBrains Mono', 'Anuphan', monospace; letter-spacing: .08em; color: var(--h-fg); }
.ce-dock-target { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 12.5px 'Anuphan', sans-serif; color: var(--h-muted); }
.ce-dock-target b { color: var(--h-fg); font-weight: 800; }
.ce-dock-target.is-live { color: var(--h-lime); }
.ce-dock-target.is-live b { color: var(--h-lime); }
.ce-dock-target.is-live i { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--h-lime); box-shadow: 0 0 0 0 rgba(190, 242, 100, .6); animation: ce-ping 1.6s ease-out infinite; }
@keyframes ce-ping { 70% { box-shadow: 0 0 0 8px rgba(190, 242, 100, 0); } 100% { box-shadow: 0 0 0 0 rgba(190, 242, 100, 0); } }
.ce-dock-target.is-warn { color: var(--h-yellow); }
.ce-dock-toggle {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 8px 16px; border: 1px solid var(--h-line); border-radius: 999px;
  background: #161616; color: #d4d4d4; cursor: pointer; font: 700 12.5px 'Anuphan', sans-serif;
  transition: background .2s, color .2s, border-color .2s, transform .3s cubic-bezier(.23, 1, .32, 1);
}
.ce-dock-toggle:hover { background: #222; color: #fff; border-color: rgba(255, 255, 255, .25); }
.ce-dock-toggle:active { transform: scale(.96); }
.ce-dock-toggle:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.ce-dock-toggle svg { transition: rotate .4s cubic-bezier(.34, 1.56, .64, 1), translate .3s; }
.ce-dock.collapsed .ce-dock-toggle svg { rotate: 180deg; }
.ce-dock-toggle:hover svg { translate: 0 2px; }
.ce-dock.collapsed .ce-dock-toggle:hover svg { translate: 0 -2px; }

.ce-dock-bar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; flex: 0 0 auto; }
.ce-dock-tabs .picker-tab { white-space: nowrap; }
.ce-tab-ico { flex-shrink: 0; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.ce-dock-tabs .picker-tab:hover .ce-tab-ico { transform: rotate(-12deg) scale(1.12); }
.ce-dock-tabs .picker-tab.active .ce-tab-ico { color: var(--h-lime); }
.counter-page .ce-dock-search { flex: 1 1 220px; margin: 0; padding: 9px 16px; }
.ce-dock-search input { width: 100%; }
.ce-dock .hero-element-filter-row { display: flex; flex-wrap: nowrap; }
.counter-page .ce-dock .hero-element-btn { width: 36px; height: 36px; padding: 6px; }

/* the chip grid — castle.html's คลัง tiles, re-asserted over the older
   .palette-dock .hero-chip rules in draft-counter-v2.css */
.counter-page .ce-dock .castle-picker-grid.ce-dock-grid {
  flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 4px 8px 6px;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.counter-page .ce-dock .ce-dock-grid .hero-chip {
  display: flex; flex-direction: column; align-items: center; width: auto; min-width: 0;
  padding: 7px 7px 9px; gap: 7px; border-radius: 16px; font: inherit; color: inherit;
  background: #0e0e0e; border: 1px solid rgba(255, 255, 255, .06);
}
.counter-page .ce-dock .ce-dock-grid .hero-chip:hover {
  transform: translateY(-4px); background: #121212; border-color: rgba(var(--el), .55);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .5), 0 0 22px rgba(var(--el), .18);
}
.counter-page .ce-dock .ce-dock-grid .hero-chip:active { transform: translateY(-1px) scale(.96); }
.counter-page .ce-dock .ce-dock-grid .hero-chip:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 2px; }
.counter-page .ce-dock .ce-dock-grid .hero-chip .chip-name { font: 600 11px 'Anuphan', sans-serif; color: var(--h-muted); }
.counter-page .ce-dock .ce-dock-grid .hero-chip:hover .chip-name { color: var(--h-fg); }
/* rings / sets keep their own framed art: no zoom, no tier ring */
.counter-page .ce-dock .ce-dock-grid .hero-chip[data-kind="item"] .chip-art { background: transparent; }
.counter-page .ce-dock .ce-dock-grid .hero-chip[data-kind="item"] .chip-art img { object-fit: contain; transform: none; }
.counter-page .ce-dock .ce-dock-grid .hero-chip[data-kind="item"]:hover .chip-art img { transform: scale(1.06) rotate(-3deg); }
.ce-dock-grid .hero-chip[data-kind="item"] .chip-art::after { box-shadow: none; }
.counter-page .ce-dock .picker-section:first-child { margin-top: 2px; }
.ce-dock-empty { grid-column: 1 / -1; margin: 18px 0; text-align: center; font: 600 13px 'Anuphan', sans-serif; color: #6b6b6b; }

/* ===== responsive ===== */
@media (max-width: 1100px) {
  .ce-gear-body { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .ce-patterns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ce-stats { grid-template-columns: 1fr; }
  .ce-step-head small { flex-basis: 100%; }
  .ce-lane { --slot: clamp(52px, 15vw, 70px); gap: 6px; }
  .ce-lane { --dotcol: 20px; }
  .ce-dot { font-size: 9.5px; border-radius: 7px; }
  .ce-skill-hint { display: none; }
  .ce-skill-head b { flex: 1; }
  .ce-skill-groups { flex-direction: column; align-items: stretch; gap: 12px; }
  /* name column fixed so skill 1 / 2 / awaken line up down the rows */
  .ce-skill-group { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; padding: 0; }
  .ce-skill-group .ce-skill-tiles { justify-content: flex-start; }
  .ce-skill-who b { overflow-wrap: anywhere; }
  .ce-skill-group + .ce-skill-group { padding: 12px 0 0; margin: 0; border-left: 0; border-top: 1px solid var(--h-line); }
  .ce-skill-who { flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
  .ce-skill-tiles { gap: 10px; }
  .ce-skill-art { width: 50px; height: 50px; }
  .ce-speed-track { flex-direction: column; align-items: stretch; }
  .ce-speed-lane { flex: none; width: 16px; height: 16px; min-width: 0; margin: 2px 0 2px 18px; rotate: 90deg; }
  .ce-speed-hint { margin-left: 0; flex-basis: 100%; }
  .ce-pets { gap: 7px; padding: 6px 10px; }
  .ce-pets-label { display: none; }
  .ce-pet { width: 36px; height: 36px; }
  .ce-pet.is-main { width: 48px; height: 48px; }
  .ce-kit-row { flex-wrap: wrap; }
  .ce-kit-label { flex-basis: 100%; }
  .counter-page .palette-dock.ce-dock { max-height: 58vh; border-radius: 22px 22px 0 0; bottom: 0; width: 100vw; }
  .counter-page .ce .counter-editor-form.dock-open { padding-bottom: calc(58vh + 24px); }
  .ce-dock-target { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ce.ce-in :is(.ce-head, .ce-step, .ce-actions), .ce-dock, .is-landed,
  .ce-slot.is-waiting, .ce-pet.is-waiting, .ce-kit-slot.is-waiting, .ce-dock-target.is-live i { animation: none; }
  .ce-skill-panel { animation: none; }
  .ce-dot.is-on, .ce-speed.is-ready .ce-speed-ico, .ce-speed.is-ready .ce-speed-lane i, .ce-speed.is-new .ce-runner, .ce-speed.is-new .ce-runner-crown { animation: none; }
  .ce-pip, .ce-stat-ico .st-ico, .ce-tab-ico, .ce-plus, .ce-field-ico, .ce-dock-toggle svg { transition: none; }
  .ce-pattern:hover .ce-pip, .ce-stat:is(:hover, :focus-within) .st-ico, .ce-dock-tabs .picker-tab:hover .ce-tab-ico { transform: none; }
}

/* In-game stat icons (js/counter.js statImg): a white shape used as a mask,
   painted in the stat's colour via currentColor. */
.st-ico-img {
  display: inline-block; flex-shrink: 0; width: 20px; height: 20px; background-color: currentColor;
  -webkit-mask: var(--st-img) center / contain no-repeat; mask: var(--st-img) center / contain no-repeat;
}
/* a little bigger than the old line icons wherever they sit */
.cvd .cvd-stat .st-ico-img, .counter-page .hero-stat-row .hero-stat-icon .st-ico-img { width: 18px; height: 18px; }
.cv-speed .ce-speed-ico .st-ico-img, .ce-speed-ico .st-ico-img, .ce-gear-badge .st-ico-img { width: 17px; height: 17px; }
