/* Character profiles */
#body.character-layout { padding-top: 20px; }
.character-layout .main { min-width: 0; }
.ch-glyph { display: block; flex: none; width: 18px; height: 18px; }
.ch-toolbar, .ch-crumb, .ch-jumps { display: flex; align-items: center; }
.ch-toolbar { flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-bottom: 14px; }
.ch-crumb { gap: 8px; font-size: .875rem; color: var(--ink-3); }
.ch-crumb .ch-glyph { width: 13px; height: 13px; }
.ch-crumb a, .ch-jumps a { font-weight: 600; color: var(--ink-2); }
.ch-crumb a:hover, .ch-jumps a:hover { color: var(--accent-ink); text-decoration: underline; }
.ch-jumps { flex-wrap: wrap; gap: 4px 18px; font-size: .875rem; }
.ch-jumps a { padding-block: 4px; }

.ch-hero { overflow: hidden; }
.ch-banner {
  --scene-ink: #18352d;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 256px;
  background: var(--scene-ink);
  color: white;
}
.ch-banner.scene-perion { --scene-ink: #462a25; }
.ch-banner.scene-kerning { --scene-ink: #312a3d; }
.ch-banner.scene-southperry { --scene-ink: #1a394a; }
.ch-banner.scene-henesys { --scene-ink: #203a31; }
.ch-landscape {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 13%;
  background: var(--scene-top) var(--scene) 62% bottom / auto max(100%, 350px) no-repeat;
}
.ch-landscape::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, var(--scene-ink) 0%, color-mix(in srgb, var(--scene-ink) 94%, transparent) 11%, color-mix(in srgb, var(--scene-ink) 54%, transparent) 32%, transparent 61%),
    linear-gradient(0deg, #07171340, transparent 26%);
}
.ch-town {
  position: absolute;
  top: 16px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid #ffffff52;
  border-radius: 6px;
  background: #10251ed9;
  color: #fff;
  font-size: .78rem;
  font-weight: 650;
}
.ch-town .ch-glyph { width: 14px; height: 14px; }
.ch-sprite, .ch-sprite-none { position: absolute; left: 62%; transform: translateX(-50%); }
.ch-sprite {
  bottom: 8px; /* The portrait has eight transparent pixels below its feet at native size. */
  width: 240px;
  height: 240px;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 2px #0b201b80);
}
.ch-sprite-none {
  bottom: 30px;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 12px;
  max-width: 160px;
  border: 1px solid #ffffff4d;
  border-radius: 12px;
  background: #10251ed9;
  text-align: center;
  font-size: .8125rem;
}
.ch-sprite-none .ch-glyph { width: 28px; height: 28px; }
.ch-id { width: 56%; padding: 35px clamp(22px, 3.8vw, 54px); }
.ch-identity-line, .ch-job, .ch-level, .ch-tags, .ch-tag, .ch-tag-form { display: flex; align-items: center; }
.ch-identity-line { flex-wrap: wrap; gap: 9px 14px; }
.ch-level {
  gap: 5px;
  border: 1px solid #f6d99880;
  border-radius: 5px;
  padding: 3px 9px;
  background: #ffdc8a1a;
  color: #ffe0a3;
  font: 650 .8125rem/1.3 var(--font);
}
.ch-level b { font-weight: 800; }
.ch-job { gap: 7px; font-weight: 650; font-size: .9375rem; }
.ch-job img { object-fit: contain; image-rendering: pixelated; }
.ch-id h1 {
  margin: 8px 0 20px;
  font-size: clamp(2.25rem, 4.4vw, 3.75rem);
  letter-spacing: -.055em;
  line-height: 1.07;
  overflow-wrap: anywhere;
  color: #fffdf6;
  text-shadow: 0 2px 12px #0e241d42;
}
.ch-tags { flex-wrap: wrap; gap: 7px; }
.ch-tag {
  min-height: 36px;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid #ffffff66;
  border-radius: 8px;
  background: #0a1c19ad;
  color: #fff;
  font: 650 .875rem/1.3 var(--font);
  text-align: left;
}
.ch-tag-form { margin: 0; }
button.ch-tag { cursor: pointer; }
.ch-tag:hover { background: #0a1c19; color: #fff; }
.ch-tag.claim { background: #ffdd98; color: #3d2b0a; border-color: #ffdd98; }
.ch-tag.claim:hover { background: #ffeabe; color: #302005; }
.ch-tag.mine { border-color: #a4e9c9; color: #bcf4d8; }
.ch-tag.unverified { border-style: dashed; }
.ch-tag .ch-glyph { width: 16px; height: 16px; }
.ch-country-flag { flex: none; object-fit: contain; }

.ch-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.ch-stat { position: relative; min-width: 0; padding: 17px 22px 18px; }
.ch-stat + .ch-stat::before { content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; border-left: 1px solid var(--line); }
.ch-stat dt { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: .8125rem; font-weight: 600; }
.ch-rank .ch-glyph { color: var(--gold-ink); }
.ch-class-rank .ch-glyph { color: var(--blue-ink); }
.ch-fame .ch-glyph { color: var(--accent-ink); }
.ch-seen .ch-glyph { color: var(--green-ink); }
.ch-stat dd { margin: 4px 0 0; color: var(--ink); font: 700 clamp(1.25rem, 2.15vw, 1.75rem)/1.25 var(--head); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.ch-stat dd a { color: var(--ink); }
.ch-stat dd a::after { content: ""; position: absolute; inset: 0; }
.ch-stat:has(a):hover { background: var(--card-2); }
.ch-stat a:hover, .ch-stat a:focus-visible { color: var(--accent-ink); text-decoration: underline; }
.ch-seen dd { font-size: clamp(1.05rem, 1.75vw, 1.4rem); letter-spacing: -.035em; }

.character-layout .box-h { flex-wrap: wrap; gap: 8px 12px; padding: 18px 22px; }
.character-layout .box-h::before { display: none; }
.character-layout .box-h h2 { margin: 0; font-size: 1.375rem; letter-spacing: -.04em; }
.character-layout .box-h .ch-count { margin-left: 0; }
.ch-count { padding: 3px 9px; border-radius: 6px; background: var(--bg-2); color: var(--ink-2); font: 600 .8125rem/1.4 var(--font); }
.character-layout .box-b { padding: 20px 22px; }
.character-layout .main > [id], .ch-item { scroll-margin-top: calc(var(--topbar-h) + 18px); }
.ch-gear { display: grid; grid-template-columns: 322px minmax(0, 1fr); gap: 20px; align-items: start; }
.ch-window {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  min-width: 0;
  padding: 0 14px;
  border: 1px solid #33443f;
  border-radius: 13px;
  background: linear-gradient(145deg, #374b45, #243732 75%);
  color: #f4faf5;
}
.ch-window summary { display: flex; align-items: center; gap: 8px; padding: 13px 0; list-style: none; cursor: pointer; font: 650 .9375rem/1.4 var(--head); }
.ch-window summary::-webkit-details-marker { display: none; }
.ch-window summary .ch-glyph:first-child { color: #c4dec9; width: 16px; height: 16px; }
.ch-window summary .ch-glyph:last-child { width: 16px; height: 16px; margin-left: auto; }
.ch-window[open] summary .ch-glyph:last-child { transform: rotate(180deg); }
.ch-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding-bottom: 14px; }
.ch-slot {
  position: relative;
  min-width: 0;
  min-height: 52px;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid #cad7ce;
  border-radius: 6px;
  background: linear-gradient(#f3f6ed, #dbe5d9);
  box-shadow: inset 0 1px 0 #fff;
}
.ch-slot img { width: 36px; height: 36px; object-fit: contain; image-rendering: pixelated; }
.ch-slot.empty {
  background: #1d302b;
  border: 1px dashed #53685e;
  box-shadow: none;
  color: #bdd0c4;
  padding: 2px;
  font-size: .75rem;
  line-height: 1.14;
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: auto;
}
a.ch-slot:hover, a.ch-slot:focus-visible { background: #fff3d5; border-color: #efc76f; outline: 2px solid #efc76f; outline-offset: 0; }
.ch-cos { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #6249a0; color: #fff; font: 700 10px/1 var(--font); }
.ch-slot .ch-cos { position: absolute; top: 2px; right: 2px; }
.ch-legend { display: flex; align-items: center; gap: 6px; margin: -3px 0 13px; color: #dce9dd; font-size: .8125rem; }
.ch-legend .ch-cos { flex: none; }

.ch-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; align-items: start; }
.ch-item {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  column-gap: 12px;
  align-content: center;
  align-self: stretch;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
}
.ch-item:target { border-color: var(--accent); outline: 2px solid var(--accent-soft); background: var(--accent-soft); }
.ch-item > .ic {
  grid-row: 1 / span 2;
  align-self: start;
  display: grid;
  place-items: center;
  height: 50px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
}
.ch-item > .ic img { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; }
.ch-item .slot { display: block; color: var(--ink-3); font-weight: 600; font-size: .75rem; line-height: 1.35; }
.ch-item .nm { font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.ch-item a.nm:hover, .ch-look a:hover { text-decoration: underline; color: var(--accent-ink); }
.ch-item > .ch-chips, .ch-item > .ch-look { grid-column: 1 / -1; }
.ch-price { grid-column: 2; margin-top: 3px; }
.ch-price a { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 650; font-size: .8125rem; line-height: 1.4; }
.ch-price img { image-rendering: pixelated; object-fit: contain; }
.ch-price a:hover { color: var(--accent-ink); text-decoration: underline; }
/* Verify <name> in game: the code to whisper */
.ch-verify .box-b p { margin: 0 0 10px; }
/* the two whisper steps: "/w <receiver>" starts the whisper, the code is the message (the game takes no "/w name text") */
.ch-steps { list-style: none; counter-reset: step; display: grid; gap: 8px; margin: 2px 0 12px; padding: 0; }
.ch-steps li { counter-increment: step; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 14px 10px 12px;
  border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--line); }
.ch-steps li::before { content: counter(step); flex: 0 0 auto; display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 700; }
.ch-steps code { font-size: 16px; font-weight: 700; }
.ch-steps b { font-size: 30px; font-weight: 800; letter-spacing: .16em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ch-steps small { flex: 1 1 100%; padding-left: 36px; font-size: 13px; color: var(--ink-3); }
.ch-verify-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ch-verify-actions form { margin: 0; }

.ch-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.ch-chip { padding: 2px 8px; border-radius: 6px; background: var(--bg-2); font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; }
.ch-chip b { color: var(--ink); font-weight: 700; }
.ch-chip.slots { background: transparent; border: 1px solid var(--line); color: var(--ink-3); }
.ch-chip .ch-roll { color: var(--ink-3); }
.ch-item .ch-plus { margin-left: 5px; font-weight: 700; font-size: 15px; color: var(--gold-ink); }
.ch-look { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; font-size: 12.5px; color: var(--ink-3); }
.ch-look img { width: 20px; height: 20px; image-rendering: pixelated; object-fit: contain; }
.ch-look a, .ch-look b { overflow-wrap: anywhere; color: var(--violet); font-weight: 650; }
.ch-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet);
  font-size: 11px; font-weight: 700; vertical-align: 2px; }
.ch-total { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--line); }
.ch-total h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.ch-total .ch-chips { margin: 0 0 8px; }
.ch-total .ch-chip { background: var(--card); border: 1px solid var(--line); font-size: 13px; padding: 3px 10px; }
.ch-total p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.ch-when { text-align: right; font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--ink-3); }

/* history: what changed between scans, newest first */
.ch-hist { list-style: none; margin: 0; padding: 0; }
.ch-day { display: flex; align-items: center; gap: 12px; margin: 22px 0 5px; font-size: .8125rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.ch-day:first-child { margin-top: 0; }
.ch-ev { display: grid; grid-template-columns: 40px 1fr auto; gap: 0 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.ch-day + .ch-ev { border-top: 0; }
.ch-ev-ic { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-2);
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ch-ev-ic img { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; }
.ch-ev-ic.off img { opacity: .4; filter: grayscale(1); }
.ch-ev-ic.lv { background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.ch-ev-ic.up { background: var(--green-soft); color: var(--green-ink); }
.ch-ev-ic.down { background: var(--red-soft); color: var(--red-ink); }
.ch-ev-ic.job { font-size: 16px; }
.ch-ev-ic.seen { background: var(--green-soft); color: var(--green-ink); font-size: 16px; }
.ch-ev-main { font-size: 1rem; color: var(--ink); overflow-wrap: anywhere; }
.ch-ev-main a { font-weight: 700; color: var(--ink); }
.ch-ev-main a:hover { color: var(--accent-ink); }
.ch-ev-main b { font-weight: 800; }
.ch-ev-main .ch-badge { vertical-align: 1px; }
.ch-ev-sub { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.ch-ev-sub a { color: var(--ink-2); }
.ch-ev-t { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; align-self: start; padding-top: 3px; }
.ch-hist-note { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }

/* their Free Market shop, as the scanner last opened it (src/fm_shop.php) */
.ch-shop-title { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.ch-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.ch-shop-slot { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-2); color: var(--ink); }
.ch-shop-slot img { flex: none; width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; }
.ch-shop-slot span { min-width: 0; }
.ch-shop-slot b { font-weight: 700; }
.ch-shop-slot small { display: block; font-size: 12px; color: var(--ink-3); }
.ch-shop-slot.out { opacity: .5; }
a.ch-shop-slot:hover { background: var(--accent-soft); color: var(--ink); }
.ch-closed { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); background: var(--bg-2); }
.ch-open { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--green-ink); background: var(--green-soft); }

.ch-day::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.rk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.rk-dot.warrior { background: var(--red); }
.rk-dot.magician { background: var(--blue); }
.rk-dot.bowman { background: var(--green); }
.rk-dot.thief { background: var(--violet); }

@media (max-width: 1000px) {
  .ch-stat { padding-inline: 17px; }
  .ch-gear { grid-template-columns: 310px minmax(0, 1fr); gap: 14px; }
  .ch-item { grid-template-columns: 40px minmax(0, 1fr); column-gap: 9px; padding: 10px; }
  .ch-item > .ic { height: 40px; }
  .ch-item > .ic img { width: 32px; height: 32px; }
}
@media (min-width: 761px) and (max-width: 900px) {
  .ch-items { grid-template-columns: minmax(0, 1fr); }
  .ch-item { grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; }
  .ch-item > .ic { grid-row: auto; }
  .ch-price { grid-row: 1; grid-column: 3; }
}
@media (max-width: 760px) {
  #body.character-layout { padding-top: 12px; }
  .ch-toolbar { gap: 4px 16px; margin-bottom: 10px; }
  .ch-jumps { gap: 2px 12px; }
  .ch-id { padding: 24px; width: 60%; }
  .ch-banner { min-height: 208px; }
  .ch-landscape { inset-inline-start: 0; background-size: auto max(100%, 275px); }
  .ch-sprite { left: 73%; width: 192px; height: 192px; }
  .ch-stat { padding: 14px; }
  .ch-stat dt { gap: 5px; }
  .ch-stat dt .ch-glyph { width: 16px; height: 16px; }
  .ch-gear { grid-template-columns: minmax(0, 1fr); }
  .ch-window { position: static; }
  .ch-slots { grid-template-columns: repeat(auto-fit, minmax(65px, 1fr)); }
  .ch-slot { aspect-ratio: auto; min-height: 60px; }
  .character-layout .box-b { padding: 14px; }
  .character-layout .box-h { padding: 16px; gap: 6px 8px; }
  .ch-shop { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
}
@media (max-width: 560px) {
  .ch-crumb > span, .ch-crumb > svg { display: none; }
  .ch-crumb a, .ch-jumps a { min-height: 32px; display: inline-flex; align-items: center; }
  .ch-crumb a { color: var(--blue-ink); }
  .ch-banner { display: grid; min-height: 0; }
  .ch-landscape { position: relative; inset: auto; height: 158px; background-position: 50% bottom; background-size: auto 208px; }
  .ch-landscape::before { background: linear-gradient(0deg, color-mix(in srgb, var(--scene-ink) 45%, transparent), transparent 28%); }
  .ch-town { top: 9px; right: 10px; }
  .ch-sprite, .ch-sprite-none { left: 50%; }
  .ch-sprite { width: 160px; height: 160px; bottom: 2px; }
  .ch-sprite-none { bottom: 12px; }
  .ch-id { width: 100%; padding: 16px 18px 18px; }
  .ch-id h1 { margin: 6px 0 13px; font-size: clamp(1.9rem, 8vw, 2.5rem); }
  .ch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-stat { padding: 10px 15px 12px; }
  .ch-stat:nth-child(3)::before { display: none; }
  .ch-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ch-stat dd { margin-top: 3px; }
  .ch-items { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .ch-item { grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; }
  .ch-item > .ic { grid-row: auto; height: 42px; }
  .ch-price { grid-row: 1; grid-column: 3; margin: 0; }
  .ch-price a { justify-content: end; }
  .ch-when { font-size: .75rem; }
  .ch-ev { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
  .ch-ev-ic { width: 34px; height: 34px; }
  .ch-ev-ic img { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  html:has(.character-layout) { scroll-behavior: auto; }
}
