@font-face {
  font-family: "Noto Sans TC Local";
  src: url("/fonts/Noto-Sans-regular.woff2") format("woff2");
  font-display: swap;
}

#pre { display: none; }

:root {
  color-scheme: light;
  --paper: #f2f1ec;
  --ink: #121212;
  --tone-1: color-mix(in srgb, var(--ink) 10%, var(--paper));
  --tone-2: color-mix(in srgb, var(--ink) 25%, var(--paper));
  --tone-3: color-mix(in srgb, var(--ink) 45%, var(--paper));
  --tone-4: color-mix(in srgb, var(--ink) 70%, var(--paper));
  --dots: radial-gradient(color-mix(in srgb, var(--ink) 30%, transparent) 1px, transparent 1.4px) 0 0 / 5px 5px;
  --spot: #e8401f;
  --on-spot: #121212;
  --tier-hell: #8c1d40;
  --tier-calamity: #4b3fb5;
  --tier-challenge: #0f7d74;
  --f-display: "Noto Sans TC Display", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --f-ui: -apple-system, "Segoe UI", "Noto Sans TC", "Noto Sans TC Local", "Microsoft JhengHei", sans-serif;
  --f-prose: "Noto Serif TC", "Source Han Serif TC", var(--f-ui);
  --t-s: 14px; --t-m: 16px; --t-l: 20px; --t-xl: 28px; --t-xxl: clamp(40px, 6.4vw, 88px);
  --rule: 3px; --rule-thin: 2px; --rule-mast: 4px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px;
  --gutter: 12px;
  --dur-fast: 120ms;
  --dur: 240ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --top-h: 64px;
  --tab-h: 0px;
}
:root[data-theme="dark"] { color-scheme: dark; --paper: #121212; --ink: #f2f1ec; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --paper: #121212; --ink: #f2f1ec; }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--top-h) + var(--s2));
  scroll-padding-bottom: calc(var(--tab-h) + var(--s2));
  scrollbar-color: var(--ink) var(--paper);
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-m)/1.6 var(--f-ui);
  caret-color: var(--spot);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
::selection { background: var(--ink); color: var(--paper); }

a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--spot); }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
hr { border: 0; border-top: var(--rule-thin) solid var(--ink); margin: var(--s1) 0; }

:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
main:focus { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--s3); top: -100px; z-index: 200;
  padding: 10px var(--s4); border: var(--rule) solid var(--ink);
  background: var(--spot); color: var(--on-spot); font-weight: 700;
}
.skip-link:focus { top: var(--s2); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--top-h);
  display: flex; align-items: center; gap: var(--s6);
  padding: 0 max(var(--s8), env(safe-area-inset-right)) 0 max(var(--s8), env(safe-area-inset-left));
  background: var(--paper);
  border-bottom: var(--rule-mast) solid var(--ink);
  transition: transform var(--dur) var(--ease-out);
  box-shadow: 2px calc(-1 * var(--rule-mast)) 0 var(--paper), 2px 0 0 var(--ink);
}
.topbar.bar-hidden { transform: translateY(-100%); }
.brand {
  display: flex; align-items: center; gap: var(--s2); min-height: 44px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  font: 900 var(--t-l)/1 var(--f-display); letter-spacing: -0.02em;
}
.brand b { background: var(--ink); color: var(--paper); padding: 3px 6px; margin-right: 2px; font-weight: 900; }
.tabs { display: flex; }
.tabs a { display: flex; align-items: center; gap: var(--s2); color: var(--ink); text-decoration: none; white-space: nowrap; }

.tabs-top { gap: var(--s1); }
.tabs-top a {
  position: relative; min-height: 44px; padding: 0 var(--s3);
  border: var(--rule-thin) solid transparent; font-weight: 700;
}
.tabs-top a:hover { border-color: var(--ink); }
.tabs-top a[aria-current="page"] { border-color: var(--ink); }
.tabs-top a[aria-current="page"]::after {
  content: ""; position: absolute; left: -2px; right: -2px; bottom: -14px; height: var(--rule-mast); background: var(--spot);
}
.tabs-bottom { display: none; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .topbar { gap: var(--s3); }
  .tabs-top { gap: 0; }
  .tabs-top a { flex-direction: column; justify-content: center; gap: 0; padding: 0 var(--s2); font-size: var(--t-s); line-height: 1.3; }
  .tabs-top a .pi { width: 20px; height: 20px; }
}

.bar-hidden:focus-within { transform: none !important; }

.theme-toggle { margin-left: auto; }
.auth { position: relative; }
.auth-user {
  display: flex; align-items: center; gap: var(--s2); min-height: 44px;
  background: none; border: var(--rule-thin) solid transparent; cursor: pointer; padding: 0 var(--s2);
}
.auth-user:hover { border-color: var(--ink); }
.auth-user img { width: 32px; height: 32px; border: var(--rule-thin) solid var(--ink); background: var(--tone-1); }
.auth-user span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.auth-menu {
  display: none; position: absolute; right: 0; top: calc(100% + var(--s2));
  min-width: 200px; padding: var(--s1);
  background: var(--paper); border: var(--rule) solid var(--ink);
}
.auth-menu.open { display: grid; }
.auth-menu a, .auth-menu button {
  display: flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3);
  border: 0; background: none; cursor: pointer; color: var(--ink); text-decoration: none; text-align: left;
}
.auth-menu a:hover, .auth-menu button:hover { background: var(--ink); color: var(--paper); }

main {
  flex: 1; width: 100%; margin: 0 auto;
  padding: var(--s6) max(var(--s8), env(safe-area-inset-right)) var(--s12) max(var(--s8), env(safe-area-inset-left));
  background: var(--paper);
  view-transition-name: page;
}
main:has(.skeleton) ~ .site-footer { visibility: hidden; }
.panel { background: var(--paper); border: var(--rule) solid var(--ink); padding: var(--s4) var(--s6); }
.status { text-align: center; color: var(--tone-4); padding: var(--s8) 0; }
.page-title {
  margin: var(--s1) 0 var(--s4); font: 900 var(--t-xl)/1.3 var(--f-display); letter-spacing: -0.02em;
  overflow-wrap: anywhere; text-wrap: balance;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  border: var(--rule-thin) solid var(--ink); color: var(--ink); background: var(--paper);
  font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { background: var(--tone-4); }
.btn.primary { background: var(--spot); color: var(--on-spot); border-width: var(--rule); font-weight: 900; }
.btn.primary:hover { background: var(--ink); color: var(--paper); }
.btn.small { min-height: 36px; padding: 0 var(--s3); font-size: var(--t-s); }
.btn:disabled { color: var(--tone-3); border-color: var(--tone-3); background: var(--paper); cursor: not-allowed; }
.link-btn {
  min-height: 44px; padding: 0 var(--s1); border: 0; background: none; cursor: pointer;
  font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: var(--spot); }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: var(--rule-thin) solid transparent; background: none; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s1) var(--s4);
  padding: var(--s4) var(--s8); font-size: var(--t-s); color: var(--tone-4);
  border-top: var(--rule-mast) solid var(--ink);
}
.site-footer a { color: var(--ink); font-weight: 700; }
.site-footer span { flex-basis: 100%; text-align: center; text-wrap: pretty; }

.group-title, .feature-section h2, .gf-group legend, .sim-group legend {
  display: inline-flex; align-items: center; gap: var(--s2);
  margin: 0 0 var(--s2); padding: 5px 10px;
  border: var(--rule-thin) solid var(--ink); background: var(--paper);
  font: 900 var(--t-s)/1.2 var(--f-display); letter-spacing: 0.02em; color: var(--ink);
}
.tier-mark { flex: none; width: 10px; height: 10px; background: var(--tier, var(--spot)); outline: 1px solid var(--ink); }
.tier-hell { --tier: var(--tier-hell); }
.tier-calamity { --tier: var(--tier-calamity); }
.tier-challenge { --tier: var(--tier-challenge); }

.home { max-width: 1280px; margin: 0 auto; }
.hero {
  position: relative; display: grid; align-content: end; gap: var(--s4);
  min-height: clamp(240px, 32vh, 360px); padding: var(--s8);
  border: var(--rule-mast) solid var(--ink); overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0 0 0 45%; pointer-events: none;
  background: radial-gradient(var(--ink) 1.3px, transparent 1.6px) 0 0 / 7px 7px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 85%); mask: linear-gradient(90deg, transparent, #000 85%);
  opacity: 0.55;
}
.hero h1 {
  position: relative; z-index: 1; margin: 0; max-width: 9em;
  font: 900 var(--t-xxl)/1.05 var(--f-display); letter-spacing: -0.04em; text-wrap: balance;
}
.lede {
  position: relative; z-index: 1; margin: 0; max-width: 30em;
  font: 400 var(--t-l)/1.7 var(--f-prose); text-wrap: pretty;
}
.lede, .hero h1 { background: var(--paper); justify-self: start; padding-right: var(--s2); }

.feature-section { margin-top: var(--s8); }
.feature-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--gutter); grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: dense;
}
.feature-grid > li { grid-column: span 3; }
.feature-grid > li:first-child { grid-column: span 4; }
.feature-grid > li:first-child + li { grid-column: span 2; }
.feature-grid > li:first-child:nth-last-child(3) { grid-row: span 2; }
.feature-grid > li:first-child:nth-last-child(3) ~ li { grid-column: span 2; }
.feature {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s4);
  height: 100%; min-height: 120px; padding: var(--s6);
  border: var(--rule) solid var(--ink); background: var(--paper);
  color: var(--ink); text-decoration: none;
}
.feature:hover { background: var(--dots), var(--paper); }
.feature:hover .feature-text strong { text-decoration: underline var(--spot) 4px; text-underline-offset: 6px; }
.feature-icon {
  width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
}
.feature-text { display: grid; gap: var(--s1); min-width: 0; }
.feature-text strong { font: 900 var(--t-l)/1.25 var(--f-display); letter-spacing: -0.01em; }
.feature-text span { color: var(--tone-4); font-size: var(--t-m); }
.feature-go { display: grid; }
.feature-grid > li:first-child .feature { align-content: end; align-items: end; }
.feature-grid > li:first-child .feature-text strong { font-size: var(--t-xl); }
.feature-grid > li:first-child:nth-last-child(3) .feature { min-height: 252px; }
.feature-grid > li:first-child:nth-last-child(3) .feature::before {
  content: ""; position: absolute; inset: 0 0 45% 0; pointer-events: none;
  background: radial-gradient(var(--ink) 1.3px, transparent 1.6px) 0 0 / 7px 7px;
  -webkit-mask: linear-gradient(transparent, #000); mask: linear-gradient(transparent, #000);
  opacity: 0.45;
}
.feature-grid > li:first-child:nth-last-child(3) .feature > * { position: relative; }

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; font-size: var(--t-s); }
.crumbs li { display: flex; align-items: center; }
.crumbs li + li::before { content: "/"; margin: 0 var(--s1); color: var(--tone-4); }
.crumbs a, .crumbs button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s1);
  color: var(--ink); background: none; border: 0; cursor: pointer; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.crumbs [aria-current] { color: var(--tone-4); padding: 0 var(--s1); }

.lsplit { display: grid; gap: var(--gutter); align-items: start; }
.lsplit.with-detail { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); }
.lsplit:not(.with-detail) .slots { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.llist { display: grid; gap: var(--s6); min-width: 0; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.slot-group .group-title { margin-bottom: var(--s3); }
.slot {
  display: flex; align-items: stretch; min-height: 68px;
  border: var(--rule) solid var(--ink); background: var(--paper);
}
.slot:hover { background: var(--dots), var(--paper); }
.slot-thumb { flex: 0 0 68px; display: grid; place-items: center; padding: 6px; }
.slot-thumb img { width: 52px; height: 52px; object-fit: cover; display: block; border: var(--rule-thin) solid var(--ink); }
a.slot-thumb:hover img { outline: 3px solid var(--spot); outline-offset: 1px; }
.slot-main {
  flex: 1; display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3) var(--s2) var(--s1);
  background: none; border: 0; text-align: left; cursor: pointer;
  color: inherit; text-decoration: none; font-weight: 700;
}
.slot-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.slot-go { display: grid; }
.slot.current { background: var(--ink); color: var(--paper); }
.slot.current .slot-thumb img { border-color: var(--paper); }

.slot.skeleton { border-color: var(--tone-2); }
.skeleton .slot-thumb::before, .skeleton .slot-main::before {
  content: ""; display: block; background: var(--dots); animation: tone-drift 1.6s linear infinite;
}
.skeleton .slot-thumb::before { width: 52px; height: 52px; }
.skeleton .slot-main::before { width: 60%; height: 16px; }
@keyframes tone-drift { to { background-position: 20px 0; } }

.ldetail {
  position: sticky; top: calc(var(--top-h) + var(--gutter));
  display: grid; gap: var(--s4); align-content: start; min-width: 0;
  padding: var(--s6) var(--s8) var(--s8);
  border: var(--rule-mast) solid var(--ink); background: var(--paper);
}
.ldetail-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: var(--s4);
  padding-bottom: var(--s4); border-bottom: var(--rule) solid var(--ink);
}
.ldetail-head:not(:has(.ldetail-boss)) { grid-template-columns: minmax(0, 1fr) auto; }
.ldetail-boss img { display: block; width: 72px; height: 72px; border: var(--rule-thin) solid var(--ink); }
.ldetail-boss:hover img { outline: 3px solid var(--spot); outline-offset: 1px; }
.ldetail-title { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s4); min-width: 0; }
.ldetail-title :is(h1, h2) {
  margin: 0; font: 900 clamp(var(--t-xl), 3vw, 44px)/1.1 var(--f-display); letter-spacing: -0.03em;
  overflow-wrap: anywhere; text-wrap: balance;
}
.tier-tag {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 5px 10px;
  border: var(--rule-thin) solid var(--ink); font: 900 var(--t-s)/1.2 var(--f-display);
}
.ldetail-open { align-self: start; }
.lpreview .slots { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.ltabs { display: flex; flex-wrap: wrap; gap: var(--s1); }
.ltabs [role="tab"] {
  min-height: 40px; padding: 0 var(--s3); cursor: pointer; font-weight: 700;
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
}
.ltabs [role="tab"]:hover { background: var(--dots), var(--paper); }
.ltabs [aria-selected="true"], .ltabs [aria-selected="true"]:hover { background: var(--ink); color: var(--paper); }
.ldetail-img { display: block; min-height: 240px; border: var(--rule) solid var(--ink); background: var(--dots), var(--paper); }
.ldetail-img img { display: block; width: 100%; height: auto; }
.linfo { display: grid; gap: var(--s3); min-width: 0; }
.linfo-meta {
  display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: 0;
  color: var(--tone-4); font-size: var(--t-s); font-weight: 700; font-variant-numeric: tabular-nums;
}
.linfo-loading { min-height: 240px; border: var(--rule) solid var(--tone-2); background: var(--dots); animation: tone-drift 1.6s linear infinite; }
.lwave { border: var(--rule) solid var(--ink); background: var(--paper); }
.lwave-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin: 0;
  padding: var(--s1) var(--s4); background: var(--ink); color: var(--paper); font: 900 var(--t-l)/1.3 var(--f-display);
}
.lwave-no { letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.lwave-label { font-size: var(--t-m); }
.lwave-scene { margin-left: auto; padding: 2px var(--s2); border: var(--rule-thin) solid var(--paper); font: 900 var(--t-s)/1.3 var(--f-display); }
.lenemies { margin: 0; padding: 0; list-style: none; }
.lenemy { display: grid; grid-template-columns: clamp(108px, 32%, 260px) minmax(0, 1fr); }
.lenemy + .lenemy { border-top: var(--rule-thin) solid var(--ink); }
.lenemy-col { border-right: var(--rule-thin) solid var(--ink); background: var(--dots), var(--paper); }
.lenemy-art { container-type: size; position: relative; display: block; height: 100%; min-height: 120px; overflow: hidden; }
.lenemy.multi .lenemy-art { position: sticky; top: calc(var(--top-h) + var(--gutter)); max-height: calc(100svh - var(--top-h) - 2 * var(--gutter)); }
.lenemy-art img { position: absolute; left: 50%; top: 50%; width: calc(max(100cqw, 154cqh) * 1.2); height: calc(max(100cqw, 154cqh) * 1.2); max-width: none; transform: translate(-50%, -57%); }
.lenemy-art::after { content: ""; position: absolute; inset: 0; }
.lenemy-art:hover::after { border: 3px solid var(--spot); }
.lenemy-art:focus-visible { outline: none; }
.lenemy-art:focus-visible::after { border: 3px solid var(--spot); }
.lenemy-body { display: grid; align-content: start; gap: var(--s2); min-width: 0; padding: var(--s3) var(--s4); }
.lbars { display: grid; margin: 0; padding: 0; list-style: none; }
.lbar { display: flex; flex-wrap: wrap; align-items: start; gap: var(--s2) var(--s6); }
.lbar + .lbar { margin-top: var(--s3); padding-top: var(--s3); border-top: var(--rule-thin) solid var(--tone-2); }
.lstats { flex: none; display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 2px var(--s3); margin: 0; font-variant-numeric: tabular-nums; }
.lstats div { display: contents; }
.lstats dt { color: var(--tone-4); font-size: var(--t-s); font-weight: 700; }
.lstats dd { margin: 0; font-weight: 700; }
.lskills { flex: 1 1 14em; min-width: 0; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-weight: 700; }
.lskills li { display: flex; gap: var(--s2); overflow-wrap: anywhere; }
.lskills li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 0.65em; background: var(--ink); }

.card-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; justify-content: center; align-items: center;
  background: transparent; pointer-events: none; visibility: hidden;
}
.card-overlay.loading, .card-overlay.active { visibility: visible; }
.card-overlay.loading { pointer-events: auto; background: color-mix(in srgb, #121212 50%, transparent); cursor: progress; }
.card-overlay.active { pointer-events: auto; background: color-mix(in srgb, #121212 85%, transparent); }
.card-overlay.loading:not(.active)::after {
  content: ""; position: absolute; width: 36px; height: 36px;
  border: 4px solid #f2f1ec; border-top-color: var(--spot);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }
.card-overlay iframe { width: min(100vw, calc(100dvh * 1320 / 2577)); aspect-ratio: 1320 / 2577; border: 0; visibility: hidden; }
.card-overlay.active iframe { visibility: visible; animation: panel-cut var(--dur) linear; }
.overlay-close {
  position: absolute; z-index: 1;
  top: max(var(--s3), env(safe-area-inset-top)); right: max(var(--s3), env(safe-area-inset-right));
  width: 44px; height: 44px; display: grid; place-items: center;
  border: var(--rule-thin) solid #f2f1ec; background: #121212; color: #f2f1ec; cursor: pointer;
  visibility: hidden;
}
.card-overlay.active .overlay-close { visibility: visible; }
main:has(.card-overlay:is(.active, .loading):not(.docked)),
main:has(.codex-detail-wrap.active:not(.docked)),
main:has(.ch-lightbox) { view-transition-name: none; }
.overlay-close:hover { background: var(--spot); color: var(--on-spot); }
.dock-empty { display: none; }

.card-page { display: flex; justify-content: center; }
.cp-frame {
  position: relative; aspect-ratio: 1320 / 2577; background: #000;
  width: min(100%, calc((100dvh - var(--top-h) - var(--tab-h) - var(--s6) - var(--gutter)) * 1320 / 2577));
}
.cp-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.cp-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: var(--s4); background: #000; color: #f2f1ec; font-weight: 700; text-align: center; }
.cp-status[hidden] { display: none; }

.stage-view { max-width: 1440px; margin: 0 auto; }
.sv-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s3) var(--s6); margin-bottom: var(--s4); }
.sv-head .page-title { margin-bottom: 0; }
.sv-floor { margin: var(--s1) 0 0; color: var(--tone-4); font-weight: 700; }
.sv-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.sv-stage { display: block; width: 100%; padding: 0; border: var(--rule) solid var(--ink); background: #000; cursor: zoom-in; overflow-x: auto; }
.sv-stage img { display: block; width: 100%; height: auto; }
.sv-stage.zoomed { cursor: zoom-out; }
.sv-stage.zoomed img { width: auto; max-width: none; }
.sv-stage:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.sv-hint { margin: var(--s2) 0 0; color: var(--tone-4); font-size: var(--t-s); }

.legal { max-width: 46em; margin: 0 auto; }
.legal-updated { margin: calc(-1 * var(--s2)) 0 var(--s6); color: var(--tone-4); font-size: var(--t-s); }
.legal-body { line-height: 1.8; }
.legal-body h2 { margin: var(--s8) 0 var(--s2); font: 900 var(--t-l)/1.3 var(--f-display); }
.legal-body p, .legal-body ul { margin: 0 0 var(--s3); }
.legal-body ul { padding-left: 1.5em; }
.legal-body li + li { margin-top: var(--s1); }
.legal-body code { padding: 0 4px; background: var(--tone-1); font-size: 0.9em; }
.legal-body .legal-note { margin-top: var(--s8); color: var(--tone-4); font-size: var(--t-s); }

.my-cards { max-width: 1280px; margin: 0 auto; }
.intro { margin: 0 0 var(--s6); padding: var(--s8); border-width: var(--rule-mast); }
.intro h1 { margin: 0 0 var(--s4); font: 900 var(--t-xl)/1.3 var(--f-display); letter-spacing: -0.02em; text-wrap: balance; }
.intro p { margin: 0 0 var(--s3); max-width: 40em; font-family: var(--f-prose); font-size: 17px; line-height: 1.8; }
.intro strong { font-family: var(--f-ui); font-weight: 900; box-shadow: inset 0 -0.35em var(--tone-1); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6) !important; font-family: var(--f-ui) !important; }
.need-login { max-width: 480px; margin: 0 auto; text-align: center; }
.card-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--gutter);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.card-item h3 { margin: 0 0 var(--s1); font: 900 var(--t-l)/1.3 var(--f-display); overflow-wrap: anywhere; }
.card-item .meta { font-size: var(--t-s); color: var(--tone-4); margin-bottom: var(--s4); }
.card-item .btns { display: flex; flex-wrap: wrap; gap: var(--s2); }
.card-item .btns a, .card-item .btns button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3);
  font-size: var(--t-s); font-weight: 700;
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.card-item .btns a:hover, .card-item .btns button:hover { background: var(--ink); color: var(--paper); }
.card-item .btns .danger { margin-left: auto; border-style: dashed; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--s6) + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 120;
  padding: var(--s2) var(--s4); background: var(--ink); color: var(--paper); font-weight: 700;
  visibility: hidden;
}
.toast.show { visibility: visible; animation: panel-cut var(--dur) linear; }
.cookie-notice {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--s3) + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 60;
  width: min(640px, calc(100vw - 2 * var(--s4)));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s2) var(--s3);
  padding: var(--s3) var(--s4); border: var(--rule) solid var(--ink); background: var(--paper);
  font-size: var(--t-s); line-height: 1.6;
  animation: panel-cut var(--dur) linear;
}
.cookie-notice p { flex: 1 1 18em; margin: 0; }

.glayout { display: grid; gap: var(--s6); align-items: start; }
.gmain { min-width: 0; }
.gtools { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: stretch; }
.gsearch, .pick select, .gdir, .gfilter-btn {
  min-height: 44px; border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
}
.gsearch { flex: 1 1 260px; display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); }
.gsearch:focus-within { outline: 3px solid var(--spot); outline-offset: 2px; }
.gsearch input { flex: 1; min-width: 0; height: 40px; border: 0; background: none; outline: none; }
.gsearch input::placeholder { color: var(--tone-4); }
.pick { position: relative; display: flex; }
.pick select { appearance: none; padding: 0 40px 0 var(--s3); cursor: pointer; font-weight: 700; }
.pick::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 12px; height: 8px; margin-top: -4px; pointer-events: none;
  background: var(--ink); clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.gdir, .gfilter-btn { display: inline-flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); font-weight: 700; white-space: nowrap; cursor: pointer; }
.gdir:hover, .gfilter-btn:hover, .pick select:hover { background: var(--ink); color: var(--paper); }
.pick:hover::after { background: var(--paper); }
@supports (appearance: base-select) {
  .pick select, .pick ::picker(select) { appearance: base-select; }
  .pick select, .pick ::picker(select) { border-radius: 0; }
  .pick select { align-items: center; }
  .pick select::picker-icon { display: none; }
  .pick select:open { background: var(--ink); color: var(--paper); }
  .pick:has(select:open)::after { background: var(--paper); rotate: 180deg; }
  .pick ::picker(select) {
    margin-block: var(--s1); padding: var(--s1); min-width: anchor-size(width);
    border: var(--rule) solid var(--ink); background: var(--paper); color: var(--ink);
  }
  .pick option {
    display: flex; align-items: center; min-height: 40px; padding: 0 var(--s3) 0 var(--s4);
    font-weight: 700; white-space: nowrap; cursor: pointer;
    border-left: var(--rule) solid transparent;
  }
  .pick option::checkmark { display: none; }
  .pick option:hover, .pick option:focus-visible { background: var(--dots), var(--paper); outline: none; }
  .pick option:checked { background: var(--ink); color: var(--paper); border-left-color: var(--spot); }
  .pick option:checked:focus-visible { outline: 3px solid var(--spot); outline-offset: -3px; }
}
.gcount-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border: var(--rule-thin) solid var(--ink);
  background: var(--spot); color: var(--on-spot); font-size: var(--t-s); font-weight: 900; line-height: 18px; text-align: center;
}
.gresult { margin: var(--s3) 0; min-height: 1.6em; color: var(--tone-4); font-size: var(--t-s); font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tiles { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s3);
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
  font-size: var(--t-s); font-weight: 700; cursor: pointer;
}
.chip:hover { background: var(--dots), var(--paper); }
.chip img { width: 28px; height: 28px; object-fit: contain; }
.chip.has-icon { padding-left: 6px; }
.tiles .chip { flex-direction: column; justify-content: center; gap: var(--s1); min-height: 76px; padding: 6px 4px; text-align: center; line-height: 1.2; }
.tiles .chip img { width: 40px; height: 40px; }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); }
.gactive { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip.removable { background: var(--ink); color: var(--paper); }
.chip.removable:hover { background: var(--tone-4); }
.chip.clear { border-color: transparent; background: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.gallery-grid { position: relative; }
.gallery-window { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gutter); will-change: transform; }
.gallery-window > li { min-width: 0; }
.gallery-window.skeleton { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.gcell { display: flex; flex-direction: column; height: 100%; color: var(--ink); text-decoration: none; }
.gthumb { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 9%; background: var(--tone-1); }
.gthumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcell:hover .gthumb { outline: 3px solid var(--ink); outline-offset: 2px; }
.gcell:focus-visible { outline-offset: 3px; }
.gcell[aria-current] .gthumb { outline: 3px solid var(--ink); outline-offset: 2px; }
.gcell[aria-current] .gmeta { background: var(--ink); color: var(--paper); }
.gcard { position: relative; display: block; container-type: inline-size; }
.gbadge {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24%; transform: translateY(41%); z-index: 1;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: linear-gradient(90deg, #0000 0%, #000000b3 13%, #000 34%, #000 66%, #000 87%, #0000 100%);
  color: #c8a832; font-style: italic; font-weight: 400; font-size: 15.6cqw; line-height: 1; white-space: nowrap;
}
.gbadge.all-max { font-weight: 700; }
.gnew {
  position: absolute; top: -4px; right: -4px; z-index: 2; padding: 2px 4px;
  border: var(--rule-thin) solid var(--ink); background: var(--spot); color: var(--on-spot);
  font: 900 var(--t-s)/1 var(--f-display);
}
.gbadge img { position: absolute; left: -2%; top: 50%; height: 90%; transform: translateY(-50%); }
.gbadge::before, .gbadge::after {
  content: ''; position: absolute; left: 0; right: 0; height: 2.2cqw;
  background:
    linear-gradient(90deg, transparent 0%, #000 15%, #000 85%, transparent 100%) 0 0 / 100% 0.72cqw no-repeat,
    linear-gradient(90deg, transparent 0%, #c8a832 15%, #c8a832 85%, transparent 100%) 0 50% / 100% 0.72cqw no-repeat,
    linear-gradient(90deg, transparent 0%, #000 15%, #000 85%, transparent 100%) 0 100% / 100% 0.72cqw no-repeat;
}
.gbadge::before { top: -0.72cqw; }
.gbadge::after { bottom: -0.72cqw; }
.gmeta { margin-top: 10%; height: 22px; line-height: 22px; text-align: center; font-size: var(--t-s); color: var(--tone-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gmeta.metric { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.gmeta.codex-name { flex: none; width: 100%; margin-top: var(--s1); height: 20px; line-height: 20px; color: var(--ink); font-weight: 700; }
.gmeta.codex-sub { flex: none; width: 100%; margin-top: 0; height: 18px; line-height: 18px; font-size: 12px; }
.gcell[aria-current] .gmeta.codex-name,
.gcell[aria-current] .gmeta.codex-sub { background: var(--ink); color: var(--paper); }
.skeleton .gthumb { background: var(--dots), var(--tone-1); animation: tone-drift 1.6s linear infinite; }

.gtitle-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s3); }
.gtitle-row .page-title { margin: 0; }
.gkind-tabs { display: flex; flex-wrap: wrap; gap: var(--s1); }
.gkind-tabs [role="tab"] {
  position: relative; min-height: 44px; padding: 0 var(--s4);
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
  font-weight: 700; cursor: pointer; white-space: nowrap;
}
.gkind-tabs [role="tab"]:hover { background: var(--dots), var(--paper); }
.gkind-tabs [aria-selected="true"],
.gkind-tabs [aria-selected="true"]:hover { background: var(--ink); color: var(--paper); }
.gkind-tabs [aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: var(--rule-mast); background: var(--spot);
}

.codex-cell {
  width: 100%; min-width: 0; padding: 0; border: 0; background: none;
  font: inherit; color: var(--ink); text-align: center; cursor: pointer;
  justify-content: flex-start; align-items: stretch;
}
.codex-cell .gcard { width: 100%; flex: none; }
.dw-thumb { background: #121212; }
.dw-layer { position: absolute; inset: 4%; width: 92%; height: 92%; object-fit: contain; pointer-events: none; }
.dw-layer.dw-weapon { inset: 3%; width: 94%; height: 94%; object-fit: contain; }
.dw-layer.dw-refine-frame { inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 2; }
.dw-mode-badge {
  position: absolute; right: 3px; bottom: 3px; z-index: 3;
  width: clamp(20px, 28%, 28px); height: clamp(20px, 28%, 28px);
  display: flex; align-items: center; justify-content: center; padding: 2px;
  overflow: hidden;
  background: rgb(18 18 18 / 0.86); border: 1.5px solid #f2f1ec;
  pointer-events: none;
}
.dw-mode-badge img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; display: block; }
.dw-pill {
  position: absolute; left: -2px; top: -2px; z-index: 2; padding: 1px 4px;
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
  font-size: 11px; font-weight: 900; line-height: 1.25; font-variant-numeric: tabular-nums; pointer-events: none;
}
.dw-check { display: flex; align-items: center; gap: var(--s2); min-height: 40px; cursor: pointer; font-size: var(--t-s); font-weight: 700; }
.dw-check input { width: 20px; height: 20px; flex: none; accent-color: var(--ink); }

.codex-detail-wrap {
  position: fixed; inset: 0; z-index: 100;
  display: flex; justify-content: center; align-items: center; padding: var(--s4);
  background: transparent; pointer-events: none; visibility: hidden;
}
.codex-detail-wrap.active { visibility: visible; pointer-events: auto; background: color-mix(in srgb, #121212 85%, transparent); }
.codex-detail-wrap:not(.docked) .codex-detail {
  position: relative; width: min(560px, 100%); max-height: min(88dvh, 860px);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  border: var(--rule-mast) solid var(--ink); background: var(--paper); color: var(--ink); padding: var(--s6);
}
.codex-detail-wrap:not(.docked) .codex-close {
  position: sticky; float: right; top: 0; right: 0;
  margin: calc(-1 * var(--s2)) calc(-1 * var(--s2)) var(--s2) var(--s2);
  border-color: var(--ink); background: var(--paper); color: var(--ink);
}
.codex-detail-wrap.active:not(.docked) .codex-close { visibility: visible; }
.codex-detail-wrap:not(.docked) .codex-close:hover { background: var(--ink); color: var(--paper); }

.codex-sheet { display: grid; gap: var(--s4); }
.dw-head { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s3); align-items: start; }
.dw-hero-icon { width: 104px; height: 104px; }
.dw-hero-icon .dw-mode-badge { width: 32px; height: 32px; right: 4px; bottom: 4px; padding: 3px; }
.ch-head { display: grid; gap: var(--s3); justify-items: stretch; }
.ch-card-art {
  position: relative; display: block; justify-self: center;
  width: min(248px, 78%); padding: 0; cursor: zoom-in;
  border: var(--rule) solid var(--ink); background: var(--dots), var(--paper);
}
.ch-card-art:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.ch-card-art img { display: block; width: 100%; height: auto; }
.ch-zoom-hint {
  position: absolute; right: 0; bottom: 0;
  padding: 2px 8px; border-top: var(--rule-thin) solid var(--ink); border-left: var(--rule-thin) solid var(--ink);
  background: var(--paper); color: var(--ink);
  font-size: 12px; font-weight: 700; line-height: 1.4;
}
.ch-card-art:hover .ch-zoom-hint { background: var(--ink); color: var(--paper); }
.codex-id-aux { font-size: 12px; color: var(--tone-4); font-variant-numeric: tabular-nums; }
.codex-title-col { display: grid; gap: var(--s1); min-width: 0; }
.codex-meta-row { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.codex-no { font-weight: 700; color: var(--tone-4); }
.codex-tag { padding: 1px 6px; border: var(--rule-thin) solid var(--ink); font-weight: 700; font-size: 12px; }
.codex-series-tag { margin: 0; font-size: var(--t-s); font-weight: 700; color: var(--tone-4); }
.codex-name-lg { margin: 0; font: 900 var(--t-l)/1.25 var(--f-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.codex-subline { margin: 0; font-size: var(--t-s); color: var(--tone-4); }

.codex-sec { display: grid; gap: var(--s2); padding-top: var(--s3); border-top: var(--rule-thin) solid var(--tone-2); }
.cbox {
  display: inline-flex; justify-self: start; align-items: center;
  margin: 0; padding: 4px 10px;
  border: var(--rule-thin) solid var(--ink); background: var(--paper);
  font: 900 var(--t-s)/1.2 var(--f-display); letter-spacing: 0.02em; color: var(--ink);
}
.codex-kv { margin: 0; display: grid; gap: var(--s1); font-size: var(--t-s); }
.codex-kv div { display: flex; gap: var(--s3); }
.codex-kv dt { flex: none; min-width: 3.2em; color: var(--tone-4); font-weight: 700; }
.codex-kv dd { margin: 0; font-weight: 700; }

.dw-stats, .ch-fp-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: var(--rule-thin) solid var(--ink); font-variant-numeric: tabular-nums;
}
.dw-stats > div, .ch-fp-grid > div { display: grid; gap: 2px; padding: var(--s2); text-align: center; }
.dw-stats > div + div, .ch-fp-grid > div + div { border-left: var(--rule-thin) solid var(--ink); }
.dw-stats span, .ch-fp-grid span { font-size: 12px; color: var(--tone-4); font-weight: 700; }
.dw-stats strong, .ch-fp-grid strong { font-size: var(--t-m); font-weight: 900; }

.codex-skill-list, .codex-fever-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
ol.codex-skill-list { counter-reset: sk; }
ol.codex-skill-list .codex-skill-item { counter-increment: sk; display: flex; gap: var(--s2); }
ol.codex-skill-list .codex-skill-item::before { content: counter(sk, upper-roman) "."; flex: none; font-weight: 900; min-width: 1.8em; }
ul.codex-skill-list .codex-skill-item { display: flex; gap: var(--s2); }
ul.codex-skill-list .codex-skill-item::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 0.65em; background: var(--ink); }
.codex-skill-item, .codex-skill-text { margin: 0; font-size: var(--t-s); line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

.codex-fever-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2); align-items: start;
  padding: var(--s2); border: var(--rule-thin) solid var(--ink);
}
.codex-score {
  padding: 2px 6px; background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.codex-charge { margin: 0; font-size: var(--t-s); font-weight: 700; }
.codex-charge span { color: var(--tone-4); }
.codex-mode-desc {
  margin: var(--s1) 0 0; padding: var(--s2) var(--s3);
  border: var(--rule-thin) solid var(--tone-2); font-size: var(--t-s); line-height: 1.55; white-space: pre-line;
}

.dw-monsters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--s2); }
.dw-mon-btn {
  display: flex; align-items: center; gap: var(--s2); padding: 4px;
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink);
  text-decoration: none; font-size: 12px; font-weight: 700;
}
.dw-mon-btn:hover { background: var(--ink); color: var(--paper); }
.dw-mon-btn img { width: 36px; height: 36px; border-radius: 9%; flex: none; }
.dw-mon-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ch-tags { list-style: none; margin: var(--s1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.ch-tags li { padding: 1px 6px; border: var(--rule-thin) solid var(--ink); font-size: 12px; color: var(--ink); font-weight: 700; }
.ch-lv-bar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; }
.ch-lv-bar .segs { flex-wrap: wrap; }
.ch-exp-note { margin: 0; font-size: 12px; color: var(--tone-4); font-variant-numeric: tabular-nums; }
.ch-skill-head { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; }
.ch-skill-head > span { font-size: 12px; color: var(--tone-4); font-weight: 700; }
.ch-skill-empty { margin: 0; font-size: var(--t-s); color: var(--tone-4); }

.ch-lightbox {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center; padding: var(--s4);
  background: color-mix(in srgb, #121212 90%, transparent);
  cursor: zoom-out;
}
.ch-lightbox .overlay-close { visibility: visible; }
.ch-lightbox-frame {
  display: grid; gap: var(--s2); justify-items: center;
  max-width: min(520px, 92vw); max-height: 92dvh; cursor: default;
}
.ch-lightbox-frame img {
  display: block; max-width: 100%; max-height: calc(92dvh - 40px);
  width: auto; height: auto; border: var(--rule-mast) solid #f2f1ec; background: #121212;
}
.ch-lightbox-cap {
  margin: 0; padding: 4px 12px; border: var(--rule-thin) solid #f2f1ec;
  background: #121212; color: #f2f1ec; font-size: var(--t-s); font-weight: 700;
}

@media (max-width: 559px) {
  .codex-detail-wrap:not(.docked) { padding: var(--s2); }
  .codex-detail-wrap:not(.docked) .codex-detail { padding: var(--s4); }
  .ch-card-art { width: min(220px, 76%); }
  .ch-lv-bar .seg span { padding: 0 var(--s2); }
}

.gallery { --stick-top: calc(var(--top-h) + var(--s6)); --stick-h: calc(100dvh - var(--stick-top) - var(--gutter)); }
.gside {
  position: sticky; top: var(--stick-top);
  max-height: var(--stick-h); overflow-y: auto; overscroll-behavior: contain;
  border: var(--rule) solid var(--ink); background: var(--paper);
  scrollbar-width: thin;
}
.gside-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: var(--s2) var(--s3) 0 var(--s4); background: var(--paper);
}
.gside-head h2 { margin: 0; font: 900 var(--t-l)/1.2 var(--f-display); }
.gside .gf-tabs { position: sticky; top: 52px; z-index: 1; background: var(--paper); padding: var(--s2) var(--s4) 0; }
.gside .gf-body { padding: 0 var(--s4) var(--s4); overflow: visible; }

.gf {
  width: min(680px, calc(100vw - 2 * var(--s4))); max-height: min(86dvh, 860px); padding: 0;
  border: var(--rule) solid var(--ink); background: var(--paper); color: var(--ink);
}
.gf { overflow: hidden; }
.gf::backdrop { background: color-mix(in srgb, #121212 75%, transparent); }
.gf-inner { display: flex; flex-direction: column; max-height: inherit; }
.gf-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s2) var(--s2) 0 var(--s6); }
.gf-head h2 { margin: 0; font: 900 var(--t-l)/1.2 var(--f-display); }
.gf-tabs { display: flex; gap: var(--s1); padding: var(--s2) var(--s6) 0; border-bottom: var(--rule) solid var(--ink); }
.gf-tabs [role="tab"] {
  position: relative; min-height: 44px; padding: 0 var(--s4); cursor: pointer; font-weight: 700;
  border: var(--rule-thin) solid transparent; border-bottom: 0; background: none; color: var(--tone-4);
}
.gf-tabs [role="tab"]:hover { color: var(--ink); }
.gf-tabs [aria-selected="true"], .gf-tabs [aria-selected="true"]:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.gf-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s2) var(--s6) var(--s4); }
.gf-group { border: 0; margin: var(--s4) 0 0; padding: 0; min-width: 0; }
.gf-more { margin-top: var(--s1); min-height: 44px; padding: 0 var(--s1); border: 0; background: none; cursor: pointer; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.segs { display: inline-flex; border: var(--rule-thin) solid var(--ink); }
.seg { position: relative; display: block; }
.seg + .seg { border-left: var(--rule-thin) solid var(--ink); }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; min-height: 40px; padding: 0 var(--s3); font-size: var(--t-s); font-weight: 700; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 3px solid var(--spot); outline-offset: 2px; }
.gf-foot {
  display: flex; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s6) max(var(--s3), env(safe-area-inset-bottom)); border-top: var(--rule) solid var(--ink);
}

.sim { max-width: 1280px; margin: 0 auto; }
.sim-layout { display: grid; gap: var(--s6); grid-template-columns: minmax(0, 540px) minmax(280px, 1fr); align-items: start; }
.sim-play {
  --sim-above: 81px;
  display: flex; flex-direction: column; gap: var(--s3);
  min-height: calc(100dvh - var(--top-h) - var(--sim-above) - var(--tab-h) - env(safe-area-inset-bottom) - var(--s4));
}
.sim-stage { margin-top: auto; display: grid; gap: var(--s3); }
.sim-hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.sim-counts { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s2); }
.sim-counts li { display: flex; align-items: center; gap: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-counts img { width: 28px; height: 28px; }
.sim-stat { margin: 0; color: var(--tone-4); font-variant-numeric: tabular-nums; }
.sim-stat strong { color: var(--ink); font: 900 var(--t-l)/1 var(--f-display); }
.sim-stat .sep { margin: 0 var(--s2); }
@media (max-width: 559px) {
  .sim-hud { flex-direction: column; align-items: stretch; gap: var(--s1); }
  .sim-counts { justify-content: space-between; }
}
.sim-timer { height: 10px; border: var(--rule-thin) solid var(--ink); background: var(--paper); overflow: hidden; }
.sim-timer > div { height: 100%; background: var(--ink); transform-origin: left; }
.sim-board {
  position: relative; aspect-ratio: 6 / 5; overflow: hidden;
  background: url("/images/simulator/board.avif") center / 100% 100%;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  outline: var(--rule) solid var(--ink);
}
.sim-board.painting { cursor: crosshair; }
.sim-board.locked { cursor: default; }
.orb {
  position: absolute; left: 0; top: 0; width: calc(100% / 6); height: 20%; padding: 0.8%;
  transition-property: transform, opacity; pointer-events: none; -webkit-user-drag: none;
}
.orb.held { opacity: 0.25; }
.orb.fading { opacity: 0; }
.sim-float { position: fixed; z-index: 150; pointer-events: none; opacity: 0.85; }
.sim-path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.sim-path line { stroke: rgb(202, 202, 202); stroke-width: 0.048; stroke-linecap: round; filter: drop-shadow(0.03px 0.03px 0 rgb(0 0 0 / 0.52)); }
.sim-path circle { stroke: #000; stroke-width: 0.03; }
.sim-path .start { fill: green; }
.sim-path .end { fill: red; }
.shard { position: fixed; pointer-events: none; z-index: 1100; animation: shatter-space 0.3s cubic-bezier(0, 0, 1, 1) forwards; }
.jewel-glow {
  position: fixed; pointer-events: none; z-index: 1050;
  background:
    radial-gradient(circle, transparent 33%, var(--glow-color) 36%, transparent 40%),
    radial-gradient(circle, var(--glow-color) 0%, var(--glow-color) 20%, transparent 45%),
    linear-gradient(0deg, transparent 49.2%, var(--glow-color) 47%, transparent 50.8%),
    linear-gradient(30deg, transparent 49.2%, var(--glow-color) 47%, transparent 50.8%),
    linear-gradient(60deg, transparent 49.2%, var(--glow-color) 47%, transparent 50.8%),
    linear-gradient(90deg, transparent 49.2%, var(--glow-color) 47%, transparent 50.8%),
    linear-gradient(120deg, transparent 49.2%, var(--glow-color) 47%, transparent 50.8%),
    linear-gradient(150deg, transparent 49.2%, var(--glow-color) 47%, transparent 50.8%);
  mask-image: radial-gradient(circle, #000 30%, transparent 55%);
  animation: glow-pulse-12 0.4s ease-out forwards;
}
.massive-glow-color, .massive-glow-white { position: fixed; pointer-events: none; border-radius: 50%; mix-blend-mode: screen; }
.massive-glow-color { z-index: 1060; background: radial-gradient(circle, var(--glow-color) 40%, transparent 70%); animation: massive-color-pulse 0.35s ease-out forwards; }
.massive-glow-white {
  z-index: 1061; background: radial-gradient(circle, #fff 15%, rgb(255 255 255 / 0.8) 40%, transparent 70%);
  animation: massive-white-pulse 0.4s ease-out forwards;
}
.lightning-sphere { position: fixed; pointer-events: none; z-index: 1062; transform: translate(-50%, -50%); mix-blend-mode: screen; animation: lightning-fade 0.5s ease-out forwards; }
.shard, .jewel-glow, .massive-glow-color, .massive-glow-white, .lightning-sphere { will-change: transform, opacity; backface-visibility: hidden; isolation: isolate; }
@keyframes glow-pulse-12 {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  33% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}
@keyframes shatter-space {
  0% { transform: translate(var(--start-x), var(--start-y)) rotate(var(--start-rot)) scale(0.85); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.6); opacity: 0; }
}
@keyframes massive-color-pulse {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  33% { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}
@keyframes massive-white-pulse {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  33% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}
@keyframes lightning-fade { 0% { opacity: 0; } 10%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .shard, .jewel-glow, .massive-glow-color, .massive-glow-white, .lightning-sphere { display: none; }
}
.sim-palette { display: flex; gap: var(--s2); justify-content: space-between; }
.sim-pen {
  position: relative; flex: 1; max-width: 64px; aspect-ratio: 1; min-height: 44px; padding: 4px;
  border: var(--rule-thin) solid var(--tone-2); background: var(--paper); cursor: pointer;
}
.sim-pen:hover { border-color: var(--ink); }
.sim-pen img { width: 100%; height: 100%; display: block; }
.sim-pen[aria-pressed="true"] { border: var(--rule) solid var(--ink); background: var(--dots), var(--paper); }
.sim-pen kbd {
  position: absolute; right: 0; bottom: 0; font: 700 11px/1 var(--f-ui); color: var(--paper);
  background: var(--ink); padding: 2px 3px;
}
.sim-pen.small { flex: 0 0 48px; }
.sim-hint { margin: 0; font-size: var(--t-s); color: var(--tone-4); }
.sim-hint.sim-locked { color: var(--ink); font-weight: 700; }
.sim-side { display: grid; gap: var(--s4); }
.sim-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.sim-group { margin: 0; padding: var(--s3) var(--s4) var(--s4); border: var(--rule) solid var(--ink); background: var(--paper); min-width: 0; }
.sim-group legend { margin-bottom: 0; }
.sim-range { display: flex; align-items: center; gap: var(--s3); min-height: 44px; }
.sim-range input {
  flex: 1; height: 28px; margin: 0; appearance: none; background: none; cursor: pointer;
}
.sim-range input::-webkit-slider-runnable-track {
  height: 28px;
  background:
    linear-gradient(var(--ink) 0 0) 0 50% / calc(7px + (100% - 14px) * var(--f, 0)) 4px no-repeat,
    linear-gradient(var(--tone-2) 0 0) 0 50% / 100% var(--rule-thin) no-repeat;
}
.sim-range input::-webkit-slider-thumb { appearance: none; width: 14px; height: 28px; border: 0; border-radius: 0; background: var(--ink); }
.sim-range input::-moz-range-track { height: var(--rule-thin); background: var(--tone-2); }
.sim-range input::-moz-range-progress { height: 4px; background: var(--ink); }
.sim-range input::-moz-range-thumb { width: 14px; height: 28px; border: 0; border-radius: 0; background: var(--ink); }
.sim-range input:focus-visible { outline: none; }
.sim-range input:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--spot); outline-offset: 2px; }
.sim-range input:focus-visible::-moz-range-thumb { outline: 3px solid var(--spot); outline-offset: 2px; }
.sim-range output { min-width: 3.5em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-check { position: relative; display: flex; gap: var(--s3); align-items: flex-start; min-height: 44px; padding: var(--s2) 0; cursor: pointer; }
.sim-check input { position: absolute; width: 22px; height: 22px; margin: 2px 0 0; opacity: 0; cursor: pointer; }
.sim-check .box {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 2px;
  border: var(--rule-thin) solid var(--ink); background: var(--paper);
}
.sim-check:hover .box { background: var(--dots), var(--paper); }
.sim-check input:checked + .box { background: var(--ink); }
.sim-check input:checked + .box::after {
  content: ""; width: 6px; height: 11px; margin-top: -3px; rotate: 45deg;
  border: solid var(--paper); border-width: 0 3px 3px 0;
}
.sim-check input:focus-visible + .box { outline: 3px solid var(--spot); outline-offset: 2px; }
.sim-check span:not(.box) { display: grid; }
.sim-check small { color: var(--tone-4); font-size: var(--t-s); }
.sim-group .pick select { flex: 1; }
.sim-nums { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-bottom: var(--s3); }
.sim-num, .sim-field { display: grid; gap: var(--s1); font-size: var(--t-s); font-weight: 700; }
.sim-num input {
  min-height: 44px; padding: 0 var(--s3); min-width: 0;
  border: var(--rule-thin) solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink);
  font: 900 var(--t-m)/1 var(--f-display); font-variant-numeric: tabular-nums;
}
.sim-num input::placeholder { color: var(--tone-3); font-weight: 700; }
.sim-num input:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.sim-dissolve { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.sim-legacy { margin: 0; font-size: var(--t-s); color: var(--tone-4); }
.sim-legacy a { color: var(--ink); font-weight: 700; }
.bs .gf-body { display: grid; gap: var(--s3); align-content: start; }
.bs-controls { display: grid; gap: var(--s2); }
.bs-controls .gsearch { min-height: 44px; border: var(--rule-thin) solid var(--ink); }
.bs-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.bs-card { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.bs-card img { display: block; width: 100%; aspect-ratio: 1; border-radius: 9%; background: var(--tone-1); }
.bs-card:hover img, .bs-card:focus-visible img { outline: 3px solid var(--ink); outline-offset: 1px; }
.bs-card:focus-visible { outline: none; }
.bs-count {
  position: absolute; right: -4px; top: -4px; min-width: 22px; height: 22px; padding: 0 5px;
  background: var(--ink); color: var(--paper); font: 900 var(--t-s)/22px var(--f-ui); text-align: center;
}
.bs-back { justify-self: start; }
.bs-name { margin: 0; font: 900 var(--t-l)/1.3 var(--f-display); }
.bs-layouts { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.bs-layout { position: relative; padding: var(--s2); border: var(--rule-thin) solid var(--tone-2); background: var(--paper); cursor: pointer; }
.bs-layout:hover { border-color: var(--ink); }
.bs-layout[aria-checked="true"] { border: var(--rule) solid var(--ink); background: var(--dots), var(--paper); }
.bs-layout:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.bs-num { position: absolute; left: 0; top: 0; z-index: 1; min-width: 24px; padding: 2px 6px; background: var(--ink); color: var(--paper); font: 900 var(--t-s)/1.4 var(--f-ui); }
.bs-grid { position: relative; }
.bs-bg { display: block; width: 100%; height: auto; }
.bs-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(5, 1fr); }
.bs-cell { position: relative; display: flex; align-items: center; justify-content: center; }
.bs-cell .orb { width: 100%; height: auto; border-radius: 50%; filter: brightness(0.95) saturate(1.1); }
.bs-cell .sel { width: 90%; height: auto; }
.bs-cell .race { position: absolute; top: 0; right: 0; width: 45%; height: auto; }
.bs-assign { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border: var(--rule) solid var(--ink); background: var(--dots), var(--paper); font-size: var(--t-s); font-weight: 700; }
.bs-slots { display: inline-flex; gap: var(--s1); }
.bs-slots img, .bs-slot { width: 28px; height: 28px; }
.bs-slot { display: inline-block; border: var(--rule-thin) dashed var(--ink); background: var(--paper); }

.pi { flex: none; overflow: visible; }
.pi > * { transform-box: view-box; }
:is(a, button):is(:hover, :focus-visible, :active) .pi > *,
[aria-current="page"] .pi > * {
  animation: var(--pi) var(--t, 0.6s) ease-in-out var(--d, 0s) 1 both;
}
.pi-pop { --pi: pi-pop; --t: 0.45s; }
.pi-press { --pi: pi-press; --t: 0.4s; }
.pi-spin { --pi: pi-spin; --t: 0.8s; }
.pi-pulse { --pi: pi-pulse; --t: 0.6s; }
.pi-shoot { --pi: pi-shoot; --t: 0.6s; }
.pi-bounce { --pi: pi-bounce; --t: 0.6s; }
.pi-tilt { --pi: pi-tilt; --t: 0.7s; }
.pi-lift { --pi: pi-lift; --t: 0.55s; }
.pi-open { --pi: pi-open; --t: 0.6s; }
.pi-fade { --pi: pi-fade; --t: 0.5s; }
.pi-twinkle { --pi: pi-twinkle; --t: 0.7s; }
.pi-grow { --pi: pi-grow; --t: 0.45s; }
.pi-wobble { --pi: pi-wobble; --t: 0.6s; }
.pi-slide { --pi: pi-slide; --t: 0.5s; }
.pi-swing { --pi: pi-swing; --t: 0.8s; }
@keyframes pi-pop { 0% { scale: 0; opacity: 0; } 50% { scale: calc(1 + var(--a, 0.25)); opacity: 1; } 100% { scale: 1; } }
@keyframes pi-press { 33% { scale: calc(1 - var(--a, 0.15)); } 66% { scale: 1.05; } }
@keyframes pi-spin { from { rotate: 0deg; } to { rotate: calc(var(--a, 360) * 1deg); } }
@keyframes pi-pulse { 50% { scale: calc(1 + var(--a, 0.08)); } }
@keyframes pi-shoot {
  0% { translate: 0 0; opacity: 1; }
  40% { translate: calc(var(--x, 0) * var(--a, 7) * 1px) calc(var(--y, 0) * var(--a, 7) * 1px); opacity: 0; }
  41% { translate: calc(var(--x, 0) * var(--a, 7) * -1px) calc(var(--y, 0) * var(--a, 7) * -1px); opacity: 0; }
  100% { translate: 0 0; opacity: 1; }
}
@keyframes pi-bounce {
  25% { translate: calc(var(--x, 0) * var(--a, 3) * 1px) calc(var(--y, 0) * var(--a, 3) * 1px); }
  50% { translate: 0 0; }
  75% { translate: calc(var(--x, 0) * var(--a, 3) * 0.4px) calc(var(--y, 0) * var(--a, 3) * 0.4px); }
}
@keyframes pi-tilt {
  25% { rotate: calc(var(--a, 12) * -1deg); }
  50% { rotate: calc(var(--a, 12) * 0.6deg); }
  75% { rotate: calc(var(--a, 12) * -0.3deg); }
}
@keyframes pi-lift { 50% { translate: calc(var(--x, 0) * 2.5px) calc(var(--y, -1) * 2.5px); rotate: calc(var(--a, 0) * 1deg); } }
@keyframes pi-open { 50% { scale: calc(1 - var(--a, 0.35)) 1; transform: skewY(calc(var(--y, 6) * -1deg)); } }
@keyframes pi-fade { 50% { opacity: 0.15; } }
@keyframes pi-twinkle {
  33% { rotate: calc(var(--a, 18) * -1deg); scale: 0.85; }
  66% { rotate: calc(var(--a, 18) * 1deg); scale: 1.1; }
}
@keyframes pi-grow { from { scale: 1 0; } to { scale: 1 1; } }
@keyframes pi-slide { 50% { translate: calc(var(--x, 0) * var(--a, 2.5) * 1px) calc(var(--y, 0) * var(--a, 2.5) * 1px); } }
@keyframes pi-swing {
  25% { rotate: calc(var(--a, 10) * 1deg); }
  50% { rotate: calc(var(--a, 10) * -0.75deg); }
  75% { rotate: calc(var(--a, 10) * 0.4deg); }
}
@keyframes pi-wobble {
  33% { rotate: calc(var(--a, 8) * -1deg); scale: 1.08; }
  66% { rotate: calc(var(--a, 8) * 1deg); scale: 1.08; }
}

@keyframes panel-cut {
  from { clip-path: polygon(100% 0, 100% 0, 100% 100%, 112% 100%); }
  to { clip-path: polygon(-12% 0, 100% 0, 100% 100%, 0 100%); }
}
@keyframes panel-cut-back {
  from { clip-path: polygon(0 0, 0 0, 0 100%, -12% 100%); }
  to { clip-path: polygon(112% 0, 0 0, 0 100%, 100% 100%); }
}
.topbar { view-transition-name: topbar; }
.tabs-bottom { view-transition-name: tabbar; }
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
::view-transition-new(page) { animation: panel-cut var(--dur) linear; }
html.router-back::view-transition-new(page) { animation-name: panel-cut-back; }

.btn.danger { border-style: dashed; }

.picker .gf-body { display: grid; gap: var(--s3); align-content: start; }
.picker .gsearch { min-height: 44px; border: var(--rule-thin) solid var(--ink); }
.picker-more { justify-self: center; }

.smk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }
.smk-tools .btn .pi { margin-right: var(--s1); }
.smk-state { margin-left: auto; color: var(--tone-4); font-size: var(--t-s); font-weight: 700; }
.smk-layout { display: grid; gap: var(--s6); align-items: start; }
.smk-form { display: grid; gap: var(--s4); min-width: 0; }
.smk-hint { margin: 0; color: var(--tone-4); font-size: var(--t-s); max-width: 48em; }
.smk-row { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.smk-row.four { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.smk-field { display: grid; gap: var(--s1); align-content: start; min-width: 0; font-size: var(--t-s); font-weight: 700; }
.smk-field input[type="text"], .smk-field input[type="number"], .smk-field input[type="url"], .smk-field textarea {
  width: 100%; min-height: 44px; padding: var(--s2) var(--s3); min-width: 0;
  border: var(--rule-thin) solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-m)/1.5 var(--f-ui);
}
.smk-field textarea { resize: vertical; }
.smk-field input::placeholder, .smk-field textarea::placeholder { color: var(--tone-4); }
.smk-field input:focus-visible, .smk-field textarea:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.smk-field .pick select { flex: 1; }
.smk-stage { display: grid; gap: var(--s3); }
.smk-wave { display: grid; gap: var(--s3); padding: 0 var(--s4) var(--s4); border: var(--rule) solid var(--ink); background: var(--paper); }
.smk-wave-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  margin: 0 calc(-1 * var(--s4)); padding: var(--s1) var(--s2) var(--s1) var(--s4); background: var(--ink); color: var(--paper);
}
.smk-wave-head h2 { margin: 0; font: 900 var(--t-l)/1.3 var(--f-display); overflow-wrap: anywhere; }
.smk-wave-head .icon-btn, .smk-wave-head .link-btn { color: var(--paper); }
.smk-wave-head .icon-btn:hover { border-color: var(--paper); }
.smk-rowtools { display: flex; align-items: center; gap: var(--s1); flex-shrink: 0; }
.smk-rowtools .link-btn { min-height: 44px; padding: 0 var(--s2); }
.smk-enemy { display: grid; gap: var(--s3); padding: var(--s3); border: var(--rule-thin) solid var(--ink); }
.smk-enemy-head { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); }
.smk-pick {
  display: flex; align-items: center; gap: var(--s3); flex: 1 1 220px; min-width: 0; min-height: 64px; padding: var(--s1) var(--s3) var(--s1) var(--s1);
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: var(--ink); text-align: left; cursor: pointer;
}
.smk-pick:hover { background: var(--dots), var(--paper); }
.smk-pick:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.smk-pick img { width: 54px; height: 54px; border-radius: 9%; background: var(--tone-1); flex-shrink: 0; }
.smk-pick > span { display: grid; min-width: 0; }
.smk-pick strong { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smk-pick small { color: var(--tone-4); font-size: var(--t-s); }
.smk-kind { flex: 0 1 180px; }
.smk-bar { display: grid; gap: var(--s3); padding-top: var(--s3); border-top: var(--rule-thin) solid var(--tone-2); }
.smk-bar-head { display: flex; align-items: center; justify-content: space-between; font-weight: 900; }
.smk-bar-head .link-btn { min-height: 44px; }
.smk-cd-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.smk-pre { display: inline-flex; align-items: center; gap: var(--s1); cursor: pointer; }
.smk-pre input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.smk-cd-pair { display: flex; align-items: center; gap: var(--s1); }
.smk-cd-pair input { flex: 1; }
.smk-cd-pair [hidden] { display: none; }
.smk-add { justify-self: start; }
.smk-add .pi { margin-right: var(--s1); }
.smk-preview { display: grid; gap: var(--s2); min-width: 0; padding: var(--s3); border: var(--rule) solid var(--ink); background: var(--paper); }
.smk-preview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); font-size: var(--t-s); font-weight: 700; }
.smk-size { font-variant-numeric: tabular-nums; color: var(--tone-4); }
.smk-scale { display: flex; align-items: center; gap: var(--s2); }
.smk-preview-box { min-width: 0; }
.smk-sizer { overflow: hidden; }
.smk-scaler { width: 1440px; transform-origin: 0 0; }
.smk-scaler iframe { display: block; width: 1440px; height: 100%; border: 0; }
.smk-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.smk-rows li { display: flex; align-items: stretch; gap: var(--s2); }
.smk-rows li.current .smk-row-open { background: var(--ink); color: var(--paper); }
.smk-row-open {
  flex: 1; min-width: 0; display: grid; gap: 2px; padding: var(--s2) var(--s3); text-align: left; cursor: pointer;
  border: var(--rule-thin) solid var(--ink); background: var(--paper); color: inherit;
}
.smk-row-open:hover { background: var(--dots), var(--paper); }
.smk-row-open span, .smk-row-open small { font-size: var(--t-s); color: inherit; opacity: 0.8; }

.ck-form { position: relative; }
.ck-item h3 { margin: 0; font: 900 var(--t-m)/1.3 var(--f-display); }
.ck-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.ck-tag-chip {
  display: inline-flex; align-items: center; gap: var(--s1); min-height: 36px; padding-left: var(--s2);
  border: var(--rule-thin) solid var(--ink); background: var(--paper); font-weight: 700;
}
.ck-tag-chip img { width: 28px; height: 28px; padding: 2px; object-fit: contain; }
.ck-tag-chip img, .ck-tag img { background: var(--tag-color); }
.ck-char-chip img { background: none; }
.ck-tag-chip button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; color: inherit; cursor: pointer; }
.ck-tag-chip button:hover { background: var(--ink); color: var(--paper); }
.ck-chips .btn .pi, .ck-custom .btn .pi { margin-right: var(--s1); }
.ck-desc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.ck-descbox .seg span { min-height: 32px; }
.ck-id-row { display: flex; gap: var(--s2); }
.ck-id-row input { flex: 1; }
.ck-id-row .btn { flex-shrink: 0; min-height: 44px; }
.ck-cost-row { display: flex; align-items: stretch; gap: var(--s2); }
.ck-cost-row .segs { flex-shrink: 0; }
.ck-cost-row .seg span { min-height: 40px; height: 100%; }
.ck-cost-row input { flex: 1; min-width: 64px; }
.ck-node { display: grid; gap: var(--s2); padding: var(--s2) 0 var(--s1) var(--s3); border-left: var(--rule) solid var(--tone-2); }
.ck-node.root { padding: 0; border-left: 0; }
.ck-node-head { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s2); }
.ck-node-head .smk-field { flex: 0 1 180px; }
.ck-node-mark { align-self: center; min-width: 1.5em; font-weight: 900; }
.ck-children { display: grid; gap: var(--s1); }
.ck-node-add { justify-self: start; min-height: 36px; }
.ck-node textarea { width: 100%; min-height: 44px; padding: var(--s2) var(--s3); border: var(--rule-thin) solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); font: 400 var(--t-m)/1.5 var(--f-ui); resize: vertical; }
.ck-descbox > textarea { resize: vertical; }
.ck-node textarea:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.ck-bar {
  position: absolute; z-index: 5; display: flex; flex-wrap: wrap; gap: var(--s1); padding: var(--s1);
  max-width: calc(100% - var(--s4)); translate: 0 calc(-100% - 4px);
  border: var(--rule-thin) solid var(--ink); background: var(--paper); box-shadow: 4px 4px 0 var(--ink);
}
.ck-preview { position: relative; height: min(80dvh, 760px); border: var(--rule) solid var(--ink); background: #000; }
.ck-preview iframe { display: block; width: 100%; height: 100%; border: 0; }
.ck-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; background: #000; color: #fff; font-weight: 700; }
.ck-loading[hidden], .ck-chars[hidden], .gf-foot[hidden] { display: none; }
.ck-chars { display: grid; gap: var(--s3); padding: var(--s3); border: var(--rule-thin) solid var(--ink); }
.ck-chars .gsearch { min-height: 44px; border: var(--rule-thin) solid var(--ink); }
.ck-custom { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.ck-custom input { flex: 1 1 160px; min-height: 40px; padding: 0 var(--s2); border: var(--rule-thin) solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); }
.ck-custom input:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.ck-char-grid, .ck-tag-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.ck-char-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.ck-tag-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.ck-char-grid li { display: flex; }
.ck-char, .ck-tag {
  flex: 1; width: 100%; display: flex; align-items: center; gap: var(--s2); min-height: 44px; padding: var(--s1) var(--s2);
  border: var(--rule-thin) solid var(--tone-2); background: var(--paper); color: var(--ink); cursor: pointer; text-align: left; font-size: var(--t-s); font-weight: 700;
}
.ck-char img, .ck-tag img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.ck-tag img { padding: 2px; }
.ck-char:hover, .ck-tag:hover { border-color: var(--ink); }
.ck-char[aria-pressed="true"], .ck-tag[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ck-char:focus-visible, .ck-tag:focus-visible { outline: 3px solid var(--spot); outline-offset: 2px; }
.ck-char-grid li.user .ck-char { border-style: dashed; }
.ck-griddlg .gf-body { display: grid; gap: var(--s3); align-content: start; }
.ck-brush { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s2) var(--s3); font-size: var(--t-s); font-weight: 700; }
.ck-brush > .smk-pre { grid-column: 1 / -1; }
.ck-grid { display: grid; gap: 2px; width: max-content; max-width: 100%; overflow-x: auto; padding: var(--s2); background: #1c1c1c; touch-action: none; }
.ck-cell { position: relative; width: 48px; height: 48px; padding: 0; border: 1px solid #444; background: #2a2a2a; color: #fff; font-size: 10px; cursor: pointer; }
.ck-cell:hover { border-color: #aaa; }
.ck-cell:focus-visible { outline: 3px solid var(--spot); outline-offset: 1px; }
.ck-cell img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.ck-cell .ck-cell-race { position: absolute; right: 0; bottom: 0; width: 45%; height: 45%; }
.ck-foot-r { display: flex; gap: var(--s2); }

@media (min-width: 1024px) {
  .smk-layout { grid-template-columns: minmax(440px, 1fr) minmax(0, 1fr); }
  .smk-preview { position: sticky; top: calc(var(--top-h) + var(--gutter)); max-height: calc(100dvh - var(--top-h) - 2 * var(--gutter)); grid-template-rows: auto minmax(0, 1fr); }
  .smk-preview-box { overflow-y: auto; overscroll-behavior: contain; }
  .lsplit.with-detail .ldetail { max-height: calc(100dvh - var(--top-h) - 2 * var(--gutter)); overflow-y: auto; scrollbar-width: thin; }
  .lsplit.with-detail .lenemy.multi .lenemy-art { top: 0; }
  .ck-preview { position: sticky; top: calc(var(--top-h) + var(--gutter)); height: calc(100dvh - var(--top-h) - 2 * var(--gutter)); }
  .ck-jump { display: none; }
  .gallery .glayout { grid-template-columns: 340px minmax(0, 1fr); }
  .gallery .gmain { position: sticky; top: var(--stick-top); height: var(--stick-h); display: flex; flex-direction: column; }
  .gscroll {
    flex: 1; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: thin;
    scrollbar-gutter: stable;
    margin: 0 -8px; padding: 8px 8px var(--s4);
  }
  .ghead .gresult { margin-bottom: 0; }
}
@media (min-width: 1280px) {
  .gallery .glayout {
    grid-template-columns: 340px minmax(360px, 1fr)
      minmax(0, calc((var(--stick-h) - 2 * var(--rule-mast)) * 1320 / 2577 + 2 * var(--rule-mast)));
  }
  .card-overlay.docked {
    inset: auto; position: sticky; top: var(--stick-top); z-index: 1;
    height: var(--stick-h); container-type: size;
    visibility: visible; pointer-events: auto; cursor: auto;
    border: var(--rule-mast) solid var(--ink); background: var(--dots), var(--paper);
  }
  .card-overlay.docked.active { background: #121212; }
  .card-overlay.docked.loading:not(.active)::after { border-color: var(--ink); border-top-color: var(--spot); top: calc(50% - 18px); }
  .card-overlay.docked iframe { width: min(100cqw, 100cqh * 1320 / 2577); }
  .card-overlay.docked .overlay-close { display: none; }
  .card-overlay.docked .dock-empty {
    display: block; position: absolute; left: var(--s6); right: var(--s6); top: 40%; margin: 0;
    padding: var(--s3) var(--s4); border: var(--rule-thin) solid var(--ink); background: var(--paper);
    font: 900 var(--t-m)/1.5 var(--f-display); text-align: center; text-wrap: balance;
  }
  .card-overlay.docked.active .dock-empty, .card-overlay.docked.loading .dock-empty { display: none; }
  .gallery .glayout.codex-mode {
    grid-template-columns: 340px minmax(360px, 1fr) minmax(360px, 440px);
  }
  .codex-detail-wrap.docked {
    display: block;
    inset: auto; position: sticky; top: var(--stick-top); z-index: 1;
    height: var(--stick-h); padding: 0;
    visibility: visible; pointer-events: auto;
    border: var(--rule-mast) solid var(--ink); background: var(--dots), var(--paper);
  }
  .codex-detail-wrap.docked.active { background: var(--paper); }
  .codex-detail-wrap.docked .codex-detail {
    position: relative; width: 100%; height: 100%; overflow-y: auto; overscroll-behavior: contain;
    padding: var(--s4); scrollbar-width: thin;
  }
  .codex-detail-wrap.docked .codex-close { display: none; }
  .codex-detail-wrap.docked .dock-empty {
    display: block; position: absolute; left: var(--s6); right: var(--s6); top: 40%; margin: 0;
    padding: var(--s3) var(--s4); border: var(--rule-thin) solid var(--ink); background: var(--paper);
    font: 900 var(--t-m)/1.5 var(--f-display); text-align: center; text-wrap: balance;
  }
  .codex-detail-wrap.docked.active .dock-empty { display: none; }
}

@media (max-width: 1023px) {
  :root { --tab-h: 64px; --top-h: 56px; }
  .tabs-top { display: none; }
  .topbar {
    gap: var(--s3); border-bottom-width: var(--rule);
    padding: 0 max(var(--s3), env(safe-area-inset-right)) 0 max(var(--s3), env(safe-area-inset-left));
  }
  .brand { font-size: 18px; }
  .tabs-bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    box-shadow: 2px var(--rule) 0 var(--paper), 2px 0 0 var(--ink);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--paper); border-top: var(--rule) solid var(--ink);
    transition: transform var(--dur) var(--ease-out);
  }
  .tabs-bottom.bar-hidden { transform: translateY(100%); }
  .tabs-bottom a { position: relative; flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 2px; font-size: 12px; font-weight: 700; }
  .tabs-bottom a .pi { width: 52px; height: 30px; padding: 3px 14px; }
  .tabs-bottom a[aria-current="page"] .pi { background: var(--ink); color: var(--paper); }
  .tabs-bottom a[aria-current="page"]::before { content: ""; position: absolute; left: 12%; right: 12%; top: -3px; height: var(--rule-mast); background: var(--spot); }
  .tabs-bottom a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .auth-user span { display: none; }
  .btn.small { min-height: 44px; }
  main { padding: var(--s4) max(var(--s4), env(safe-area-inset-right)) var(--s8) max(var(--s4), env(safe-area-inset-left)); }
  .page-title { font-size: var(--t-l); }
  .hero { padding: var(--s6) var(--s4); min-height: 240px; border-width: var(--rule); }
  .hero::after { left: 30%; }
  .lede { font-size: 17px; }
  .feature-section { margin-top: var(--s6); }
  .feature-grid { grid-template-columns: minmax(0, 1fr); }
  .feature-grid > li, .feature-grid > li:first-child, .feature-grid > li:first-child + li, .feature-grid > li:first-child:nth-last-child(3) ~ li { grid-column: auto; grid-row: auto !important; }
  .feature-grid > li:first-child:nth-last-child(3) .feature::before { display: none; }
  .feature { min-height: 0 !important; padding: var(--s4); }
  .feature-icon { width: 48px; height: 48px; }
  .feature-grid > li:first-child .feature { align-items: center; }
  .feature-grid > li:first-child .feature-text strong { font-size: var(--t-l); }
  .ldetail { position: static; padding: 0; border: 0; }
  .ldetail-img {
    margin-left: calc(-1 * max(var(--s4), env(safe-area-inset-left)));
    margin-right: calc(-1 * max(var(--s4), env(safe-area-inset-right)));
    border-width: var(--rule) 0;
  }
  .ldetail-head { grid-template-columns: auto minmax(0, 1fr); }
  .ldetail-open { grid-column: 1 / -1; justify-self: start; }
  .ldetail-boss img { width: 56px; height: 56px; }
  .intro { padding: var(--s4); border-width: var(--rule); }
  .gf { width: 100vw; max-width: 100vw; margin: auto 0 0; border-width: var(--rule) 0 0; max-height: 88dvh; }
  .gf-head { padding-left: var(--s4); }
  .gf-tabs, .gf-body, .gf-foot { padding-left: var(--s4); padding-right: var(--s4); }
  .chip, .seg span { min-height: 44px; }
  .gsort { flex: 1 1 auto; }
  .gsort select { flex: 1; }
  .sim-layout { grid-template-columns: minmax(0, 1fr); }
  .sim .page-title { margin-bottom: var(--s2); }
  .sim-play, .sim-stage { --sim-above: 54px; gap: var(--s2); }
}

@media (min-width: 1024px) and (orientation: landscape) {
  .sim { max-width: 1400px; }
  .sim-layout {
    --board-w: clamp(420px, calc((100dvh - 250px) * 1.2), 800px);
    grid-template-columns: minmax(0, var(--board-w)) minmax(340px, 1fr);
    grid-template-rows: auto auto auto auto 1fr;
    grid-template-areas: "hud pal" "stage hint" "stage act" "stage side" "stage side";
    column-gap: var(--s8); row-gap: var(--s3);
  }
  .sim-play { display: contents; }
  .sim-hud { grid-area: hud; align-self: center; }
  .sim-counts { gap: var(--s3); }
  .sim-counts li { gap: var(--s1); font-size: var(--t-l); }
  .sim-counts img { width: 40px; height: 40px; }
  .sim-stat { font-size: var(--t-l); }
  .sim-stat strong { font-size: var(--t-xl); }
  .sim-palette { grid-area: pal; }
  .sim-hint, .bs-assign { grid-area: hint; align-self: start; }
  .sim-hint { min-height: 3.2em; }
  .sim-actions { grid-area: act; padding-bottom: var(--s3); border-bottom: var(--rule-thin) solid var(--ink); }
  .sim-stage { grid-area: stage; margin-top: 0; align-self: start; position: sticky; top: calc(var(--top-h) + var(--s4)); }
  .sim-side { grid-area: side; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-content: start; }
  .sim-side > :first-child, .sim-legacy { grid-column: 1 / -1; }
}

@media (orientation: portrait) {
  .sim-layout { grid-template-columns: minmax(0, 1fr); }
  .sim-board {
    margin-left: calc(-1 * max(var(--s4), env(safe-area-inset-left)));
    margin-right: calc(-1 * max(var(--s4), env(safe-area-inset-right)));
    outline: 0;
  }
}
@media (orientation: portrait) and (min-width: 1024px) {
  .sim-board {
    margin-left: calc(-1 * max(var(--s8), env(safe-area-inset-left)));
    margin-right: calc(-1 * max(var(--s8), env(safe-area-inset-right)));
  }
}
@media (orientation: portrait) and (max-height: 760px) {
  .sim-hint:not(.sim-locked) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
