:root {
  --bg: #0d0b10;
  --panel: rgba(24, 18, 20, 0.88);
  --line: rgba(201, 150, 110, 0.35);
  --text: #f1e6d6;
  --muted: #b9a891;
  --crimson: #b3262e;
  --crimson-hi: #d8434b;
  --gold: #e3b873;
  font-family: "Noto Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(179, 38, 46, 0.22), transparent 60%), linear-gradient(#141015, #0a080c);
}
.brand { text-align: center; }
.logo { font-family: Cinzel, serif; font-weight: 800; font-size: clamp(34px, 7vw, 64px); letter-spacing: 0.08em; color: var(--text); text-shadow: 0 4px 24px rgba(0,0,0,.6); }
.logo span { color: var(--crimson-hi); }
.brand.small .logo { font-size: 30px; }
.tag { color: var(--muted); letter-spacing: .06em; margin-top: 4px; }

.panel {
  width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.panel.wide { width: min(640px, 100%); }
.panel h2 { margin: 0; font-size: 18px; color: var(--gold); font-weight: 600; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, select {
  font: inherit; color: var(--text); background: #1a1417; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--crimson-hi); }
button {
  font: inherit; font-weight: 600; color: #fff; background: var(--crimson); border: 0; border-radius: 8px; padding: 11px 18px; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--crimson-hi); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tabs button { flex: 1; background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 8px 10px; }
.tabs button.on { background: rgba(179,38,46,.25); border-color: var(--crimson-hi); color: var(--text); }
.hint { margin: -4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.status { min-height: 1.2em; margin: 0; font-size: 13px; color: var(--gold); }

.char-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.char-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: rgba(255,255,255,.02); }
.char-card:hover { border-color: var(--gold); }
.char-card.sel { border-color: var(--crimson-hi); background: rgba(179,38,46,.15); }
.char-card b { display: block; font-size: 16px; }
.char-card small { color: var(--muted); }
.class-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.class-card { cursor: pointer; }
.class-card.sel { border-color: var(--gold); background: rgba(179,38,46,.32); box-shadow: 0 0 0 1px var(--gold) inset; }
.class-card small { display: block; color: var(--gold); opacity: .8; font-size: 12px; }
.hair-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.hair-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); padding: 0; cursor: pointer; }
.hair-swatch.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(240,200,120,.5); }
.class-card { flex: 1; border: 1px solid var(--crimson-hi); border-radius: 10px; padding: 12px; background: rgba(179,38,46,.12); }
.class-card b { color: var(--gold); }
.class-card p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }


#rotate-hint { position: fixed; inset: 0; background: rgba(10,8,12,.94); z-index: 20; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; display: none !important; }
#rotate-hint b { font-size: 54px; color: var(--gold); }
@media (orientation: portrait) { body.touch.ingame #rotate-hint { display: flex !important; } }
/* ---------- Phase 2: exp, buttons, windows ---------- */
#dead { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(40,0,5,.45); }
#dead b { font-family: Cinzel, serif; font-size: 40px; color: var(--crimson-hi); text-shadow: 0 3px 12px #000; }

.win { position: fixed; top: 70px; right: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.55); z-index: 5; user-select: none; }
.win header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--gold); }
.win .x { background: transparent; padding: 2px 8px; color: var(--muted); }
#stats { right: auto; left: 16px; top: 90px; width: 250px; }
.grid { position: relative; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 6px; }
.grid .cell { position: absolute; width: 40px; height: 40px; border-right: 1px solid rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.04); }
.grid .item { position: absolute; background: linear-gradient(#2a2025, #1c1519); border: 1px solid rgba(227,184,115,.45); border-radius: 5px; font-size: 10px; line-height: 1.15; padding: 2px 3px; overflow: hidden; cursor: pointer; }
.grid .item:hover { border-color: var(--gold); }
.grid .item i { position: absolute; right: 3px; bottom: 1px; font-style: normal; color: #fff; }
.win footer { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); gap: 12px; }
.win footer b { color: var(--gold); }
.srow { display: grid; grid-template-columns: 1fr auto 28px; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13px; }
.srow.hl b { color: var(--gold); }
.srow button { padding: 0; width: 26px; height: 22px; font-size: 14px; }
#tip { position: fixed; z-index: 9; max-width: 220px; background: rgba(12,9,12,.96); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; pointer-events: none; }
@media (max-width: 600px) { .win { right: 4px; left: 4px; top: 60px; overflow: auto; max-height: 70vh; } }

/* windows on phones */
.win.cover, body.touch .win { top: calc(58px + env(safe-area-inset-top)); left: 50%; right: auto; transform: translateX(-50%); max-height: calc(100vh - 70px); overflow: auto; }
body.touch #stats { width: 260px; }
.inv-act { display: none; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.inv-act.on { display: flex; }
.inv-act span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-act button { padding: 7px 12px; font-size: 13px; }
.grid .item.sel { border-color: var(--crimson-hi); box-shadow: 0 0 0 2px rgba(216,67,75,.5) inset; }
@media (max-height: 500px) {
  body.touch .win { top: 6px; max-height: calc(100vh - 12px); }
}
#settings { width: min(340px, 94vw); left: 50%; right: auto; transform: translateX(-50%); top: 60px; max-height: calc(100vh - 70px); overflow: auto; }
.set h4 { margin: 10px 0 4px; font-size: 13px; color: var(--gold); font-weight: 600; }
.srow2 { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--text); border-bottom: 1px solid rgba(255,255,255,.05); }
.srow2 span { display: flex; align-items: center; gap: 6px; }
.srow2 input[type=range] { width: 120px; padding: 0; }
.srow2 input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--crimson); }
.srow2 select { padding: 4px 6px; font-size: 13px; }
#shop { left: calc(50% - 360px); right: auto; transform: none; top: 60px; }
body.touch #shop { left: 8px; transform: none; }
#shop { --cell: clamp(40px, 11vh, 54px); width: min(330px, 40vw); }
.shopgrid { max-height: 52vh; min-height: calc(var(--cell) * 2 + 6px); background: rgba(0,0,0,.3); border-radius: 8px; padding: 6px; }
.bagwin i.pr, #shop i.pr { position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font: 700 10px system-ui; font-style: normal; color: #f2c14e; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
#shop .cell i.cnt { display: none; }
#skillpick, #travel { width: min(320px, 92vw); left: 50%; right: auto; transform: translateX(-50%); top: 60px; max-height: calc(100vh - 80px); overflow: auto; }
.list { display: flex; flex-direction: column; gap: 4px; }
.list .row { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 9px 12px; font-size: 14px; font-weight: 600; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.list .row small { color: var(--muted); font-weight: 400; font-size: 12px; }
.list .row.off { opacity: .4; }
.list .muted { color: var(--muted); font-size: 13px; }
/* shop + bag side by side */
body.shopping #shop { left: 8px; right: auto; transform: none; top: 8px; max-height: calc(100vh - 16px); overflow: auto; }
/* (bag + character window: see "character window, bright storybook" at the end) */
/* bag open: hide the play HUD behind it (toast stays) */
body.bag-open:not(.shopping) #hud > :not(#toast) { visibility: hidden; }

/* login scene */
#scr-login {
  --login-gold: #e3b873;
  --login-glass: rgba(18, 14, 27, .87);
  --login-safe-top: calc(16px + env(safe-area-inset-top, 0px));
  --login-safe-right: calc(16px + env(safe-area-inset-right, 0px));
  --login-safe-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  --login-safe-left: calc(16px + env(safe-area-inset-left, 0px));
  display: grid;
  place-items: center;
  grid-template-columns: minmax(0, 1fr);
  justify-content: normal;
  height: 100vh;
  height: 100dvh;
  gap: 0;
  padding: var(--login-safe-top) var(--login-safe-right) var(--login-safe-bottom) var(--login-safe-left);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #17162f 0%, #46344f 37%, #be716c 65%, #e3a078 77%, #362d49 100%);
  color-scheme: dark;
}
#scr-login #login-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  image-rendering: pixelated;
  z-index: -1;
}
#scr-login .login-layout {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
#scr-login .login-brand {
  width: 100%;
  flex-shrink: 0;
  text-align: center;
  pointer-events: none;
}
#scr-login #game-title {
  margin: 0;
  color: var(--login-gold);
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(38px, 4.8vw, 66px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: .05em;
  -webkit-text-stroke: .45px rgba(29, 19, 40, .92);
  text-shadow: 0 2px 0 #241629, 0 0 4px #170f24, 0 5px 12px rgba(10, 8, 22, .85);
}
#scr-login #game-title span { color: inherit; }
#scr-login .login-rule {
  position: relative;
  display: block;
  width: 180px;
  height: 1px;
  margin: 7px auto 11px;
  background: linear-gradient(90deg, transparent, var(--login-gold) 22%, var(--login-gold) 78%, transparent);
}
#scr-login .login-rule::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  top: -2px;
  left: calc(50% - 2px);
  transform: rotate(45deg);
  background: var(--login-gold);
  box-shadow: 0 0 0 3px rgba(34, 25, 43, .7);
}
#scr-login #game-tagline {
  margin: 0;
  color: #f2dfbe;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: normal;
  text-shadow: -1px 0 #20132d, 1px 0 #20132d, 0 -1px #20132d, 0 1px #20132d, 0 2px 5px #140b24;
}
#scr-login #login-form {
  position: relative;
  width: min(390px, 100%);
  flex-shrink: 0;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(227, 184, 115, .72);
  border-radius: 4px;
  background: var(--login-glass);
  box-shadow: 0 12px 42px rgba(10, 7, 22, .35);
}
#scr-login #login-form::before,
#scr-login #login-form::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
  border-color: var(--login-gold);
  border-style: solid;
}
#scr-login #login-form::before { top: 4px; left: 4px; border-width: 1px 0 0 1px; }
#scr-login #login-form::after { right: 4px; bottom: 4px; border-width: 0 1px 1px 0; }
#scr-login #login-tabs { gap: 0; border-bottom: 1px solid rgba(227, 184, 115, .22); }
#scr-login #login-tabs button {
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #b9adbf;
  font: 600 13px/1.5 "Noto Sans Thai", system-ui, sans-serif;
}
#scr-login #login-tabs button.on { border-bottom-color: var(--login-gold); color: #f4ddaf; background: rgba(227, 184, 115, .055); }
#scr-login #login-tabs button:hover:not(.on) { color: #f1e6d6; background: rgba(227, 184, 115, .035); }
#scr-login #login-form label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  color: #efe5d7;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  flex-shrink: 0;
}
#scr-login #login-form input,
#scr-login #login-form select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 8px 11px;
  border: 1px solid rgba(195, 183, 197, .36);
  border-radius: 4px;
  background: rgba(11, 12, 21, .7);
  color: #f1e6d6;
  font: 400 16px/1.5 "Noto Sans Thai", system-ui, sans-serif;
  caret-color: var(--login-gold);
  user-select: text;
  -webkit-user-select: text;
}
#scr-login #login-form input:focus-visible,
#scr-login #login-form select:focus-visible,
#scr-login #login-form button:focus-visible {
  outline: 2px solid var(--login-gold);
  outline-offset: 3px;
  border-color: var(--login-gold);
}
#scr-login #server-list option { background: #181321; color: #f1e6d6; }
#scr-login #signup-hint { margin: 0; color: #c4b9c4; font-size: 11px; line-height: 17px; }
#scr-login #btn-login,
#scr-login #btn-guest {
  flex-shrink: 0;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid rgba(227, 184, 115, .78);
  border-radius: 3px;
  font: 600 15px/1.5 "Noto Sans Thai", system-ui, sans-serif;
  transition: background-color .15s, box-shadow .15s;
}
#scr-login #btn-login { min-height: 46px; background: linear-gradient(180deg, var(--crimson), #861e2b); color: #fff2df; }
#scr-login #btn-login:hover:not(:disabled) { background: linear-gradient(180deg, var(--crimson-hi), #a42536); box-shadow: 0 0 14px rgba(179, 38, 46, .2); }
#scr-login #btn-login:active:not(:disabled) { background: #871e2c; }
#scr-login #btn-guest { background: rgba(227, 184, 115, .08); color: #ecd2a6; border-color: rgba(227, 184, 115, .42); }
#scr-login #btn-guest:hover:not(:disabled) { background: rgba(227, 184, 115, .16); border-color: var(--login-gold); }
#scr-login #btn-login:disabled,
#scr-login #btn-guest:disabled { opacity: .55; }
#scr-login #login-status {
  flex-shrink: 0;
  min-height: 34px;
  margin: 0;
  color: var(--login-gold);
  font-size: 12px;
  line-height: 17px;
  text-align: center;
  overflow-wrap: anywhere;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  #scr-login #game-title {
    background: linear-gradient(110deg, #e3b873 0%, #e3b873 39%, #fff2c8 47%, #e3b873 55%, #e3b873 100%) 140% 0 / 250% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 2px 0 #241629) drop-shadow(0 0 3px #170f24) drop-shadow(0 4px 8px rgba(10, 8, 22, .85));
    animation: login-gold-sheen 12s ease-in-out infinite;
  }
}
@keyframes login-gold-sheen {
  0%, 78% { background-position: 140% 0; }
  93%, 100% { background-position: -40% 0; }
}
@media (orientation: portrait) {
  #scr-login .login-layout { gap: 14px; }
  #scr-login #login-form { padding: 20px; gap: 10px; }
  #scr-login #game-tagline { font-size: 14px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  #scr-login .login-layout { width: min(640px, 100%); gap: 8px; }
  #scr-login #game-title { font-size: 30px; line-height: 1.1; letter-spacing: .04em; }
  #scr-login .login-rule { display: none; }
  #scr-login #game-tagline { margin-top: 3px; font-size: 12px; line-height: 16px; }
  #scr-login #login-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; padding: 12px; gap: 6px 14px; }
  #scr-login #login-tabs { grid-column: 1 / -1; grid-row: 1; }
  #scr-login #login-tabs button { min-height: 30px; padding: 4px 10px; font-size: 12px; line-height: 20px; }
  #scr-login #login-form label { grid-template-columns: 82px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 11px; line-height: 16px; }
  #scr-login .login-server { grid-column: 1; grid-row: 2; }
  #scr-login .login-account { grid-column: 2; grid-row: 2; }
  #scr-login .login-password { grid-column: 1; grid-row: 3; }
  #scr-login #pw2-row { grid-column: 2; grid-row: 3; }
  #scr-login #login-form input,
  #scr-login #login-form select { height: 36px; padding: 5px 9px; }
  #scr-login #signup-hint { grid-column: 1 / -1; grid-row: 4; font-size: 11px; line-height: 16px; text-align: center; }
  #scr-login #btn-login { grid-column: 1; grid-row: 5; }
  #scr-login #btn-guest { grid-column: 2; grid-row: 5; }
  #scr-login #btn-login,
  #scr-login #btn-guest { min-height: 40px; padding: 7px 12px; font-size: 13px; }
  #scr-login #login-status { grid-column: 1 / -1; grid-row: 6; min-height: 30px; font-size: 11px; line-height: 15px; }
  #scr-login #login-form:has(#login-tabs [data-mode="login"].on) .login-password { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  #scr-login #game-title { animation: none; background-position: 140% 0; }
  #scr-login #login-form button { transition: none; }
}

/* char screens */
#scr-chars {
  --char-gold: #e3b873;
  --char-glass: rgba(18, 14, 27, .87);
  --char-line: rgba(227, 184, 115, .6);
  --char-top: calc(16px + env(safe-area-inset-top, 0px));
  --char-right: calc(16px + env(safe-area-inset-right, 0px));
  --char-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  --char-left: calc(16px + env(safe-area-inset-left, 0px));
  display: block;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background: #101226;
  color: #f1e6d6;
  color-scheme: dark;
}
#scr-chars .char-view {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 60px minmax(0, 1fr) auto;
  gap: 18px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: var(--char-top) var(--char-right) var(--char-bottom) var(--char-left);
  background-color: #101226;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: auto;
}
#scr-chars #char-select-screen { background-image: url('../assets/ui/chars/select_wide.webp'); }
#scr-chars #create-form { background-image: url('../assets/ui/chars/create_wide.webp'); }
#scr-chars .char-screen-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
}
#scr-chars .char-screen-header h2 {
  margin: 0;
  color: var(--char-gold);
  font: 600 clamp(20px, 2.8vw, 42px)/1.2 "Noto Sans Thai", system-ui, sans-serif;
  text-align: center;
  text-shadow: 0 2px 3px #120b23;
}
#scr-chars .char-brand {
  justify-self: end;
  color: var(--char-gold);
  font: 600 clamp(18px, 2.2vw, 32px)/1.2 Cinzel, Georgia, serif;
  letter-spacing: .055em;
  text-shadow: 0 2px 3px #120b23;
}
#scr-chars button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 3px;
  font: 600 14px/1.4 "Noto Sans Thai", system-ui, sans-serif;
  touch-action: manipulation;
}
#scr-chars button:focus-visible,
#scr-chars input:focus-visible {
  outline: 2px solid var(--char-gold);
  outline-offset: 3px;
}
#scr-chars .char-primary {
  border: 1px solid var(--char-gold);
  background: linear-gradient(180deg, #b3262e, #861d2a);
  color: #fff0da;
  box-shadow: inset 0 1px rgba(255, 230, 188, .12);
}
#scr-chars .char-primary:hover:not(:disabled) { background: #c8323b; }
#scr-chars .char-secondary {
  border: 1px solid var(--char-line);
  background: rgba(20, 15, 31, .88);
  color: #ecd4ad;
}
#scr-chars .char-secondary:hover:not(:disabled) { background: rgba(57, 39, 57, .94); border-color: var(--char-gold); }
#scr-chars .char-back { justify-self: start; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; }
#scr-chars .char-back svg,
#scr-chars .char-turn-controls svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#scr-chars .char-glass {
  border: 1px solid var(--char-line);
  border-radius: 3px;
  background: var(--char-glass);
  box-shadow: 0 8px 24px rgba(5, 5, 14, .3);
}
#scr-chars .char-stage { position: relative; min-width: 0; min-height: 0; }
#scr-chars .char-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; pointer-events: none; }
#scr-chars .status { margin: 0; min-height: 18px; color: #edce93; font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
#scr-chars #create-form { z-index: 2; width: auto; border: 0; border-radius: 0; box-shadow: none; }
#scr-chars .char-create-body {
  display: grid;
  grid-template-columns: clamp(150px, 22vw, 360px) minmax(0, 1fr) clamp(244px, 22vw, 360px);
  gap: 24px;
  min-width: 0;
  min-height: 0;
}
#scr-chars .char-class-rail { min-width: 0; min-height: 0; padding: 10px; }
#scr-chars #class-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(227, 184, 115, .6) transparent;
}
#scr-chars .char-class,
#scr-chars #class-pick .class-card {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-height: 74px;
  padding: 12px 16px;
  border: 1px solid rgba(227, 184, 115, .33);
  border-radius: 3px;
  background: rgba(12, 12, 24, .36);
  color: #eee0c5;
  text-align: left;
}
#scr-chars .char-class.is-selected,
#scr-chars #class-pick .class-card.sel { border-color: var(--char-gold); background: rgba(227, 184, 115, .095); box-shadow: inset 0 0 0 1px rgba(227, 184, 115, .22); }
#scr-chars .char-class:hover:not(.is-selected) { background: rgba(227, 184, 115, .05); border-color: rgba(227, 184, 115, .65); }
#scr-chars .char-class-name { display: block; color: #edd2a3; font: 600 clamp(15px, 1.3vw, 23px)/1.3 Cinzel, Georgia, serif; }
#scr-chars .char-class-th { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; line-height: 1.4; }
#scr-chars .char-class svg { position: absolute; top: 50%; left: 12px; width: 32px; height: 32px; transform: translateY(-50%); color: var(--char-gold); }
#scr-chars .char-class:has(svg) { padding-left: 56px; }
#scr-chars .char-turn-controls { position: absolute; bottom: 8px; left: 50%; display: flex; gap: 44px; transform: translateX(-50%); }
#scr-chars .char-turn-controls button { width: 48px; height: 44px; padding: 10px; }
#scr-chars .char-class-details { display: flex; flex-direction: column; justify-content: center; gap: 16px; min-width: 0; min-height: 0; padding: 20px; }
#scr-chars #class-title { margin: 0; color: var(--char-gold); text-align: center; font: 600 clamp(22px, 2vw, 34px)/1.2 Cinzel, Georgia, serif; }
#scr-chars .char-title-en { display: block; }
#scr-chars .char-title-th { display: block; margin-top: 5px; font: 600 16px/1.5 "Noto Sans Thai", system-ui, sans-serif; }
#scr-chars #class-stats { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; height: 200px; flex: 0 0 auto; color: #eed6a3; }
#scr-chars #class-stats svg { display: block; width: 100%; height: calc(100% - 38px); min-height: 0; overflow: visible; }
#scr-chars #class-stats text { font-family: "Noto Sans Thai", system-ui, sans-serif; }
#scr-chars .char-stat-values { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; color: #d9c9b0; font-size: 11px; line-height: 16px; text-align: center; }
#scr-chars .char-stat-values b,
#scr-chars .char-stat-values strong { color: #f3d79d; font-size: 14px; }
#scr-chars #class-description { margin: 0; color: #dfd3c6; font-size: 14px; line-height: 1.6; }
#scr-chars .char-hair-section { padding-top: 12px; border-top: 1px solid rgba(227, 184, 115, .28); }
#scr-chars .char-option-label { margin-bottom: 8px; color: #e9d8bb; font-size: 14px; font-weight: 600; line-height: 20px; }
#scr-chars #hair-pick { display: grid; grid-template-columns: repeat(3, 44px); justify-content: center; gap: 12px; margin: 0; }
#scr-chars .char-hair { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 4px; border: 1px solid transparent; border-radius: 50%; background: transparent; }
#scr-chars .char-hair-swatch { display: block; width: 32px; height: 32px; border: 1px solid rgba(227, 184, 115, .65); border-radius: 50%; box-shadow: inset 0 1px 4px rgba(255, 255, 255, .15), inset 0 -3px 7px rgba(0, 0, 0, .35); }
#scr-chars .char-hair.is-selected { border-color: var(--char-gold); background: rgba(227, 184, 115, .1); box-shadow: 0 0 0 1px rgba(227, 184, 115, .22); }
#scr-chars .char-hair:hover { background: rgba(227, 184, 115, .08); }
#scr-chars .char-create-footer { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(200px, 25%); align-items: center; gap: 8px 20px; padding: 14px 20px 10px; }
#scr-chars .char-create-footer label { display: flex; flex-direction: column; gap: 3px; color: #efdfbf; font-size: 14px; font-weight: 600; line-height: 20px; }
#scr-chars .char-name-hint { color: #bdafbe; font-size: 11px; font-weight: 400; line-height: 16px; }
#scr-chars #new-name,
#scr-chars #char-delete-name { width: 100%; min-width: 0; height: 48px; padding: 10px 12px; border: 1px solid rgba(227, 184, 115, .45); border-radius: 3px; background: rgba(11, 11, 23, .74); color: #f1e6d6; font: 400 16px/1.5 "Noto Sans Thai", system-ui, sans-serif; user-select: text; -webkit-user-select: text; }
#scr-chars #btn-create { min-height: 48px; font-size: 16px; }
#scr-chars #create-status { grid-column: 2 / -1; }
#scr-chars .char-select .char-brand { justify-self: start; }
#scr-chars #btn-logout { justify-self: end; padding: 8px 18px; }
#scr-chars #char-list { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(8px, 2vw, 32px); min-height: 0; }
#scr-chars .char-slot { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-width: 44px; min-height: 44px; padding: 0 6px 8px; border: 0; background: transparent; color: #f0dfbc; text-shadow: 0 1px 3px #0b0716; }
#scr-chars .char-slot:hover { background: transparent; }
#scr-chars .char-slot-name { display: block; max-width: 100%; min-width: 90px; padding: 7px 12px; border: 1px solid rgba(227, 184, 115, .44); border-radius: 3px; background: rgba(16, 13, 27, .88); font-size: 17px; line-height: 22px; overflow-wrap: anywhere; }
#scr-chars .char-slot.is-selected .char-slot-name { border-color: var(--char-gold); color: #ffe5b3; }
#scr-chars .char-slot-meta { font-size: 12px; font-weight: 400; line-height: 18px; }
#scr-chars .char-slot-empty { display: block; max-width: 100%; padding: 9px 12px; border: 1px solid rgba(227, 184, 115, .7); border-radius: 3px; background: rgba(16, 13, 27, .88); font-size: 14px; line-height: 20px; }
#scr-chars .char-select-footer { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#scr-chars .char-select-summary { display: grid; grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); gap: 24px; align-items: center; }
#scr-chars #char-selected-info { min-height: 106px; min-width: 0; padding: 14px 20px; }
#scr-chars #char-selected-name { margin: 0; color: #f0d19a; font-size: 25px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
#scr-chars #char-selected-class { margin: 3px 0 5px; color: #ecdbbf; font-size: 14px; line-height: 20px; }
#scr-chars .char-selected-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #d3c6c5; font-size: 13px; line-height: 18px; }
#scr-chars .char-select-actions { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(120px, 1fr) minmax(160px, 1.25fr); align-items: center; gap: 14px; width: min(700px, 100%); justify-self: end; }
#scr-chars .char-select-actions button { min-height: 56px; padding: 10px 14px; font-size: 16px; }
#scr-chars #btn-enter { font-size: 20px; }
#scr-chars .char-guest-note { margin: 0; padding: 10px 14px; border: 1px solid rgba(227, 184, 115, .45); border-radius: 3px; background: rgba(18, 14, 27, .9); color: #d9c29f; font-size: 12px; line-height: 18px; text-align: center; overflow-wrap: anywhere; }
#scr-chars #google-link { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px; max-width: 100%; }
#scr-chars #google-link:empty { display: none; }
#scr-chars #google-link > * { max-width: 100%; }
#scr-chars .char-delete-overlay { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: var(--char-top) var(--char-right) var(--char-bottom) var(--char-left); background: rgba(7, 6, 15, .78); }
#scr-chars .char-delete-card { display: flex; flex-direction: column; gap: 10px; width: min(420px, 100%); padding: 22px; }
#scr-chars #char-delete-title { margin: 0; color: var(--char-gold); font-size: 22px; line-height: 1.4; }
#scr-chars #char-delete-label { margin: 0; color: #e2d3c4; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
#scr-chars .char-delete-card label { font-size: 12px; line-height: 18px; color: #ccbfae; }
#scr-chars .char-delete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#scr-chars:has(#create-form:not(.hidden)) #char-select-screen { visibility: hidden; }
@media (orientation: landscape) and (max-height: 600px) {
  #scr-chars .char-view { grid-template-rows: 44px minmax(0, 1fr) auto; gap: 8px; }
  #scr-chars .char-screen-header { gap: 8px; }
  #scr-chars .char-screen-header h2 { font-size: 20px; }
  #scr-chars .char-brand { font-size: 18px; }
  #scr-chars .char-back { padding: 6px 10px; font-size: 12px; }
  #scr-chars .char-create-body { grid-template-columns: 150px minmax(0, 1fr) 244px; gap: 12px; }
  #scr-chars .char-class-rail { padding: 4px; }
  #scr-chars #class-pick { gap: 4px; }
  #scr-chars .char-class,
  #scr-chars #class-pick .class-card { min-height: 44px; padding: 4px 7px; }
  #scr-chars .char-class-name { font-size: 13px; line-height: 17px; }
  #scr-chars .char-class-th { margin-top: 0; font-size: 10px; line-height: 14px; }
  #scr-chars .char-class svg { left: 5px; width: 24px; height: 24px; }
  #scr-chars .char-class:has(svg) { padding-left: 34px; }
  #scr-chars .char-class-details { gap: 3px; padding: 4px 2px; justify-content: space-between; }
  #scr-chars #class-title { display: none; }
  #scr-chars #class-stats { display: grid; grid-template-columns: 64px minmax(0, 1fr); height: 60px; gap: 8px; }
  #scr-chars #class-stats svg { width: 60px; height: 60px; }
  #scr-chars .char-stat-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; font-size: 10px; line-height: 16px; }
  #scr-chars .char-stat-values b,
  #scr-chars .char-stat-values strong { font-size: 12px; }
  #scr-chars #class-description { font-size: 10px; line-height: 13px; }
  #scr-chars .char-hair-section { padding-top: 2px; border: 0; }
  #scr-chars .char-option-label { margin-bottom: 0; font-size: 11px; line-height: 14px; }
  #scr-chars #hair-pick { grid-template-columns: repeat(5, 44px); gap: 0 4px; }
  #scr-chars .char-hair { padding: 7px; }
  #scr-chars .char-hair-swatch { width: 28px; height: 28px; }
  #scr-chars .char-turn-controls { bottom: 0; gap: 20px; }
  #scr-chars .char-turn-controls button { width: 44px; }
  #scr-chars .char-create-footer { grid-template-columns: 132px minmax(0, 1fr) 154px; gap: 0 10px; padding: 0 10px; }
  #scr-chars .char-create-footer label { font-size: 11px; line-height: 16px; gap: 1px; }
  #scr-chars .char-name-hint { font-size: 9px; line-height: 12px; }
  #scr-chars #new-name,
  #scr-chars #btn-create { height: 44px; min-height: 44px; padding: 7px 10px; font-size: 13px; }
  #scr-chars #new-name { font-size: 16px; }
  #scr-chars #create-status { grid-column: 1 / -1; min-height: 18px; font-size: 11px; line-height: 18px; }
  #scr-chars #btn-logout { padding: 8px 12px; font-size: 12px; }
  #scr-chars #char-list { gap: 8px; }
  #scr-chars .char-slot { padding: 0 0 2px; gap: 1px; }
  #scr-chars .char-slot-name { min-width: 70px; padding: 3px 6px; font-size: 12px; line-height: 16px; }
  #scr-chars .char-slot-meta { font-size: 10px; line-height: 14px; }
  #scr-chars .char-slot-empty { padding: 6px 7px; font-size: 11px; line-height: 16px; }
  #scr-chars .char-select-footer { gap: 4px; }
  #scr-chars .char-select-summary { grid-template-columns: minmax(170px, 34%) minmax(0, 1fr); gap: 12px; }
  #scr-chars #char-selected-info { min-height: 66px; padding: 5px 10px; }
  #scr-chars #char-selected-name { font-size: 16px; line-height: 20px; }
  #scr-chars #char-selected-class { margin: 0; font-size: 10px; line-height: 15px; }
  #scr-chars .char-selected-meta { gap: 4px 10px; font-size: 10px; line-height: 14px; }
  #scr-chars .char-select-actions { grid-template-columns: 1fr 1.15fr 1.2fr; gap: 8px; }
  #scr-chars .char-select-actions button { min-height: 44px; padding: 7px; font-size: 12px; }
  #scr-chars #btn-enter { font-size: 14px; }
  #scr-chars .char-guest-note { padding: 3px 8px; font-size: 10px; line-height: 14px; }
  #scr-chars #chars-status { min-height: 16px; font-size: 11px; line-height: 16px; }
  #scr-chars:has(#google-link:not(:empty)) #chars-status:empty { display: none; }
  #scr-chars .char-delete-card { gap: 6px; padding: 14px; }
  #scr-chars #char-delete-title { font-size: 19px; }
}
@media (orientation: portrait) {
  #scr-chars .char-view { grid-template-rows: 44px minmax(0, 1fr) auto; gap: 10px; }
  #scr-chars #char-select-screen { background-image: url('../assets/ui/chars/select_tall.webp'); }
  #scr-chars #create-form { background-image: url('../assets/ui/chars/create_tall.webp'); }
  #scr-chars .char-screen-header { grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
  #scr-chars .char-screen-header h2 { font-size: 22px; text-align: right; }
  #scr-chars .char-brand { display: none; }
  #scr-chars .char-back { padding: 8px 10px; font-size: 12px; }
  #scr-chars .char-create-body { grid-template-columns: 142px minmax(0, 1fr); grid-template-rows: minmax(180px, 34%) minmax(0, 1fr); gap: 10px; }
  #scr-chars #char-create-stage { grid-column: 1 / -1; grid-row: 1; }
  #scr-chars .char-class-rail { grid-column: 1; grid-row: 2; padding: 4px; }
  #scr-chars #class-pick { gap: 5px; }
  #scr-chars .char-class,
  #scr-chars #class-pick .class-card { min-height: 48px; padding: 5px 8px; }
  #scr-chars .char-class-name { font-size: 13px; line-height: 18px; }
  #scr-chars .char-class-th { font-size: 10px; line-height: 15px; margin-top: 1px; }
  #scr-chars .char-class svg { width: 24px; height: 24px; left: 5px; }
  #scr-chars .char-class:has(svg) { padding-left: 34px; }
  #scr-chars .char-class-details { grid-column: 2; grid-row: 2; padding: 8px; gap: 8px; justify-content: flex-start; }
  #scr-chars #class-title { display: none; }
  #scr-chars #class-stats { height: 112px; }
  #scr-chars .char-stat-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 5px; font-size: 10px; line-height: 16px; }
  #scr-chars .char-stat-values b,
  #scr-chars .char-stat-values strong { font-size: 12px; }
  #scr-chars #class-description { font-size: 11px; line-height: 16px; }
  #scr-chars .char-hair-section { padding-top: 5px; margin-top: auto; }
  #scr-chars .char-option-label { font-size: 12px; margin-bottom: 4px; line-height: 18px; }
  #scr-chars #hair-pick { grid-template-columns: repeat(3, 44px); gap: 2px; }
  #scr-chars .char-create-footer { grid-template-columns: minmax(0, 1fr) 142px; gap: 5px 8px; padding: 8px; }
  #scr-chars .char-create-footer label { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; font-size: 12px; line-height: 18px; }
  #scr-chars .char-name-hint { font-size: 10px; line-height: 14px; }
  #scr-chars #new-name,
  #scr-chars #btn-create { min-height: 44px; height: 44px; padding: 8px; font-size: 14px; }
  #scr-chars #new-name { font-size: 16px; }
  #scr-chars #create-status { grid-column: 1 / -1; min-height: 18px; font-size: 11px; line-height: 18px; }
  #scr-chars .char-select .char-screen-header { grid-template-columns: minmax(0, 1fr) auto; }
  #scr-chars .char-select .char-screen-header h2 { grid-column: 1; grid-row: 1; text-align: left; }
  #scr-chars #btn-logout { grid-column: 2; grid-row: 1; font-size: 12px; padding: 8px 10px; }
  #scr-chars #char-list { gap: 4px; }
  #scr-chars .char-slot { padding: 0; gap: 2px; }
  #scr-chars .char-slot-name,
  #scr-chars .char-slot-empty { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 0; width: 100%; min-height: 44px; }
  #scr-chars .char-slot-name { padding: 5px 2px; font-size: 11px; line-height: 16px; }
  #scr-chars .char-slot-meta { flex: 0 0 auto; min-height: 26px; font-size: 9px; line-height: 13px; text-align: center; }
  #scr-chars .char-slot-empty { margin-bottom: 28px; padding: 6px 3px; font-size: 10px; line-height: 15px; }
  #scr-chars .char-select-summary { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #scr-chars #char-selected-info { min-height: 98px; padding: 12px 16px; }
  #scr-chars #char-selected-name { font-size: 22px; line-height: 28px; }
  #scr-chars #char-selected-class { font-size: 12px; line-height: 18px; }
  #scr-chars .char-selected-meta { font-size: 12px; line-height: 18px; }
  #scr-chars .char-select-actions { grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  #scr-chars .char-select-actions button { min-height: 44px; font-size: 12px; padding: 8px; }
  #scr-chars #btn-enter { grid-column: 1 / -1; grid-row: 1; font-size: 16px; }
  #scr-chars .char-select-footer { gap: 6px; }
  #scr-chars .char-guest-note { padding: 8px 10px; font-size: 10px; line-height: 15px; }
  #scr-chars #chars-status { min-height: 18px; font-size: 11px; line-height: 18px; }
}

/* login: high-res still backdrop (assets/ui/login/bg_wide.webp / bg_tall.webp), replaces the pixel layers when present */
#scr-login.has-bg { background: #17162f url(../assets/ui/login/bg_wide.webp) center / cover no-repeat; }
#scr-login.has-bg #login-scene { display: none; }
@media (orientation: portrait) { #scr-login.has-bg { background-image: url(../assets/ui/login/bg_tall.webp); } }

/* Google Sign-In button (rendered by Google Identity Services) */
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.google-btn.hidden { display: none; }

/* social sign-in only (Google + Guest): one narrow column on every screen */
body.social-login #scr-login #login-form { display: flex; flex-direction: column; width: min(380px, 100%); padding: 20px; gap: 12px; }
body.social-login #scr-login .login-layout { width: min(420px, 100%); }
body.social-login #scr-login #google-btn,
body.social-login #scr-login #btn-guest { width: 100%; min-height: 44px; }
body.social-login #scr-login #login-status { min-height: 1.2em; text-align: center; }
@media (orientation: landscape) and (max-height: 600px) {
  body.social-login #scr-login #login-form { padding: 14px 16px; gap: 10px; }
}

/* ===== new-version notice (js/net/update.js): a small bar at the top centre until the player presses OK ===== */
#patch-note { position: fixed; z-index: 60; top: calc(6px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; max-width: min(460px, calc(100vw - 24px)); padding: 3px 3px 3px 4px; box-sizing: border-box;
  background: rgba(18,12,16,.9); border: 1px solid rgba(216,168,90,.75); border-radius: 16px; box-shadow: 0 3px 12px rgba(0,0,0,.5);
  font: 12px/1.3 'Noto Sans Thai', system-ui; color: #e9dcc6; pointer-events: auto; }
#patch-note button { font-family: inherit; cursor: pointer; }
#patch-note .pn-title { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 6px; border: 0; background: none; color: inherit; font-size: 12px; white-space: nowrap; }
#patch-note .pn-title b { color: #f2c14e; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
#patch-note .pn-title i { font-style: normal; color: #b7a283; font-size: 10px; }
#patch-note .pn-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #f2c14e; box-shadow: 0 0 6px #f2c14e; }
#patch-note .pn-ok { flex: none; height: 26px; padding: 0 14px; border: 1px solid #d8a85a; border-radius: 13px; background: linear-gradient(180deg, #a3242b, #6d1117); color: #fff3dc; font: 700 12px 'Noto Sans Thai', system-ui; }
#patch-note .pn-ok:hover, #patch-note .pn-title:hover { filter: brightness(1.2); }
#patch-note .pn-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 6px 10px 6px 24px; background: rgba(18,12,16,.94);
  border: 1px solid rgba(216,168,90,.5); border-radius: 8px; font-size: 12px; max-height: 40vh; overflow: auto; }
#patch-note .pn-list[hidden] { display: none; }
#patch-note .pn-list li { margin: 2px 0; }
body.patch-pending #h-target { top: calc(var(--patch-h, 0px) + 10px + env(safe-area-inset-top)); }

/* ===== waypoint list (js/ui/windows.js showWaypoints) ===== */
#travel .wp-hint { margin: 2px 10px 6px; font-size: 11px; color: var(--muted); }
#travel .wp-group { margin: 8px 10px 2px; font-size: 11px; color: var(--gold); letter-spacing: .04em; }
#travel .row.wp.here { border-color: rgba(79,210,200,.6); }
#travel .row.wp.locked b { color: #8d8175; }

/* ===== item tooltip (Path of Exile layout, bright storybook colours: name by rarity, base numbers, requirements, mods with tier) ===== */
.itip { --rc: #5a3a22; --rb: #e2cfa6; --rh: #f6ead0; min-width: 220px; max-width: 320px; text-align: center; font: 12.5px/1.45 'Noto Sans Thai', system-ui, sans-serif; color: #5a4632;
  background: linear-gradient(#fffdf7, #f8efdb); border: 2px solid var(--rb); border-radius: 14px; box-shadow: 0 8px 24px rgba(60,35,10,.35); overflow: hidden; }
.itip.r1 { --rc: #3d57d8; --rb: #aab6ff; --rh: #e8ecff; }
.itip.r2 { --rc: #a86a00; --rb: #f0c040; --rh: #fff1c2; }
.itip.r3 { --rc: #c4561a; --rb: #f0a060; --rh: #ffe4cc; }
.itip .it-head { display: flex; flex-direction: column; padding: 7px 14px 6px; color: var(--rc); background: linear-gradient(var(--rh), rgba(255,255,255,.4)); border-bottom: 2px solid var(--rb); }
.itip .it-head b { font: 700 15.5px/1.25 Kanit, 'Noto Sans Thai', sans-serif; text-shadow: 0 1px 0 #fff; }
.itip .it-body { padding: 6px 12px 8px; }
.itip hr { border: 0; height: 1px; margin: 6px 12%; background: linear-gradient(90deg, transparent, var(--rb), transparent); }
.itip .it-kind { color: #9a8466; font-size: 11.5px; }
.itip .it-p em { font-style: normal; color: #4a3222; font-weight: 700; }
.itip .it-p em.up { color: #3d57d8; }
.itip .it-req { color: #9a8466; font-size: 11.5px; }
.itip .it-req .bad { color: #d23a3a; font-weight: 700; }
.itip .it-m { color: #3d57d8; font-weight: 600; }
.itip .it-m i { font-style: normal; font-size: 10px; color: #b0a08a; margin-left: 6px; font-weight: 400; }
.itip .it-price { color: #a86a00; font-size: 11.5px; font-weight: 600; }
#tip.item { max-width: none; padding: 0; background: none; border: 0; border-radius: 0; }
/* loot lines in chat by rarity */
#chat-log .rar1 { color: #8f9cff; }
#chat-log .rar2 { color: #ffe36e; }
/* target frame: monster element */
#tg-el { display: block; margin-top: -2px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }

/* ===== character window: design C "equipment ring" (user 2026-09-30) - no frame; the hero in the middle with the 12 equipment
   slots in a ring around him, a floating status card on the left, the bag card on the right, level + EXP under the ring ===== */
:root { --sk-ink: #213a58; --sk-muted: #7b8ea6; --sk-line: #d6e6f4; --sk-card: #ffffff; --sk-sky: #4aa6e8; --sk-deep: #1f6fb8; --sk-gold: #f0b429; --sk-teal: #3fcfc2;
  --slot: clamp(40px, 7.4vh, 58px); --cell: 54px;
  --th-head: linear-gradient(180deg, #62bff4, #3f97dc); --th-edge: #f0b429; --th-title-sh: #1d5f9a; --th-head-in: rgba(20,70,140,.25);
  --th-win: linear-gradient(180deg, #f7fbff, #eaf3fb); --th-ring: #b9d7f0; --th-shadow: rgba(12,40,80,.45);
  --th-stage: radial-gradient(ellipse 22% 9% at 18% 22%, rgba(255,255,255,.95), rgba(255,255,255,0) 70%), radial-gradient(ellipse 16% 7% at 26% 19%, rgba(255,255,255,.9), rgba(255,255,255,0) 70%), radial-gradient(ellipse 24% 10% at 80% 30%, rgba(255,255,255,.9), rgba(255,255,255,0) 70%), radial-gradient(ellipse 60% 20% at 50% 100%, #fff, rgba(255,255,255,0) 70%), linear-gradient(180deg, #8fd0fb 0%, #c3e7fd 45%, #eef8ff 80%, #fff 100%);
  --th-btn: linear-gradient(#5db8f2, #2f86d0); --th-btn-sh: #1f6fb8; --th-btn-hi: linear-gradient(#6ed0f8, #3a96dc);
  --th-slot: linear-gradient(160deg, #ffffff, #eef6fd); --th-slot-bd: #cfe2f3; --th-slot-sh: #b7d2ea; --th-side: #fff; --th-card: linear-gradient(90deg, #f5faff, #fff);
  --th-tabs: #e8f2fb; --th-soft: #f5faff; --th-gem: linear-gradient(135deg, #e6fffb, #6fe3d8 45%, #1fa5a0); }
.bagwin {
  position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; user-select: none; background: rgba(14,32,58,.28); }
.bagwin.hidden { display: none; }
.cb-h { margin: 0; display: flex; align-items: baseline; gap: 8px; font: 700 19px/1.2 Kanit, 'Noto Sans Thai', sans-serif; color: var(--sk-ink); }
.cb-h .bag-count { font: 400 12px 'Noto Sans Thai', sans-serif; color: var(--sk-muted); }
/* status */
.st-list { display: flex; flex-direction: column; gap: 6px; }
.st-row { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 34px; align-items: center; gap: 8px; padding: 6px 10px 6px 12px; border-radius: 12px;
  background: var(--th-card); border: 1px solid var(--sk-line); }
.st-row::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sk-sky); }
.st-ic { display: grid; place-items: center; width: 36px; height: 36px; filter: drop-shadow(0 2px 1px rgba(20,60,110,.2)); }
.st-ic svg { width: 100%; height: 100%; }
.st-l { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.st-l b { font: 600 17px/1.1 Kanit, sans-serif; color: var(--sk-ink); }
.st-l small { font-size: 11px; color: var(--sk-muted); }
.st-v { font: 600 20px/1 Kanit, sans-serif; color: var(--sk-ink); text-align: right; }
.st-v .gear { font: 600 12px Kanit, sans-serif; color: #3d57d8; margin-left: 3px; }
.st-plus { width: 32px; height: 32px; padding: 0; border-radius: 10px; font: 700 21px/1 Kanit, sans-serif; color: #fff; border: 0;
  background: var(--th-btn); box-shadow: 0 2px 0 var(--th-btn-sh); }
.st-plus:hover:not(:disabled) { background: var(--th-btn-hi); }
.st-plus:disabled { background: #dbe7f2; box-shadow: none; color: #fff; }
.st-sp { width: 32px; }
.st-points { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 14px;
  background: linear-gradient(90deg, #fff8e0, #fffdf3); border: 1px solid #f3dc97; font: 600 15px Kanit, 'Noto Sans Thai', sans-serif; color: #7a5a10; }
.st-points b { min-width: 52px; text-align: center; padding: 2px 12px; border-radius: 12px; background: #fff; border: 2px solid #f3dc97; font: 700 24px/1.1 Kanit, sans-serif; color: #c08a0c; }
.st-points.has b { background: var(--sk-gold); border-color: #fff; color: #fff; box-shadow: 0 0 12px rgba(255,190,40,.7); }
/* detail */
.dt-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dt-card { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px 5px; border-radius: 12px; background: var(--th-card); border: 1px solid var(--sk-line); }
.dt-card .st-ic { width: 28px; height: 28px; }
.dt-card small { font-size: 11px; color: var(--sk-muted); }
.dt-card b { font: 600 15px/1.1 Kanit, sans-serif; color: var(--sk-ink); white-space: nowrap; }
.dt-sub { margin: 6px 0 0; font: 600 15px Kanit, 'Noto Sans Thai', sans-serif; color: var(--sk-ink); }
.dt-sub small { font: 400 11px 'Noto Sans Thai', sans-serif; color: var(--sk-muted); }
.dt-resgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dt-res { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 10px; background: var(--th-soft); border: 1px solid var(--sk-line); border-left: 4px solid var(--c); font-size: 13px; }
.dt-res .st-ic { width: 20px; height: 20px; }
.dt-res b { font: 600 15px Kanit, sans-serif; } .dt-res b.max { color: #c08a0c; } .dt-res b.neg { color: #d23a3a; }
.dt-res small { font-size: 10px; color: var(--sk-muted); }
.dt-list { margin-top: 4px; }
.dt-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 2px; font-size: 12.5px; border-bottom: 1px solid #edf3f9; }
.dt-row span { color: var(--sk-muted); } .dt-row b { color: var(--sk-ink); font-weight: 600; text-align: right; } .dt-row.hl b { color: #d23a3a; }
/* bag */
.bag-tabs { display: flex; gap: 5px; }
.bag-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 4px; border-radius: 10px; font: 600 12px 'Noto Sans Thai', sans-serif;
  color: var(--sk-muted); background: var(--th-soft); border: 1px solid var(--sk-line); }
.bag-tabs button svg { width: 16px; height: 16px; }
.bag-tabs button.on { color: #fff; background: var(--th-btn); border-color: var(--th-btn-sh); }
.bag-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cell), 1fr)); gap: 6px; align-content: start; padding: 3px 2px;
  scrollbar-width: thin; scrollbar-color: #b9d3ea transparent; }
.bag-grid .cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 0; border-radius: 12px; cursor: pointer; color: var(--sk-ink);
  background: var(--th-slot); border: 2px solid var(--th-slot-bd); box-shadow: 0 2px 0 var(--th-slot-sh); }
.bag-grid .cell svg { width: 66%; height: 66%; }
.bag-grid .cell:not(.empty):hover { background: linear-gradient(160deg, #ffffff, #e0f0fd); }
.bag-grid .cell.empty { background: var(--th-soft); border: 2px dashed var(--sk-line); box-shadow: none; cursor: default; }
.bag-grid .cell.r1 { border-color: #8a9cff; background: linear-gradient(160deg, #fbfbff, #e6eaff); box-shadow: 0 2px 0 #7485e0, 0 0 8px rgba(120,140,255,.35); }
.bag-grid .cell.r2 { border-color: var(--sk-gold); background: linear-gradient(160deg, #fffdf2, #fdeebc); box-shadow: 0 2px 0 #d0960e, 0 0 10px rgba(255,196,50,.5); }
.bagwin i.cnt { position: absolute; right: 5px; bottom: 2px; font: 700 12px Kanit, sans-serif; font-style: normal; color: var(--sk-ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.bagwin i.lv { position: absolute; left: 5px; top: 2px; font: 700 11px Kanit, sans-serif; font-style: normal; color: #d07a0c; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.bag-detail { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px; border-radius: 12px; background: var(--th-soft); border: 1px solid var(--sk-line); }
.bag-detail .muted { margin: 0; font-size: 12px; color: var(--sk-muted); }
.bag-detail:has(.d-tip) { align-items: stretch; max-height: 48%; }
.bag-detail .d-tip { flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; }
.bag-detail .d-tip .itip { max-width: none; min-width: 0; box-shadow: none; }
/* PC: the full tooltip shows on hover, so the box keeps only the item name + buttons in one row */
body.pc .bag-detail:has(.d-tip) { max-height: none; align-items: center; }
body.pc .bag-detail .d-tip { overflow: hidden; }
body.pc .bag-detail .d-tip .itip { background: none; border: 0; padding: 0; }
body.pc .bag-detail .d-tip .it-body { display: none; }
body.pc .bag-detail .d-tip .it-head { padding: 0 2px 0 4px; background: none; border: 0; text-align: left; font-size: 14px; line-height: 1.25; }
body.pc .bag-detail .d-tip .it-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.pc .bag-detail .d-act { flex-direction: row; align-items: center; }
.d-act { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.d-act button { flex: 0 0 auto; padding: 8px 16px; border-radius: 11px; font: 600 14px Kanit, 'Noto Sans Thai', sans-serif; white-space: nowrap;
  color: #fff; background: var(--th-btn); border: 0; box-shadow: 0 3px 0 var(--th-btn-sh); }
.d-act button.ghost { color: #5f7896; background: #fff; border: 1px solid var(--sk-line); box-shadow: 0 3px 0 #d6e6f4; }
.bag-foot { display: flex; justify-content: space-between; align-items: center; }
.bag-zen { display: inline-flex; align-items: center; gap: 6px; padding: 3px 14px 3px 6px; border-radius: 20px; background: #fff8e0; border: 1px solid #f3dc97; }
.bag-zen svg { width: 22px; height: 22px; }
.bag-zen b { font: 700 16px Kanit, sans-serif; color: #a8700a; }
.bag-zen small { font-size: 11px; color: var(--sk-muted); }

.bagwin { --R: min(205px, 29vh); --slot: clamp(46px, 7.6vh, 60px); display: grid; grid-template-columns: minmax(250px, 310px) minmax(calc(var(--R) * 2 + var(--slot) + 20px), 1fr) minmax(290px, 370px);
  grid-template-rows: 56px minmax(0, 1fr) 64px; grid-template-areas: "chips chips chips" "left ring right" ". exp ."; gap: 14px 22px; padding: 18px 28px 20px; place-items: stretch;
  background: radial-gradient(circle at 50% 48%, rgba(255,255,255,.62), rgba(196,230,252,.45) 32%, rgba(24,58,98,.45) 78%); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.rg-chips { grid-area: chips; justify-self: center; align-self: center; display: flex; gap: 10px; }
.rg-chips button { display: flex; align-items: center; gap: 7px; padding: 9px 20px; border-radius: 26px; border: 0; font: 600 16px Kanit, Poppins, 'Noto Sans Thai', sans-serif;
  color: #36506e; background: rgba(255,255,255,.85); box-shadow: 0 4px 14px rgba(0,40,90,.2); }
.rg-chips button svg { width: 20px; height: 20px; color: #7f9cbc; }
.rg-chips button.on { color: var(--sk-deep); background: #fff; box-shadow: 0 0 0 3px #7fd0f8, 0 4px 14px rgba(0,40,90,.25); }
.rg-chips button.on svg { color: var(--sk-teal); }
.rg-chips .x { width: 42px; height: 42px; padding: 0; justify-content: center; font: 700 18px/1 Kanit, sans-serif; color: #36506e; margin-left: 6px; }
.rg-card { position: relative; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; border-radius: 22px; color: var(--sk-ink);
  background: rgba(255,255,255,.93); box-shadow: 0 14px 40px rgba(0,40,90,.3); overflow: hidden; }
.rg-left { grid-area: left; } .rg-right { grid-area: right; }
.rg-who { display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--sk-line); }
.bag-name { font: 700 20px/1.2 Kanit, Poppins, 'Noto Sans Thai', sans-serif; color: var(--sk-ink); }
.cb-cls { font-size: 13px; color: var(--sk-deep); }
.cb-pane { display: none; flex: 1; min-height: 0; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b9d3ea transparent; }
.cb-pane.on { display: flex; }
.cb-pane .cb-h { display: none; }
/* the ring */
.rg-ring { grid-area: ring; position: relative; align-self: center; justify-self: center; width: calc(var(--R) * 2 + var(--slot)); height: calc(var(--R) * 2 + var(--slot)); }
.rg-halo { position: absolute; inset: calc(var(--slot) / 2 - 2px); border-radius: 50%; border: 3px solid rgba(255,255,255,.9);
  box-shadow: 0 0 26px rgba(120,220,255,.85), inset 0 0 26px rgba(120,220,255,.6); }
.rg-halo::before { content: ''; position: absolute; inset: 26px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.75); animation: rg-spin 60s linear infinite; }
.rg-halo::after { content: ''; position: absolute; left: 26%; right: 26%; bottom: 20%; height: 9%; border-radius: 50%; background: radial-gradient(ellipse, rgba(20,60,110,.35), transparent 70%); }
@keyframes rg-spin { to { transform: rotate(360deg); } }
.bag-hero { position: absolute; left: 20%; right: 20%; top: 12%; bottom: 18%; }
.bag-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 10px 10px rgba(0,40,80,.3)); }
.wslot { position: absolute; left: 50%; top: 50%; width: var(--slot); height: var(--slot); margin: calc(var(--slot) / -2) 0 0 calc(var(--slot) / -2); padding: 0;
  transform: rotate(var(--a)) translateY(calc(var(--R) * -1)) rotate(calc(var(--a) * -1)); display: grid; place-items: center; border-radius: 50%; color: var(--sk-ink);
  background: radial-gradient(circle at 50% 35%, #fff, #eef6fd); border: 3px solid #bfe0f7; box-shadow: 0 6px 16px rgba(0,50,100,.25); transition: box-shadow .15s; }
.wslot .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #9fbcd8; opacity: .75; }
.wslot .ph svg { width: 50%; height: 50%; }
.wslot.filled .ph { display: none; }
.wslot .ic { display: contents; }
.wslot svg { width: 58%; height: 58%; }
.wslot:not(.filled) { background: rgba(255,255,255,.6); border-style: dashed; }
.wslot:hover { box-shadow: 0 0 0 3px rgba(127,208,248,.8), 0 6px 16px rgba(0,50,100,.25); }
.wslot.filled.r1 { border-color: #8a9cff; box-shadow: 0 0 12px rgba(120,140,255,.7), 0 6px 16px rgba(0,50,100,.2); }
.wslot.filled.r2 { border-color: var(--sk-gold); box-shadow: 0 0 16px rgba(255,196,50,.95), 0 6px 16px rgba(0,50,100,.2); }
.wslot.sel, .bag-grid .cell.sel { outline: 3px solid var(--sk-teal); outline-offset: 2px; }
.wslot i.lv { left: 50%; top: -6px; transform: translateX(-50%); padding: 0 5px; border-radius: 8px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
/* level + EXP under the ring */
.rg-exp { grid-area: exp; align-self: center; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.rg-exp .lv { font: 700 24px/1 Kanit, Poppins, sans-serif; color: #fff; text-shadow: 0 2px 6px rgba(0,40,90,.6); }
.rg-exp .exp { width: min(460px, 100%); height: 12px; border-radius: 8px; background: rgba(255,255,255,.55); border: 2px solid #fff; overflow: hidden; box-shadow: 0 2px 8px rgba(0,40,90,.25); }
.rg-exp .exp i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ffe38a, #f0a81c); }
.rg-exp small { font: 600 12px Kanit, Poppins, sans-serif; color: #fff; text-shadow: 0 1px 4px rgba(0,40,90,.7); }
/* shop open: only the bag card, on the right; the shop sits on the left */
body.shopping .bagwin { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; grid-template-areas: "chips chips chips" ". . right" ". . right"; }
body.shopping .rg-right { pointer-events: auto; }
body.shopping .rg-chips, body.shopping .rg-left, body.shopping .rg-ring, body.shopping .rg-exp { display: none; }
/* phones (landscape) and short windows */
@media (max-height: 560px) {
  .bagwin { --R: min(128px, 30vh); --slot: clamp(36px, 10.6vh, 46px); --cell: 42px; grid-template-columns: minmax(0, 1fr) calc(var(--R) * 2 + var(--slot) + 8px) minmax(0, 1.12fr);
    grid-template-rows: 38px minmax(0, 1fr) 34px; gap: 6px 10px; padding: 6px 10px 6px; }
  .rg-chips { gap: 6px; } .rg-chips button { padding: 5px 12px; font-size: 13px; } .rg-chips button svg { width: 16px; height: 16px; } .rg-chips .x { width: 32px; height: 32px; font-size: 15px; }
  .rg-card { padding: 8px 10px 10px; border-radius: 16px; gap: 6px; }
  .bag-name { font-size: 15px; } .cb-cls { font-size: 11px; } .rg-who { padding-bottom: 3px; }
  .rg-halo::before { inset: 14px; }
  .wslot { border-width: 2px; }
  .rg-exp { flex-direction: row; gap: 8px; } .rg-exp .lv { font-size: 16px; } .rg-exp .exp { width: 200px; height: 9px; } .rg-exp small { font-size: 10px; }
  .st-list { gap: 3px; } .st-row { grid-template-columns: 26px minmax(0, 1fr) auto 26px; padding: 2px 6px 2px 9px; gap: 5px; border-radius: 9px; }
  .st-ic { width: 24px; height: 24px; } .st-l b { font-size: 13px; } .st-l small { display: none; } .st-v { font-size: 15px; }
  .st-plus { width: 24px; height: 24px; font-size: 16px; border-radius: 7px; } .st-sp { width: 24px; }
  .st-points { padding: 3px 8px; font-size: 12px; } .st-points b { font-size: 16px; min-width: 38px; padding: 0 8px; }
  .dt-cards { gap: 4px; } .dt-card { padding: 3px 2px; } .dt-card .st-ic { width: 20px; height: 20px; } .dt-card b { font-size: 13px; } .dt-res { padding: 3px 6px; font-size: 12px; }
  .cb-h { font-size: 14px; } .bag-tabs button small { display: none; } .bag-tabs button { padding: 3px; } .bag-tabs button svg { width: 14px; height: 14px; }
  .bag-grid { gap: 4px; } .bag-grid .cell { border-radius: 9px; }
  .d-act button { padding: 5px 10px; font-size: 12px; }
  .bag-zen { padding: 2px 10px 2px 4px; } .bag-zen b { font-size: 13px; } .bag-zen svg { width: 18px; height: 18px; }
}
/* narrow windows: ring on top, cards below */
@media (max-width: 760px) and (min-height: 561px) {
  .bagwin { --R: min(120px, 30vw); grid-template-columns: 1fr 1fr; grid-template-rows: 48px auto 40px minmax(0, 1fr); grid-template-areas: "chips chips" "ring ring" "exp exp" "left right"; padding: 10px; }
}
.rg-exp .lv, .rg-exp small { white-space: nowrap; }
.dt-res span:not(.st-ic) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 560px) { .dt-resgrid { gap: 4px; } .dt-res { grid-template-columns: 18px minmax(0, 1fr) auto; } .dt-res small { display: none; } .dt-res .st-ic { width: 16px; height: 16px; } }

/* ===== every other window in the same bright floating-card style (shop, settings, waypoints, skills) ===== */
.win { background: rgba(255,255,255,.95); color: var(--sk-ink); border: 0; border-radius: 22px; padding: 14px 16px; box-shadow: 0 14px 40px rgba(0,40,90,.3); }
.win header { margin-bottom: 10px; color: var(--sk-ink); }
.win header b { font: 700 19px Kanit, Poppins, 'Noto Sans Thai', sans-serif; color: var(--sk-ink); }
.win .x { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 0; background: #f1f7fd; color: #36506e; font: 700 15px/1 Kanit, Poppins, sans-serif; box-shadow: 0 2px 6px rgba(0,40,90,.15); }
.win footer { color: var(--sk-muted); } .win footer b { color: #a8700a; }
.win button:not(.x):not(.row):not(.cell):not(.ghost) { color: #fff; background: var(--th-btn); border: 0; border-radius: 11px; box-shadow: 0 3px 0 var(--th-btn-sh); font-family: Kanit, Poppins, 'Noto Sans Thai', sans-serif; font-weight: 600; }
.win button:disabled { opacity: .45; }
.win button.ghost { color: #5f7896; background: #fff; border: 1px solid var(--sk-line); border-radius: 10px; }
.shopgrid { background: #f3f8fd; border-radius: 14px; }
.inv-act span { color: var(--sk-ink); }
#shop i.pr { color: #a8700a; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.list .row { color: var(--sk-ink); background: #f5faff; border: 1px solid var(--sk-line); border-radius: 12px; }
.list .row:hover { background: #eaf4fd; }
.list .row small { color: var(--sk-muted); }
.list .muted, #travel .wp-hint { color: var(--sk-muted); }
#travel .wp-group { color: var(--sk-deep); font-weight: 700; }
#travel .row.wp.here { border-color: var(--sk-teal); box-shadow: 0 0 0 2px rgba(63,207,194,.35); }
#travel .row.wp.locked b { color: #9aaabb; }
.set h4 { color: var(--sk-deep); font-family: Kanit, Poppins, 'Noto Sans Thai', sans-serif; }
.srow2 { color: var(--sk-ink); border-bottom: 1px solid #edf3f9; }
.srow2 select { color: var(--sk-ink); background: #fff; border: 1px solid var(--sk-line); border-radius: 8px; }
.srow2 input[type=checkbox] { accent-color: var(--sk-sky); }
.srow2 input[type=range] { accent-color: var(--sk-sky); }

/* ===================================================================================================================
   Caelmora HUD — our own design (user 2026-09-30: "UI ระบบคุณออกแบบให้ผมได้เลย"), same language as the character window:
   white floating cards, sky accents, rings. Replaces the old dark mobile HUD and the Codex PoE art.
   Phone (landscape): status card top-left, potions under it, round minimap + menu top-right, joystick bottom-left,
   thumb arc bottom-right (attack in the corner, 2 small buttons on the inner ring, 4 skills on the outer ring), chat centre.
   PC: the same top row; one dock at the bottom centre: HP ring (= potion Q) | attack + skills | menu | MP ring (= potion W).
   =================================================================================================================== */
@property --p { syntax: '<number>'; inherits: true; initial-value: 1; }
#hud { position: fixed; inset: 0; pointer-events: none; --pad: 10px; --mm: 128px; color: var(--sk-ink); font-family: 'Noto Sans Thai', system-ui, sans-serif;
  --card: rgba(255,255,255,.92); --card-sh: 0 6px 18px rgba(0,40,90,.28); --kf: Kanit, Poppins, 'Noto Sans Thai', sans-serif; }
#hud button { pointer-events: auto; font-family: inherit; font-weight: 600; cursor: pointer; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; }
.touch-only, .pc-only { display: none !important; }
body.touch .touch-only { display: block !important; }
body.pc #pc-hud { display: block !important; }
html, body, #world, #hud { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select, textarea { font-size: 16px; }
#hud svg.hi { display: block; width: 62%; height: 62%; pointer-events: none; overflow: visible; }

/* ---- status card (top-left) ---- */
#h-status { position: absolute; top: calc(var(--pad) + env(safe-area-inset-top)); left: calc(var(--pad) + env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 44px 20px 20px 44px; pointer-events: auto; cursor: pointer;
  background: var(--card); border: 2px solid #fff; box-shadow: var(--card-sh), inset 0 -3px 0 rgba(160,200,235,.35); }
#h-status .portrait { position: relative; flex: none; width: 62px; height: 62px; border-radius: 50%; border: 3px solid #fff;
  background: radial-gradient(circle at 50% 35%, #eef9ff, #9fd6fb); box-shadow: 0 0 0 2px #bfe0f7, 0 0 12px rgba(120,210,255,.85); }
#h-status .portrait canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
#h-level { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 0 8px; border-radius: 10px; white-space: nowrap;
  font: 700 11px/17px var(--kf); color: #5a3a00; background: linear-gradient(#ffe38a, #f0a81c); border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,40,90,.3); }
#h-status .st-info { display: flex; flex-direction: column; gap: 4px; width: clamp(150px, 21vw, 220px); }
#h-status .st-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 18px; }
#h-name { font: 700 14px/1.15 var(--kf); color: var(--sk-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#h-cls { display: none; font: 500 11.5px/1.2 var(--kf); color: var(--sk-muted); }
body.pc #h-cls { display: block; }
body.pc #h-status .st-top { flex-direction: column; align-items: flex-start; gap: 1px; }
#h-saver { flex: none; width: 24px; height: 24px; border-radius: 50% !important; background: #f1f7fd !important; display: grid; place-items: center; opacity: .5; }
#h-saver svg.hi { width: 78%; height: 78%; }
#h-saver.on { opacity: 1; box-shadow: 0 0 0 2px #7fe08a; }
#h-status .bars { display: flex; flex-direction: column; gap: 3px; }
#h-status .bar { position: relative; height: 15px; border-radius: 8px; background: #e6eef6; box-shadow: inset 0 1px 2px rgba(0,40,90,.25); overflow: hidden; }
#h-status .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 8px; transition: width .25s; }
#h-status .bar i::after { content: ''; position: absolute; left: 4px; right: 4px; top: 2px; height: 35%; border-radius: 4px; background: rgba(255,255,255,.4); }
#h-status .bar.hp i { background: linear-gradient(180deg, #ff9a8a, #ec3c4c 55%, #c8203a); }
#h-status .bar.mp i { background: linear-gradient(180deg, #9ad8ff, #3a8ef0 55%, #2366c8); }
#h-status .bar.ag { height: 8px; }
#h-status .bar.ag i { background: linear-gradient(180deg, #ffe38a, #f0a81c); }
#h-status .bar.ag span { display: none; }
#h-status .bar span { position: relative; display: block; text-align: center; font: 600 10.5px/15px var(--kf); color: #fff; text-shadow: 0 1px 1px rgba(60,0,10,.55), 0 0 3px rgba(0,0,0,.3); }
#h-status .bar.mp span { text-shadow: 0 1px 1px rgba(0,20,70,.6), 0 0 3px rgba(0,0,0,.3); }
#h-status.low .bar.hp { animation: hud-low 1s ease-in-out infinite; }
@keyframes hud-low { 50% { box-shadow: inset 0 1px 2px rgba(0,40,90,.25), 0 0 0 2px rgba(255,80,100,.8), 0 0 10px rgba(255,60,80,.8); } }

/* ---- buffs ---- */
#h-buffs { position: absolute; top: calc(var(--pad) + 150px + env(safe-area-inset-top)); left: calc(var(--pad) + env(safe-area-inset-left)); display: flex; gap: 6px; align-items: center;
  padding: 3px 10px; border-radius: 14px; background: var(--card); box-shadow: var(--card-sh); font: 600 12px var(--kf); max-width: 300px; }
#h-buffs:has(#buff-list:empty) { display: none; }

/* ---- target (top centre) ---- */
#h-target { position: absolute; top: calc(var(--pad) + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); min-width: 220px; max-width: 46vw; text-align: center;
  padding: 6px 14px 8px; border-radius: 18px; pointer-events: auto; cursor: pointer; background: var(--card); border: 2px solid #fff; box-shadow: var(--card-sh); }
#tg-name { font: 700 14px/1.2 var(--kf); color: var(--sk-ink); }
#tg-el { margin-left: 6px; padding: 1px 8px; border-radius: 9px; background: #f1f7fd; font: 600 11px var(--kf); vertical-align: 1px; }
#h-target .tgbar { height: 10px; margin-top: 5px; border-radius: 6px; background: #f6e4e8; box-shadow: inset 0 1px 2px rgba(0,40,90,.2); overflow: hidden; }
#h-target .tgbar i { display: block; height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(180deg, #ff9a8a, #e0303e); transition: width .2s; }

/* ---- round minimap + map chip (top-right) ---- */
#h-mapwrap { position: absolute; top: calc(var(--pad) + env(safe-area-inset-top)); right: calc(var(--pad) + env(safe-area-inset-right)); width: var(--mm);
  display: flex; flex-direction: column-reverse; align-items: center; }
#minimap-box { position: relative; width: var(--mm); height: var(--mm); border-radius: 50%; overflow: hidden; pointer-events: auto; cursor: pointer;
  background: radial-gradient(circle, #f2faff, #cfe8fb); border: 4px solid #fff; box-shadow: 0 0 0 2px #bfe0f7, 0 0 16px rgba(120,210,255,.85), 0 6px 14px rgba(0,40,90,.3); }
#minimap-box::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; border: 1.5px dashed rgba(255,255,255,.9); pointer-events: none; animation: rg-spin 90s linear infinite; }
#minimap { display: block; width: 100%; height: 100%; }
#minimap-box.hidden { display: none; }
#minimap-box.big { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 82vh, 82vw); height: min(560px, 82vh, 82vw); z-index: 6; opacity: .95; }
#h-map { position: relative; z-index: 1; margin-top: -13px; max-width: calc(var(--mm) + 48px); height: 26px; padding: 0 12px; display: flex; align-items: center; gap: 4px;
  border-radius: 14px !important; border: 2px solid #fff !important; background: var(--th-btn) !important; color: #fff !important; box-shadow: 0 3px 0 var(--th-btn-sh), 0 4px 10px rgba(0,40,90,.3); }
#h-map span { font: 600 11.5px/1 var(--kf); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#h-map i { font-style: normal; font-size: 10px; opacity: .85; }

/* ---- menu (phones, top-right next to the minimap) ---- */
#h-menu { position: absolute; top: calc(var(--pad) + env(safe-area-inset-top)); right: calc(var(--pad) + var(--mm) + 14px + env(safe-area-inset-right)); display: flex; gap: 6px; align-items: flex-start; }
#h-menu .icons { display: flex; gap: 2px; padding: 4px 6px; border-radius: 30px; background: var(--card); border: 2px solid #fff; box-shadow: var(--card-sh); }
#h-menu.closed .icons { display: none; }
#h-menu .icons button { position: relative; width: 52px; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 18px; }
#h-menu .icons button:hover, #h-menu .icons button:active { background: #eef6fd; }
#h-menu .icons button svg.hi { width: 30px; height: 30px; filter: drop-shadow(0 1px 1px rgba(0,40,90,.25)); }
#h-menu .icons span { font: 600 10px/1 var(--kf); color: #36506e; white-space: nowrap; }
#h-menu .icons button.on { background: #e6fbe9; box-shadow: inset 0 0 0 2px #7fe08a; }
#h-menu .pill { width: 26px; height: 66px; border-radius: 14px !important; background: var(--card) !important; border: 2px solid #fff !important; box-shadow: var(--card-sh); color: var(--sk-deep) !important; font: 700 16px var(--kf) !important; }
#hud .badge, #pc-hud .badge { position: absolute; right: -3px; top: -4px; z-index: 1; font: 700 10px/1 var(--kf); font-style: normal; color: #fff; background: #ff5a6a; border: 2px solid #fff; border-radius: 10px; padding: 3px 6px; box-shadow: 0 2px 4px rgba(0,0,0,.2); }

/* ---- potion belt (phones, under the status card) ---- */
#belt { position: absolute; z-index: 3; top: calc(var(--pad) + 92px + env(safe-area-inset-top)); left: calc(var(--pad) + 4px + env(safe-area-inset-left)); display: flex; gap: 6px; }
#belt .pot { position: relative; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(160deg, #fff, #eef6fd); border: 2px solid #fff; box-shadow: 0 0 0 1.5px #cfe2f3, 0 4px 10px rgba(0,40,90,.25); }
#belt .pot svg.hi { width: 74%; height: 74%; }
#belt .pot.empty { background: rgba(255,255,255,.5); border: 2px dashed #cfe2f3; box-shadow: none; }
#belt .pot.empty svg.hi { width: 40%; height: 40%; }
#belt .pot i { position: absolute; right: 3px; bottom: 0; font: 700 11px var(--kf); font-style: normal; color: var(--sk-ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
#belt kbd { display: none; }
#belt .pot.down { transform: scale(.93); }

/* ---- joystick ---- */
#joyzone { position: absolute; left: 0; bottom: 0; width: 34vw; height: 62vh; pointer-events: auto; }
#joy { position: absolute; left: calc(26px + env(safe-area-inset-left)); bottom: calc(22px + env(safe-area-inset-bottom)); width: clamp(116px, 34vh, 164px); aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; border: 3px solid rgba(255,255,255,.85);
  background: radial-gradient(circle, rgba(255,255,255,.3), rgba(255,255,255,.1) 66%, rgba(255,255,255,.25));
  box-shadow: 0 0 14px rgba(120,210,255,.6), inset 0 0 14px rgba(120,210,255,.45); }
#joy::before { content: ''; position: absolute; inset: 13%; border-radius: 50%; border: 2px dashed rgba(255,255,255,.75); }
#joy.float { transition: none; }
#joy .knob { width: 42%; aspect-ratio: 1; border-radius: 50%; pointer-events: none; border: 3px solid #fff;
  background: radial-gradient(circle at 38% 32%, #fff, #bfe6ff 45%, #4aa6e8); box-shadow: 0 4px 10px rgba(0,40,90,.35); }

/* ---- thumb arc (phones, bottom-right): #hotbar is a 0x0 point at the attack button's centre; every button is placed
   around it by angle (--a, clockwise from the right: 180 = left, 270 = up) and radius (--rad) ---- */
#hotbar { position: absolute; z-index: 3; width: 0; height: 0; --s: clamp(46px, 13vh, 56px); --A: calc(var(--s) * 1.6); --m: calc(var(--s) * .38 + 34px);
  --R: calc(var(--A) / 2 + var(--s) * 1.45); --r: calc(var(--A) / 2 + var(--s) * .55);
  right: calc(18px + var(--A) / 2 + env(safe-area-inset-right)); bottom: calc(16px + var(--A) / 2 + env(safe-area-inset-bottom)); }
#hotbar .hb-row { display: contents; }
#hotbar button { position: absolute; left: 0; top: 0; display: grid; place-items: center; touch-action: none; --a: 0deg; --rad: 0px;
  transform: translate(-50%, -50%) rotate(var(--a)) translateX(var(--rad)) rotate(calc(var(--a) * -1)); transition: filter .1s; }
#hotbar button.down { filter: brightness(1.12) saturate(1.2); }
#b-atk { width: var(--A); height: var(--A); border-radius: 50% !important; border: 4px solid #fff !important;
  background: radial-gradient(circle at 40% 30%, #9fe0ff, #3a96dc 62%, #2474c0) !important;
  box-shadow: 0 0 0 3px #9fd4f7, 0 0 20px rgba(120,210,255,.95), 0 8px 16px rgba(0,40,90,.35); }
#b-atk svg.hi { width: 56%; height: 56%; filter: drop-shadow(0 2px 2px rgba(0,30,80,.45)); }
#b-atk span { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); display: none; padding: 1px 8px; border-radius: 9px; font: 700 10px/14px var(--kf); color: #fff; background: #34b04a; border: 2px solid #fff; }
#b-atk.auto span { display: block; }
#b-atk.auto { box-shadow: 0 0 0 3px #7fe08a, 0 0 22px rgba(127,224,138,.95), 0 8px 16px rgba(0,40,90,.35); }
#hotbar .skill { width: var(--s); height: var(--s); --rad: var(--R); border-radius: 50% !important; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #fff, #eef6fd) !important; border: 3px solid #bfe0f7 !important; box-shadow: 0 6px 14px rgba(0,50,100,.25);
  font: 700 15px/1 var(--kf) !important; color: #9fbcd8 !important; }
#hotbar #sk-1 { --a: 180deg; } #hotbar #sk-2 { --a: 210deg; } #hotbar #sk-3 { --a: 240deg; } #hotbar #sk-4 { --a: 270deg; }
#hotbar .skill.empty { border-style: dashed !important; border-color: #8fc2ea !important; background: rgba(255,255,255,.88) !important; color: #7fa6c8 !important; }
#hotbar .skill.has { color: var(--sk-ink) !important; font-size: 10px !important; line-height: 1.1 !important; padding: 5px; text-align: center; border-color: var(--sk-sky) !important;
  background: radial-gradient(circle at 50% 30%, #f2faff, #a8dafa) !important; }
#hotbar .skill .nm { position: relative; pointer-events: none; }
#hotbar .skill .cd { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
#hotbar #b-aim, #hotbar #b-page, #hotbar #b-portal { width: calc(var(--s) * .74); height: calc(var(--s) * .74); --rad: var(--r); border-radius: 50% !important;
  background: #fff !important; border: 2px solid #fff !important; box-shadow: 0 0 0 1.5px #cfe2f3, 0 4px 10px rgba(0,40,90,.25); }
#hotbar #b-aim { --a: 200deg; } #hotbar #b-page { --a: 290deg; } #hotbar #b-portal { --a: 250deg; }
#b-page b { font: 700 18px/1 var(--kf); color: var(--sk-deep); margin-top: -4px; }
#b-page small { position: absolute; bottom: 1px; font: 600 8.5px/1 var(--kf); color: var(--sk-muted); }
#hotbar kbd { display: none; }

/* ---- chat ---- */
#chatbox { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); width: clamp(220px, 32vw, 420px); pointer-events: auto;
  display: flex; flex-direction: column; gap: 3px; padding: 4px; border-radius: 16px; background: rgba(255,255,255,.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0,40,90,.2); }
#chatbox.moved { transform: none; bottom: auto; }
#chatbox.dragging { opacity: .9; outline: 2px dashed rgba(74,166,232,.8); outline-offset: 2px; }
#chat-row { display: none; gap: 4px; }
#chatbox.typing #chat-row { display: flex; }
#chat-row input { flex: 1; min-width: 0; padding: 6px 10px; font-size: 14px; border-radius: 12px; color: var(--sk-ink); background: #fff; border: 1.5px solid var(--sk-line); }
#chat-row button { padding: 6px 14px !important; font: 600 13px var(--kf) !important; color: #fff !important; background: var(--th-btn) !important; border-radius: 12px !important; box-shadow: 0 2px 0 var(--th-btn-sh); }
#chat-tabs { display: flex; gap: 3px; align-items: center; }
#chat-grip { flex: 0 0 20px; height: 22px; display: grid; place-items: center; font-size: 13px; line-height: 1; color: #8fb2d2; cursor: grab; touch-action: none; user-select: none; }
#chatbox.dragging #chat-grip { cursor: grabbing; }
#b-chat { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50% !important; background: #fff !important; box-shadow: 0 1px 3px rgba(0,40,90,.25); display: grid; place-items: center; }
#b-chat svg.hi { width: 72%; height: 72%; }
#chat-tabs button[data-ch] { flex: 1; height: 22px; border-radius: 11px !important; font: 600 10.5px/22px var(--kf) !important; color: #5f7896 !important; background: rgba(255,255,255,.75) !important; }
#chat-tabs button[data-ch].on { color: #fff !important; background: var(--th-btn) !important; box-shadow: 0 2px 0 var(--th-btn-sh); }
#chat-log { height: clamp(46px, 15vh, 110px); overflow-y: auto; padding: 4px 8px; border-radius: 12px; background: rgba(255,255,255,.62);
  font-size: 11.5px; line-height: 1.45; color: var(--sk-ink); text-shadow: none; }
#chat-log .sys { color: #1f6fb8; }
#chat-log .me { color: #a8700a; }
#chat-log .rar1 { color: #3f55e0; font-weight: 600; }
#chat-log .rar2 { color: #b87800; font-weight: 700; }

/* ---- experience (phones: a thin line along the bottom edge) ---- */
#hud .expbar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.5); }
#hud .expbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe38a, #f0a81c); transition: width .3s; }
#hud .expbar span { position: absolute; bottom: 7px; font: 600 10px var(--kf); color: #fff; text-shadow: 0 1px 3px rgba(0,40,90,.85); white-space: nowrap; }
#f-exp { left: calc(10px + env(safe-area-inset-left)); }
#f-fps { left: 50%; transform: translateX(-50%); display: none; }

/* ---- messages ---- */
#toast { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); padding: 6px 18px; border-radius: 18px; white-space: normal; width: max-content; max-width: min(92vw, 620px); text-align: center; line-height: 1.35; transition: opacity .4s;
  font: 600 14px var(--kf); color: var(--sk-ink); background: rgba(255,255,255,.94); box-shadow: 0 4px 14px rgba(0,40,90,.28); }
#toast:empty { display: none; }
#pick-list { position: absolute; z-index: 4; min-width: 180px; padding: 6px; border-radius: 16px; pointer-events: auto; background: rgba(255,255,255,.97); box-shadow: 0 8px 22px rgba(0,40,90,.3); }
#pick-list button { display: block; width: 100%; margin: 3px 0; padding: 8px 12px !important; text-align: left; font: 600 13px var(--kf) !important; color: var(--sk-ink) !important;
  background: #f5faff !important; border: 1px solid var(--sk-line) !important; border-radius: 12px !important; }
#pick-list button:hover { background: #eaf4fd !important; }
#pick-list button small { margin-left: 6px; font-weight: 400; color: var(--sk-muted); }
#dead { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(circle, rgba(255,255,255,.25), rgba(20,50,90,.5)); }
#dead b { font: 700 40px var(--kf); color: #fff; text-shadow: 0 3px 14px rgba(0,40,90,.7); }
#dead span { padding: 4px 16px; border-radius: 16px; font: 600 14px var(--kf); color: var(--sk-ink); background: rgba(255,255,255,.9); }
#rotate-hint { background: linear-gradient(180deg, #8fd0fb, #eef8ff) !important; color: var(--sk-ink); font-family: Kanit, Poppins, sans-serif; }
#rotate-hint b { color: var(--sk-deep) !important; }

/* ---- update notice: a white pill ---- */
#patch-note { background: rgba(255,255,255,.96); border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0,40,90,.3); color: var(--sk-ink); font-family: Kanit, Poppins, 'Noto Sans Thai', sans-serif; }
#patch-note .pn-title b { color: var(--sk-deep); }
#patch-note .pn-title i { color: var(--sk-muted); }
#patch-note .pn-dot { background: var(--sk-teal); box-shadow: 0 0 6px var(--sk-teal); }
#patch-note .pn-ok { border: 0; background: var(--th-btn); color: #fff; box-shadow: 0 2px 0 var(--th-btn-sh); font-family: Kanit, Poppins, sans-serif; }
#patch-note .pn-list { background: rgba(255,255,255,.97); border: 0; box-shadow: 0 6px 18px rgba(0,40,90,.25); color: var(--sk-ink); }

/* ---- PC: dock at the bottom centre ---- */
body.pc #belt, body.pc #hotbar, body.pc #h-menu, body.pc #h-saver { display: none !important; }
body.pc #hud { --mm: 172px; --pad: 14px; }
body.pc #h-status .bars { display: none; }
body.pc #h-status .st-info { width: auto; max-width: 220px; }
body.pc #h-status { padding-right: 18px; }
body.pc #h-buffs { top: calc(var(--pad) + 84px); }
body.pc #h-target { min-width: 320px; }
body.touch #h-target { top: calc(var(--pad) + 80px + env(safe-area-inset-top)); left: 52%; min-width: 170px; padding: 4px 12px 6px; }
body.touch #tg-name { font-size: 13px; }
body.touch #h-target .tgbar { height: 8px; margin-top: 3px; }
/* big PC screens: the HUD grows with the window (designed at 768 px high) */
@media (min-height: 900px) {
  body.pc #pc-dock { transform: translateX(-50%) scale(1.18); transform-origin: 50% 100%; bottom: 16px; }
  body.pc #h-status { transform: scale(1.15); transform-origin: 0 0; }
  body.pc #h-mapwrap { transform: scale(1.12); transform-origin: 100% 0; }
  body.pc #h-target { transform: translateX(-50%) scale(1.12); transform-origin: 50% 0; }
  body.pc #h-buffs { top: calc(var(--pad) + 98px); }
  body.pc #chatbox:not(.moved) { width: clamp(250px, calc(50vw - 500px), 420px); }
}
@media (min-height: 1300px) {
  body.pc #pc-dock { transform: translateX(-50%) scale(1.45); }
  body.pc #h-status { transform: scale(1.4); } body.pc #h-mapwrap { transform: scale(1.35); } body.pc #h-target { transform: translateX(-50%) scale(1.35); }
  body.pc #h-buffs { top: calc(var(--pad) + 120px); }
}
body.pc #chatbox:not(.moved) { left: 14px; transform: none; bottom: 14px; width: clamp(250px, calc(50vw - 430px), 400px); }
@media (max-width: 1360px) { body.pc #chatbox:not(.moved) { width: calc(50vw - 420px); } #chat-tabs button[data-ch] { font-size: 10px !important; } }
@media (max-width: 1180px) { body.pc #chatbox:not(.moved) { bottom: 128px; width: 300px; } }
body.pc #world { cursor: default; }
body.pc #world.over-mon { cursor: crosshair; }
body.pc #world.over-npc, body.pc #world.over-item { cursor: pointer; }
#pc-hud { position: absolute; left: 0; right: 0; bottom: 0; height: 0; pointer-events: none; }
#pc-hud button { pointer-events: auto; position: relative; padding: 0; border: 0; border-radius: 0; background: none; color: var(--sk-ink); font-family: inherit; cursor: pointer; }
#pc-hud kbd { position: absolute; font: 700 9px/1 var(--kf); color: var(--sk-muted); pointer-events: none; }
#pc-dock { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 12px; }
#pc-dock .dk-bar { position: relative; display: flex; align-items: center; gap: 10px; height: 70px; padding: 4px 14px 0; border-radius: 24px; pointer-events: auto;
  background: var(--card); border: 2px solid #fff; box-shadow: var(--card-sh), inset 0 -3px 0 rgba(160,200,235,.35); }
#pc-dock .dk-skills, #pc-dock .dk-menu { display: flex; align-items: center; gap: 8px; }
#pc-dock .dk-menu { gap: 2px; }
#pc-dock .dk-sep { width: 2px; height: 42px; background: linear-gradient(transparent, #cfe2f3, transparent); }
#pc-hud .pc-skill { width: 50px; height: 50px; border-radius: 16px; overflow: hidden; transition: transform .1s, box-shadow .1s;
  background: linear-gradient(160deg, #fff, #eef6fd); border: 2px solid #fff; box-shadow: 0 0 0 1.5px #cfe2f3, 0 4px 10px rgba(0,40,90,.2); }
#pc-hud .pc-skill.empty { background: rgba(245,250,255,.8); border: 2px dashed #cfe2f3; box-shadow: none; }
#pc-hud .pc-skill.has { background: linear-gradient(160deg, #eef8ff, #a8dafa); box-shadow: 0 0 0 1.5px #7cc4f4, 0 4px 10px rgba(0,40,90,.2); }
#pc-hud .pc-skill .nm { position: absolute; inset: 4px 3px 12px; display: grid; place-items: center; font: 600 10px/1.05 var(--kf); text-align: center; overflow: hidden; }
#pc-hud .pc-skill .cd { position: absolute; inset: 0; border-radius: 14px; pointer-events: none; }
#pc-hud .pc-skill kbd { left: 6px; bottom: 4px; }
#pc-hud .pc-skill.atk { width: 60px; height: 60px; border-radius: 50%; border: 3px solid #fff; overflow: visible;
  background: radial-gradient(circle at 40% 30%, #9fe0ff, #3a96dc 62%, #2474c0); box-shadow: 0 0 0 2px #9fd4f7, 0 0 14px rgba(120,210,255,.85), 0 4px 10px rgba(0,40,90,.3); }
#pc-hud .pc-skill.atk .dk-disc { display: grid; place-items: center; width: 100%; height: 100%; }
#pc-hud .pc-skill.atk svg.hi { width: 58%; height: 58%; filter: drop-shadow(0 2px 2px rgba(0,30,80,.45)); }
#pc-hud .pc-skill.atk kbd { left: 50%; bottom: -8px; transform: translateX(-50%); padding: 2px 5px; border-radius: 7px; background: #fff; color: var(--sk-deep); box-shadow: 0 1px 3px rgba(0,40,90,.25); }
#pc-hud .pc-menu { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; transition: transform .1s, background .1s; }
#pc-hud .pc-menu svg.hi { width: 32px; height: 32px; filter: drop-shadow(0 1px 1px rgba(0,40,90,.25)); }
#pc-hud .pc-menu kbd { right: 3px; bottom: 2px; }
#pc-hud .pc-menu.on { background: #e6fbe9; box-shadow: inset 0 0 0 2px #7fe08a; }
#pc-hud .pc-menu:hover { background: #eef6fd; transform: translateY(-2px); }
#pc-hud .pc-skill:hover { transform: translateY(-2px); }
#pc-hud .pc-skill.down, #pc-hud .pc-menu.down, #pc-hud .dk-ring.down { transform: scale(.94); }
/* HP / MP ring gauges (click = drink): a white disc with the potion, the ring fills clockwise from the bottom (MP mirrored) */
#pc-dock .dk-gauge { position: relative; width: 88px; height: 88px; pointer-events: auto; transition: --p .35s ease-out; }
#pc-dock .dk-gauge.life { --c1: #ff8a8a; --c2: #e0303e; --glow: rgba(255,90,110,.75); }
#pc-dock .dk-gauge.mana { --c1: #9ad8ff; --c2: #2f7fe0; --glow: rgba(90,170,255,.75); }
#pc-hud .dk-ring { position: absolute; inset: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #bfe0f7, 0 0 14px var(--glow), 0 6px 16px rgba(0,40,90,.3); transition: transform .1s; }
#pc-hud .dk-ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%;
  background: conic-gradient(from 180deg, var(--c1), var(--c2) calc(var(--p) * 360deg), #e6eef6 0);
  -webkit-mask: radial-gradient(circle closest-side, transparent 74%, #000 76%); mask: radial-gradient(circle closest-side, transparent 74%, #000 76%); }
#pc-dock .dk-gauge.mana .dk-ring::before { transform: scaleX(-1); }
#pc-hud .dk-ring::after { content: ''; position: absolute; inset: 17px; border-radius: 50%; border: 1.5px dashed #cfe2f3; pointer-events: none; }
#pc-hud .dk-ring .dk-disc { position: absolute; inset: 18px; display: grid; place-items: center; }
#pc-hud .dk-ring svg.hi { width: 100%; height: 100%; }
#pc-hud .dk-ring i { position: absolute; right: 8px; bottom: 6px; min-width: 20px; padding: 2px 5px; border-radius: 9px; font: 700 11px/1 var(--kf); font-style: normal; color: var(--sk-ink); background: #fff; box-shadow: 0 1px 3px rgba(0,40,90,.3); }
#pc-hud .dk-ring kbd { left: 8px; bottom: 6px; padding: 2px 5px; border-radius: 7px; background: #fff; color: var(--sk-deep); box-shadow: 0 1px 3px rgba(0,40,90,.3); }
#pc-hud .dk-ring.none .dk-disc { opacity: .35; }
#pc-dock .dk-num { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; padding: 2px 10px; border-radius: 11px;
  background: var(--card); box-shadow: 0 2px 8px rgba(0,40,90,.25); font: 700 12.5px/1.3 var(--kf); }
#pc-dock .dk-num small { margin-right: 4px; font-size: 10.5px; color: var(--sk-muted); }
#pc-dock .life .dk-num b { color: #d02a3c; } #pc-dock .mana .dk-num b { color: #2366c8; }
#pc-dock .dk-gauge.low .dk-ring { animation: hud-low-ring 1s ease-in-out infinite; }
@keyframes hud-low-ring { 50% { box-shadow: 0 0 0 3px #ff6a7a, 0 0 26px rgba(255,60,80,.95), 0 6px 16px rgba(0,40,90,.3); } }
/* EXP along the top edge of the dock bar */
#pc-dock .dk-exp { position: absolute; left: 18px; right: 18px; top: -5px; height: 0; }
#pc-dock .expbar { position: absolute; left: 0; right: 0; top: 0; bottom: auto; height: 9px; border-radius: 6px; background: #e6eef6; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,40,90,.25); }
#pc-dock .expbar i { border-radius: 4px; }
#pc-dock .expbar span { bottom: 11px; color: var(--sk-ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; font-size: 10.5px; }
#pc-dock #f-exp { left: 50%; transform: translateX(-50%); }
#pc-dock #f-fps { left: auto; right: 0; transform: none; }

/* ---- smaller screens ---- */
@media (max-height: 640px) {
  body.pc #hud { --mm: 140px; }
  #pc-dock { transform: translateX(-50%) scale(.88); transform-origin: 50% 100%; bottom: 8px; }
}
@media (max-height: 460px) {
  #hud { --pad: 8px; --mm: 108px; }
  #h-status .portrait { width: 52px; height: 52px; }
  #h-status .st-info { width: clamp(140px, 20vw, 190px); }
  #h-status .bar { height: 13px; } #h-status .bar span { line-height: 13px; font-size: 10px; }
  #h-menu .icons button { width: 46px; height: 48px; }
  #h-menu .icons button svg.hi { width: 26px; height: 26px; }
  #h-menu .pill { height: 58px; }
  #belt { top: calc(var(--pad) + 80px + env(safe-area-inset-top)); }
  #belt .pot { width: 42px; height: 42px; }
  #h-buffs { top: calc(var(--pad) + 130px); }
}
@media (max-height: 420px) { #h-map { align-self: flex-end; padding: 0 9px; max-width: calc(var(--mm) + 34px); } #h-map span { font-size: 10.5px; } }
@media (max-height: 360px) { #hotbar { --s: 42px; } #hud { --mm: 90px; } }
@media (max-width: 760px) { #h-menu .icons span { display: none; } #h-menu .icons button { width: 40px; height: 40px; } #h-menu .pill { height: 48px; } }

/* ===== login + character screens in the bright UI (2026-09-30) — the painted backdrops stay, every panel / button becomes
   a white floating card with sky buttons (same language as the HUD and the character window) ===== */
#scr-login, #scr-chars { color-scheme: light; --kf: Kanit, Poppins, 'Noto Sans Thai', sans-serif; }
#scr-login #game-title { color: #fff; font-weight: 700; -webkit-text-stroke: 0; text-shadow: 0 3px 0 #2f6fb0, 0 0 18px rgba(120,210,255,.9), 0 8px 18px rgba(0,30,80,.55); }
#scr-login .login-rule { background: linear-gradient(90deg, transparent, #fff 22%, #fff 78%, transparent); }
#scr-login .login-rule::after { background: #fff; box-shadow: 0 0 8px #7fd0f8; }
#scr-login #game-tagline { display: inline-block; padding: 2px 14px; border-radius: 14px; color: var(--sk-ink); background: rgba(255,255,255,.88); font: 600 13px var(--kf); text-shadow: none; box-shadow: 0 3px 10px rgba(0,30,80,.3); }
#scr-login .login-brand { text-align: center; }
#scr-login #login-form { background: rgba(255,255,255,.94); border: 2px solid #fff; border-radius: 24px; box-shadow: 0 14px 40px rgba(0,30,80,.4); color: var(--sk-ink); }
#scr-login #login-form::before, #scr-login #login-form::after { display: none; }
#scr-login #login-tabs { border-bottom: 0; gap: 4px; padding: 3px; border-radius: 14px; background: #eef5fc; }
#scr-login #login-tabs button { border: 0; border-radius: 11px; color: #5f7896; background: none; font-family: var(--kf); }
#scr-login #login-tabs button.on { color: #fff; background: var(--th-btn); box-shadow: 0 2px 0 var(--th-btn-sh); }
#scr-login #login-form label { color: var(--sk-ink); font-family: var(--kf); }
#scr-login #login-form input, #scr-login #login-form select { color: var(--sk-ink); background: #fff; border: 1.5px solid var(--sk-line); border-radius: 12px; }
#scr-login #login-form input:focus, #scr-login #login-form select:focus { border-color: var(--sk-sky); box-shadow: 0 0 0 3px rgba(74,166,232,.25); }
#scr-login #server-list option { background: #fff; color: var(--sk-ink); }
#scr-login #signup-hint, #scr-login .hint { color: var(--sk-muted); }
#scr-login #btn-login, #scr-login #btn-guest { border: 0; border-radius: 14px; color: #fff; background: var(--th-btn); box-shadow: 0 4px 0 var(--th-btn-sh), 0 6px 14px rgba(0,40,90,.25); font: 700 16px var(--kf); }
#scr-login #btn-login:hover:not(:disabled), #scr-login #btn-guest:hover:not(:disabled) { background: var(--th-btn-hi); border-color: transparent; }
#scr-login #btn-login:active:not(:disabled), #scr-login #btn-guest:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--th-btn-sh); background: var(--th-btn); }
#scr-login #login-status { color: #a8700a; font-family: var(--kf); }

#scr-chars { --char-gold: var(--sk-deep); --char-glass: rgba(255,255,255,.94); --char-line: var(--sk-line); color: var(--sk-ink); }
#scr-chars .char-brand { color: #fff; font-weight: 700; text-shadow: 0 2px 0 #2f6fb0, 0 0 14px rgba(120,210,255,.85), 0 6px 14px rgba(0,30,80,.5); }
#scr-chars .char-screen-header h2 { justify-self: center; padding: 4px 22px; border-radius: 22px; color: var(--sk-ink); background: rgba(255,255,255,.92); font: 700 clamp(18px, 2.2vw, 30px)/1.3 var(--kf); text-shadow: none; box-shadow: 0 6px 18px rgba(0,30,80,.35); }
#scr-chars button { font-family: var(--kf); border-radius: 14px; }
#scr-chars .char-primary { border: 0; color: #fff; background: var(--th-btn); box-shadow: 0 4px 0 var(--th-btn-sh), 0 6px 14px rgba(0,40,90,.3); }
#scr-chars .char-primary:hover:not(:disabled) { background: var(--th-btn-hi); }
#scr-chars .char-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--th-btn-sh); }
#scr-chars .char-secondary { border: 0; color: var(--sk-ink); background: rgba(255,255,255,.94); box-shadow: 0 0 0 1.5px var(--sk-line), 0 4px 12px rgba(0,40,90,.25); }
#scr-chars .char-secondary:hover:not(:disabled) { background: #fff; border-color: transparent; box-shadow: 0 0 0 2px var(--sk-sky), 0 4px 12px rgba(0,40,90,.25); }
#scr-chars .char-primary:disabled, #scr-chars .char-secondary:disabled { opacity: .55; }
#scr-chars .char-glass { border: 2px solid #fff; border-radius: 22px; background: rgba(255,255,255,.94); box-shadow: 0 10px 30px rgba(0,30,80,.35); }
#scr-chars .status { color: #a8700a; font-family: var(--kf); }
#scr-chars .char-slot { color: #fff; text-shadow: 0 1px 4px rgba(0,30,80,.8); }
#scr-chars .char-slot-name { border: 2px solid #fff; border-radius: 16px; color: var(--sk-ink); background: rgba(255,255,255,.94); font: 700 16px/22px var(--kf); text-shadow: none; box-shadow: 0 4px 12px rgba(0,30,80,.35); }
#scr-chars .char-slot.is-selected .char-slot-name { color: #fff; background: var(--th-btn); border-color: #fff; box-shadow: 0 0 0 3px #9fd4f7, 0 0 16px rgba(120,210,255,.9); }
#scr-chars .char-slot-meta { font-family: var(--kf); }
#scr-chars .char-slot-empty { border: 2px dashed #9fcbef; border-radius: 16px; color: var(--sk-deep); background: rgba(255,255,255,.85); font: 600 14px/20px var(--kf); text-shadow: none; }
#scr-chars #char-selected-name { color: var(--sk-ink); font-family: var(--kf); font-weight: 700; }
#scr-chars #char-selected-class { color: var(--sk-deep); font-family: var(--kf); }
#scr-chars .char-selected-meta { color: var(--sk-muted); font-family: var(--kf); }
#scr-chars #btn-enter { font: 700 20px var(--kf); background: linear-gradient(180deg, #ffd76a, #f0a81c); color: #5a3a00; box-shadow: 0 4px 0 #b87800, 0 6px 16px rgba(160,100,0,.35); }
#scr-chars #btn-enter:hover:not(:disabled) { background: linear-gradient(180deg, #ffe38a, #f5b62c); }
#scr-chars #btn-enter:active:not(:disabled) { box-shadow: 0 2px 0 #b87800; }
#scr-chars .char-guest-note { border: 0; border-radius: 14px; color: var(--sk-ink); background: rgba(255,255,255,.9); box-shadow: 0 4px 12px rgba(0,30,80,.25); font-family: var(--kf); }
#scr-chars .char-class, #scr-chars #class-pick .class-card { border: 1.5px solid var(--sk-line); border-radius: 16px; color: var(--sk-ink); background: #f7fbff; }
#scr-chars .char-class.is-selected, #scr-chars #class-pick .class-card.sel { border-color: var(--sk-sky); background: linear-gradient(90deg, #e6f5ff, #fff); box-shadow: 0 0 0 2px rgba(74,166,232,.35); }
#scr-chars .char-class:hover:not(.is-selected):not(:disabled) { border-color: var(--sk-sky); background: #eef7ff; }
#scr-chars .char-class-details { overflow-y: auto; overscroll-behavior: contain; justify-content: safe center; }
@media (max-height: 820px) { #scr-chars #class-stats { height: 150px; } #scr-chars .char-class-details { gap: 10px; padding: 14px 18px; } }
#scr-chars #class-title { line-height: 1.25; padding-top: 2px; }
#scr-chars .char-class-name { color: var(--sk-ink); font-family: var(--kf); font-weight: 700; }
#scr-chars .char-class-th { color: var(--sk-muted); }
#scr-chars .char-class svg { color: var(--sk-sky); }
#scr-chars #class-title { color: var(--sk-ink); font-family: var(--kf); font-weight: 700; }
#scr-chars .char-title-th { color: var(--sk-deep); font-family: var(--kf); }
#scr-chars #class-stats { color: var(--sk-ink); }
#scr-chars #class-stats text { fill: var(--sk-ink); }
#scr-chars .char-stat-values { color: var(--sk-muted); font-family: var(--kf); }
#scr-chars .char-stat-values b, #scr-chars .char-stat-values strong { color: var(--sk-deep); }
#scr-chars #class-description { color: #3e5670; }
#scr-chars .char-hair-section { border-top: 1px solid var(--sk-line); }
#scr-chars .char-option-label { color: var(--sk-ink); font-family: var(--kf); }
#scr-chars .char-hair-swatch { border: 2px solid #fff; box-shadow: 0 0 0 1px var(--sk-line), 0 2px 5px rgba(0,40,90,.25); }
#scr-chars .char-hair.is-selected { border-color: var(--sk-sky); background: #e6f5ff; box-shadow: 0 0 0 2px rgba(74,166,232,.35); }
#scr-chars .char-hair:hover { background: #eef7ff; }
#scr-chars .char-create-footer label { color: var(--sk-ink); font-family: var(--kf); }
#scr-chars .char-name-hint { color: var(--sk-muted); }
#scr-chars #new-name, #scr-chars #char-delete-name { border: 1.5px solid var(--sk-line); border-radius: 12px; color: var(--sk-ink); background: #fff; }
#scr-chars #new-name:focus, #scr-chars #char-delete-name:focus { border-color: var(--sk-sky); box-shadow: 0 0 0 3px rgba(74,166,232,.25); outline: none; }
#scr-chars .char-delete-overlay { background: rgba(14,32,58,.45); }
#scr-chars #char-delete-title { color: #d02a3c; font-family: var(--kf); }
#scr-chars #char-delete-label, #scr-chars .char-delete-card label { color: var(--sk-ink); }
#scr-chars #char-delete-confirm { background: linear-gradient(180deg, #ff8a8a, #e0303e); box-shadow: 0 4px 0 #a81a2a; }

/* settings: account buttons (change character / log out), tap twice to confirm */
#settings .set-acts { gap: 8px; }
#settings .set-acts button { flex: 1; padding: 9px 10px; font-size: 13px; }
#settings .set-acts button.armed { color: #fff !important; background: linear-gradient(#ffb36a, #f0781c) !important; box-shadow: 0 3px 0 #b85a10 !important; border: 0 !important; }
#settings select[data-k="lang"] { min-width: 130px; }
/* longer words in other languages (English / Tiếng Việt / Filipino): keep HUD labels on one line */
#chat-tabs button[data-ch] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding: 0 3px !important; }
#h-menu .icons span { max-width: 50px; overflow: hidden; text-overflow: ellipsis; }
html:not([lang="th"]) #h-menu .icons span { font-size: 9px; letter-spacing: -0.1px; }
.dt-res span:not(.st-ic) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#chat-tabs button[data-ch] { flex: 1 1 auto; }
html:not([lang="th"]) #chat-tabs button[data-ch] { font-size: 10px !important; }
html:not([lang="th"]) #chatbox:not(.moved) { width: clamp(240px, 37vw, 440px); }
html:not([lang="th"]) body.pc #chatbox:not(.moved) { width: clamp(250px, calc(50vw - 430px), 400px); }
/* ===== Approved A: Sky Porcelain (2026-09-30) =====
   Painted nine-slice chrome; text, data, inputs and hit targets remain native. */
:root {
 --porcelain:#f8f5ed; --porcelain-ink:#20334b; --porcelain-gold:#bea16a;
 --sk-ink:var(--porcelain-ink); --sk-muted:#6e6b64; --sk-line:#d5c9b1;
 --sk-card:var(--porcelain); --sk-sky:#408bb3; --sk-deep:#296184; --sk-gold:#bc8b31; --sk-teal:#318b97;
 --th-btn:linear-gradient(#68a9c9,#327698); --th-btn-hi:linear-gradient(#84bad1,#4488a9); --th-btn-sh:#24526f;
 --th-soft:#f0ebdf; --th-card:linear-gradient(100deg,#f2ece1,#fcfaf5);
 --ui-frame:url('../assets/ui/porcelain/window-frame.webp'); --ui-ring:url('../assets/ui/porcelain/portrait-frame.webp');
}
button,input,select {font-family:Kanit,'Noto Sans Thai',sans-serif}
button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #276e94;outline-offset:3px}
img.painted,img.item-art{object-fit:contain;pointer-events:none;user-select:none}
#hud img.hi{display:block;width:72%;height:72%;filter:drop-shadow(0 2px 1px #2b211a55)}
#hud{--card:var(--porcelain);--card-sh:0 4px 10px #34271738}
#h-status,#h-target,#h-buffs,#toast,#pick-list,#patch-note{
 background:var(--porcelain);border:1px solid var(--porcelain-gold);border-radius:5px;box-shadow:0 2px 8px #34271740,inset 0 0 0 2px #fff9;
}
#h-status {border-width:12px;border-image:var(--ui-frame) 220 fill / 20px / 0 stretch;padding:2px 5px 2px 0;gap:8px}
#h-status .portrait {background:#e8f2f5;border:0;box-shadow:none;width:64px;height:64px}
#h-status .portrait::after{content:'';position:absolute;inset:-8px;background:var(--ui-ring) center/100% 100% no-repeat;pointer-events:none}
#h-status .portrait canvas{padding:4px}
#h-level{z-index:1;border:1px solid #bea16a;background:#fcf7e8;color:#433725;box-shadow:0 1px 2px #41332240;bottom:-7px}
#h-status .bar{border:1px solid #ba9f76;background:#dfd6c8;height:15px}
#h-status .bar.hp i{background:linear-gradient(#f9abb5,#dc5b73)}
#h-status .bar.mp i{background:linear-gradient(#92d6ef,#3a95c2)}
#h-status .bar span{color:#172d43;text-shadow:0 1px #ffffffb0;font-weight:700}
#h-saver{width:44px;height:44px;background:none!important}
body.pc #h-status .bars{display:flex}
body.pc #h-status .st-info{width:225px;max-width:225px}
body.pc #h-status .st-top{flex-direction:row}
body.pc #h-cls{display:none}
#h-target{background:#f8f5edd9;border-radius:5px}
body.touch #h-target{top:calc(10px + env(safe-area-inset-top));left:48%;min-width:140px;max-width:180px}
#minimap-box{border:4px solid #d1b77f;box-shadow:0 0 0 2px #fff9ed,0 4px 12px #2d241c60;background:#e5eddd}
#minimap-box::after{inset:0;border:0;border-radius:0;background:var(--ui-ring) center/110% 110% no-repeat;animation:none}
#h-map{height:44px!important;min-height:44px;background:#f8f5ed!important;color:#20334b!important;border:1px solid #bea16a!important;border-radius:5px!important;box-shadow:0 2px 4px #30241740}
#h-menu .icons{background:none;border:0;box-shadow:none;padding:0;gap:3px}
#h-menu .icons button{width:48px;height:58px;border-radius:0}
#h-menu .icons button img.hi{width:44px;height:44px}
#h-menu .icons span{color:#20334b;text-shadow:0 1px #fff,0 0 4px #fff;max-width:none;overflow:visible;line-height:1.2}
#h-menu .icons button:hover,#h-menu .icons button.on{background:none;box-shadow:none;filter:drop-shadow(0 0 4px #ffe7a5)}
#h-menu .pill{width:44px;height:44px;background:#f8f5edc9!important;border:1px solid #bea16a!important;border-radius:50%!important}
#belt .pot{width:44px;height:44px;border:2px solid #bca577;border-radius:7px;background:#f8f5eddd;box-shadow:inset 0 0 0 1px #fff,0 2px 4px #34271755}
#belt .pot.empty{border:1px solid #bca577;background:#f8f5ed88}
#joy{border:2px solid #e5d3a6;box-shadow:0 1px 3px #614c2d55,inset 0 0 0 2px #fff7;background:#f8f5ed21}
#joy::before{border:1px solid #f8f2de99}
#joy .knob{border:2px solid #d0b480;background:#f8f5eddd var(--ui-ring) center/cover no-repeat;box-shadow:0 2px 8px #34271740}
#b-atk{background:#f8f5edcc!important;border:3px solid #bda16a!important;box-shadow:inset 0 0 0 2px #fff,0 3px 8px #34271755}
#b-atk img.hi{width:72%;height:72%}
#hotbar .skill,#hotbar .skill.empty,#hotbar .skill.has{border:2px solid #bea16a!important;background:#f8f5edf0!important;color:#20334b!important;box-shadow:inset 0 0 0 2px #fff9,0 3px 7px #34271755}
#hotbar .skill.has{background:radial-gradient(circle at 40% 25%,#99d8ef,#367997)!important;color:#fff!important;text-shadow:0 1px 2px #173b55}
#hotbar .mini,#hotbar .page{min-width:44px;min-height:44px;border:2px solid #bfa571!important;background:#f8f5eddd!important;color:#20334b!important}
#hotbar .skill .cd,#pc-hud .pc-skill .cd{z-index:2}
#hotbar .skill .nm,#pc-hud .pc-skill .nm{z-index:3}
#chat-log{background:#243b4680;color:#fff;text-shadow:0 1px 2px #182632;border:1px solid #c4ad7777;border-radius:4px}
#chat-log .sys{color:#f3e6c8}
#chat-tabs button[data-ch]{border-radius:3px!important;background:#f8f5edcc!important;color:#233b4d!important;min-height:28px}
#chat-tabs button[data-ch].on{background:#427a99!important;color:#fff!important;box-shadow:none}
#chat-row{background:#f8f5edee;border:1px solid #bfa571;border-radius:4px}
#chat-row input{color:#20334b}
#hud .expbar{background:#403b3299;border:1px solid #c9ac6e;height:7px}
#hud .expbar i{background:linear-gradient(#f8d789,#c59b43)}
#hud .expbar span{color:#fff7e5;text-shadow:0 1px 3px #241b15}
#pc-dock{gap:0;bottom:20px}
#pc-dock .dk-bar{height:86px;padding:12px 18px 18px;gap:12px;background:none;border:12px solid transparent;border-image:var(--ui-frame) 220 fill / 32px / 0 stretch;border-radius:0;box-shadow:0 4px 10px #251f1640}
#pc-dock .dk-gauge{width:46px;height:50px;flex:none}
#pc-dock .dk-num{display:none}
#pc-hud .dk-ring{border-radius:6px;background:none;box-shadow:none}
#pc-hud .dk-ring::before,#pc-hud .dk-ring::after{display:none}
#pc-hud .dk-ring .dk-disc{inset:0 2px 9px}
#pc-hud .dk-ring .dk-disc img{width:100%;height:100%}
#pc-hud .dk-ring i{right:-1px;bottom:8px;background:none;box-shadow:none;color:#fff;text-shadow:0 1px 2px #000;font-size:12px}
#pc-hud .dk-ring kbd,#pc-hud .pc-skill kbd{left:50%;right:auto;bottom:-12px;transform:translateX(-50%);padding:2px 6px;border:1px solid #bfa571;border-radius:4px;background:#fcf9ed;color:#20334b;font-size:10px;z-index:4}
#pc-dock .dk-skills{gap:10px}
#pc-hud .pc-skill,#pc-hud .pc-skill.empty{width:50px;height:50px;border-radius:6px;border:2px solid #c4ac79;background:#f5efe0;box-shadow:inset 0 0 0 1px #fff9,0 2px 3px #31271840}
#pc-hud .pc-skill{overflow:visible}
#pc-hud .pc-skill.has{background:linear-gradient(#92cee5,#397e9f);color:#fff;border:2px solid #c4ac79;text-shadow:0 1px 3px #244156}
#pc-hud .pc-skill.atk{width:80px;height:50px;border-radius:6px;background:#f8f5ed;border:1px solid #bea16a;box-shadow:none}
#pc-hud .pc-skill.atk .dk-disc img{width:56px;height:42px}
#pc-hud .pc-skill .nm{inset:3px;line-height:1.25}
#pc-hud > .dk-menu{position:absolute;right:20px;bottom:28px;display:flex;gap:8px;pointer-events:auto}
#pc-hud .pc-menu{width:54px;height:62px;background:none!important;box-shadow:none!important;border-radius:0}
#pc-hud .pc-menu img{width:48px;height:48px}
#pc-hud .pc-menu kbd{bottom:-5px;left:50%;right:auto;transform:translateX(-50%);color:#fff;text-shadow:0 1px 3px #162a39}
#pc-hud .pc-menu.on{filter:drop-shadow(0 0 5px #ffdc74)}
#pc-dock .dk-exp{left:14px;right:14px;top:auto;bottom:-4px}
#pc-dock .expbar{height:7px;border:1px solid #c4a362;box-shadow:none;background:#504637}
#pc-dock .expbar span{bottom:-17px;color:#fff7e5;text-shadow:0 1px 3px #1d1b17}
body.pc #chatbox:not(.moved),html:not([lang="th"]) body.pc #chatbox:not(.moved){width:clamp(250px,23vw,390px);bottom:16px}
.win,.itip,#scr-login #login-form,#scr-chars .char-glass{
 background:var(--porcelain);border:16px solid transparent;border-image:var(--ui-frame) 220 fill / 34px / 0 stretch;border-radius:0;box-shadow:0 8px 26px #2c251b45;color:var(--porcelain-ink);
}
.win{padding:6px 10px;max-width:calc(100vw - 24px)}
.win header{border-bottom:1px solid #d8c8a8;padding-bottom:8px}
.win .x,.rg-chips .x{min-width:44px;min-height:44px;background:linear-gradient(#cb7c80,#a64953);color:white;border:2px solid #cfb584;box-shadow:inset 0 0 0 1px #fff8;border-radius:50%}
.win button:not(.x):not(.row):not(.cell):not(.ghost),.d-act button{min-height:44px;border:1px solid #bc9e62;border-radius:5px;box-shadow:inset 0 0 0 1px #fff7,0 2px 2px #34271730}
.win button.ghost{min-height:44px;border-color:#c6b28c;background:#f8f5ed;border-radius:5px;color:#31445a}
.list .row{min-height:44px;border-color:#d2c2a0;background:#f9f6ef;border-radius:5px}
.list .row:hover{background:#eaf3f5}
.srow2{min-height:44px;gap:14px;border-bottom-color:#ddd1bc}
.srow2 select{min-height:44px;max-width:55%;border-color:#c2aa7e}
.srow2 input[type=checkbox]{width:24px;height:24px;margin:10px;accent-color:#408bb3}
.srow2 input[type=range]{min-height:44px;max-width:160px;accent-color:#408bb3}
#settings{width:min(470px,92vw);max-height:calc(100dvh - 32px);overflow:auto;top:16px}
#settings .set-acts{flex-wrap:wrap}
#settings .set-acts button{min-width:150px;white-space:normal}
#inv.bagwin{inset:5vh 4vw;--R:min(205px,27vh);--slot:64px;--cell:44px;
 grid-template-columns:minmax(210px,.85fr) minmax(calc(var(--R)*2 + var(--slot)),1.25fr) minmax(380px,1.2fr);
 grid-template-rows:48px minmax(0,1fr) 40px;gap:8px 12px;padding:28px;
 background:none;border:18px solid transparent;border-image:var(--ui-frame) 220 fill / 58px / 0 stretch;
 backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:0 12px 45px #172b4555;
}
.rg-chips{justify-self:start;gap:6px}
.rg-chips button{min-height:44px;padding:6px 18px;border:1px solid #c5af84;border-radius:5px;background:#f5f0e5;box-shadow:none;color:#20334b}
.rg-chips button.on{background:var(--th-btn);color:#fff;border-color:#b99855;box-shadow:inset 0 0 0 1px #fff6}
.rg-chips button.on svg{color:#fff}
.rg-chips .x{position:absolute;right:8px;top:6px;padding:0}
.rg-card{padding:8px;border-radius:0;background:none;box-shadow:none;overflow:hidden}
.rg-left{border-right:1px solid #d9cbae}
.rg-right{border-left:1px solid #d9cbae}
.rg-who{padding:6px 0 12px}
.st-row{border:1px solid #d4c7af;border-radius:6px;background:linear-gradient(90deg,#f3ede3,#fcfaf5);box-shadow:inset 0 0 0 1px #fff;grid-template-columns:32px minmax(0,1fr) auto 44px;gap:6px;padding:3px 7px}
.st-row::before{display:none}
.st-plus{width:44px;height:44px;border:1px solid #baa47b;border-radius:50%;color:#625440;background:linear-gradient(#fffdf7,#ded2ba);box-shadow:inset 0 0 0 2px #fff7}
.st-plus:disabled{background:#e9e2d5;color:#aba18e}
.st-points{background:#f3ece0;border:1px solid #d2bf97;border-radius:6px;color:#25394e}
.st-points b,.st-points.has b{background:#fefaf0;color:#866526;border:1px solid #c3a56e;box-shadow:none}
.rg-halo{border:1px solid #ccb584;box-shadow:inset 0 0 0 6px #f8f5ed;overflow:hidden;background:url('../assets/ui/porcelain/doll-arch.webp') center/cover no-repeat}
.rg-halo::before{border:1px solid #dfcfab;animation:none}
.rg-exp .lv,.rg-exp small{color:#20334b;text-shadow:none}
.rg-exp{flex-direction:row;gap:12px}
.rg-exp .exp{width:150px;border:1px solid #b6a681;height:8px;background:#ddd8cf;box-shadow:none}
.wslot,.wslot:not(.filled){border:1px solid #bda46e;background:#fbf7ef;border-radius:50%;box-shadow:inset 0 0 0 3px #fff,0 1px 4px #513c252c}
.wslot::after{content:'';position:absolute;inset:-5px;background:var(--ui-ring) center/100% 100% no-repeat;pointer-events:none}
.wslot .ph{opacity:.4}
.wslot img.item-art{width:68%;height:68%;position:absolute;left:16%;top:16%}
.wslot .ic{display:contents}
.bag-tabs button{min-height:44px;border:1px solid #cebc97;border-radius:4px;background:#f5f0e5;color:#20334b}
.bag-tabs button.on{background:#4287a7;border-color:#b99a5e}
.bag-tabs img.item-art{width:22px;height:22px}
.bag-grid{display:grid;grid-template-columns:repeat(8,minmax(44px,1fr));grid-template-rows:repeat(8,44px);grid-auto-flow:row;gap:3px;overflow:auto;align-content:start;padding:3px;isolation:isolate}
.bag-grid .cell{aspect-ratio:auto;min-width:44px;min-height:44px;border:1px solid #c9b99c;border-radius:4px;background:#f6f0e5;box-shadow:inset 0 0 0 1px #fff8;z-index:1}
.bag-grid .cell.empty{background:#eee7da;border:1px solid #d0c2aa;border-radius:4px;box-shadow:inset 0 0 0 1px #ffffffb0;z-index:0}
.bag-grid .cell img.item-art{width:90%;height:90%;min-height:0;max-height:100%;position:absolute;inset:5%}
.bag-detail{background:#f6f1e8;border:1px solid #d3c2a0;border-radius:4px}
.bag-zen{background:#fcf7e9;border-color:#d2b77c;border-radius:5px}
.bag-zen img.item-art{width:24px;height:24px}
.dt-card,.dt-res{background:#f9f5ec;border-color:#d3c2a3;border-radius:5px}
.dt-row{border-color:#dfd4c2}
.itip{padding:8px 2px;min-width:240px;max-width:350px;text-align:left;border-width:12px;border-image-width:26px}
.itip .it-head{background:none;border-bottom:1px solid #ccb484;padding:4px 8px 9px}
.itip .it-head b{color:var(--rc)}
.itip .it-kind,.itip .it-req{color:#76674e}
.itip .it-body{padding:5px 8px}
.itip .it-m{color:#2c7499;padding:3px 0;line-height:1.5}
.itip .it-m i{display:inline-block;background:#dbeaf0;border:1px solid #c7af7e;border-radius:4px;color:#295776;padding:0 4px;font-weight:600}
.shopgrid{background:#eee7da;border:1px solid #d1c1a0;border-radius:5px}
#shop img.item-art{width:80%;height:80%;object-fit:contain}
body.shopping #inv.bagwin{inset:4vh 3vw 4vh 52vw;display:flex;flex-direction:column;padding:20px;border-width:12px;background:none;pointer-events:none}
body.shopping .rg-right{border:0;flex:1;pointer-events:auto}
body.shopping #shop{left:3vw;right:auto;top:4vh;bottom:4vh;transform:none;width:46vw;max-height:none;overflow:auto}
#scr-login.has-bg{background:#cbe5f3 url('../assets/ui/porcelain/daylight.webp') center/cover no-repeat}
#scr-login.has-bg::before,#scr-login.has-bg::after{background:none}
#scr-login #game-title{color:#fffcf1;text-shadow:0 2px 0 #a57e3e,0 4px 14px #244c7166}
#scr-login #game-tagline{color:#20334b;background:#fff7e6d9;border-radius:3px;box-shadow:none}
#scr-login #login-form{padding:16px 22px}
#scr-login #login-tabs{background:#ece2cd;border-radius:4px}
#scr-login #login-tabs button{border-radius:3px;min-height:44px}
#scr-login #login-form input,#scr-login #login-form select{border-radius:4px;border-color:#c7b38c;min-height:44px;background:#fcfaf4}
#scr-login #btn-login,#scr-login #btn-guest{border:1px solid #bc9d60;border-radius:5px;box-shadow:inset 0 0 0 1px #fff8,0 2px 5px #4b382933;min-height:44px}
#scr-chars #char-select-screen,#scr-chars #create-form{background-image:url('../assets/ui/porcelain/daylight.webp')}
#scr-chars .char-screen-header h2{background:#faf5e7e8;border:1px solid #c0a570;border-radius:4px;color:#20334b}
#scr-chars .char-primary,#scr-chars .char-secondary{border:1px solid #bca16b;border-radius:5px;min-height:44px;box-shadow:inset 0 0 0 1px #fff6,0 2px 5px #3b2b2444}
#scr-chars .char-secondary{background:#fbf7ed;color:#20334b}
#scr-chars .char-slot-name{border:1px solid #bfa570;border-radius:4px;background:#faf6eb}
#scr-chars .char-slot.is-selected .char-slot-name{background:var(--th-btn);border-color:#c6ad73;box-shadow:0 0 0 2px #faf1d4}
#scr-chars .char-class,#scr-chars #class-pick .class-card{background:#f9f5ec;border:1px solid #c9b792;border-radius:4px}
#scr-chars .char-class.is-selected,#scr-chars #class-pick .class-card.sel{background:#e7f1f5;border-color:#bc9d60;box-shadow:inset 0 0 0 1px #fff}
#scr-chars #new-name,#scr-chars #char-delete-name{border-radius:4px;border-color:#c8b58c;min-height:44px}
#dead span,#pick-list button,#patch-note .pn-list{background:#f8f5ed!important;color:#20334b!important;border:1px solid #c3a66e!important;border-radius:5px!important}
#rotate-hint{background:#f8f5ed var(--ui-frame) center/100% 100% no-repeat!important;color:#20334b}
@media(min-height:900px){body.pc #pc-dock{transform:translateX(-50%) scale(1.18)}}
@media(max-width:1400px){#inv.bagwin{inset:3vh 2vw;--R:min(175px,26vh);--slot:56px;grid-template-columns:minmax(200px,.8fr) minmax(calc(var(--R)*2 + var(--slot)),1fr) minmax(300px,1fr);padding:20px;gap:8px}body.pc #chatbox:not(.moved){width:250px}#pc-hud > .dk-menu{gap:3px;right:12px}#pc-hud .pc-menu{width:46px}}
@media(max-height:560px){
 #hud{--mm:100px;--pad:8px}
 #h-status{border-width:8px;border-image-width:16px;padding:0}
 #h-status .portrait{width:52px;height:52px}
 #h-status .st-info{width:150px;gap:2px}
 #h-status .bar{height:13px}
 #h-name{font-size:12px}
 #h-saver{position:absolute;left:220px;top:0;background:none!important}
 #belt{top:84px}
 #h-menu{gap:0;right:calc(114px + env(safe-area-inset-right))}
 #h-menu .icons button{width:44px;height:50px}
 #h-menu .icons span{display:none}
 #h-menu .icons button img.hi{width:42px;height:42px}
 #h-target{max-width:150px!important}
 #h-target .tgbar{height:7px}
 #joy{width:116px}
 #hotbar{--s:44px}
 #inv.bagwin{inset:4px max(6px,env(safe-area-inset-right)) 4px max(6px,env(safe-area-inset-left));--R:104px;--slot:44px;grid-template-columns:minmax(170px,.9fr) 252px minmax(250px,1.1fr);grid-template-rows:44px minmax(0,1fr) 24px;gap:2px 6px;padding:9px;border-width:10px;border-image-width:24px}
 .rg-card{padding:3px 5px;gap:4px}
 .rg-chips button{padding:3px 10px;font-size:12px}
 .rg-chips .x{top:0;right:0}
 .rg-who{padding:0 0 4px}
 .st-row{grid-template-columns:22px minmax(0,1fr) auto 44px;padding:0 3px;gap:3px;min-height:44px}
 .st-list{gap:2px}.st-ic{width:22px;height:22px}.st-v{font-size:14px}.st-l b{font-size:12px}
 .st-plus{width:44px;height:44px;font-size:20px}.st-sp{width:44px}
 .rg-exp{gap:5px}.rg-exp .lv{font-size:13px}.rg-exp small{font-size:10px}
 .bag-tabs button{min-height:44px;padding:2px}.bag-tabs button small{display:none}
 .cb-h{font-size:14px}.cb-h .bag-count{font-size:10px}
 .bag-grid{grid-template-columns:repeat(8,44px);grid-template-rows:repeat(8,44px);flex:1}
 .bag-detail:not(:has(.d-tip)){min-height:24px;padding:2px 4px}.bag-detail .muted{font-size:10px}
 .bag-foot{min-height:24px}.bag-zen img.item-art{width:18px;height:18px}
 .win{border-width:12px;border-image-width:26px}
 #settings{top:6px;max-height:calc(100dvh - 12px)}
 body.shopping #inv.bagwin{inset:6px 6px 6px 52vw;padding:8px}
 body.shopping #shop{left:6px;top:6px;bottom:6px;width:49vw}
 #scr-login #login-form{padding:6px 14px;border-width:12px;border-image-width:26px}
 #scr-chars .char-glass{border-width:8px;border-image-width:22px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
/* Final geometry follows the approved three-column sheet, not a full-screen dashboard. */
@media(min-height:561px){
 #inv.bagwin{inset:50% auto auto 50%;transform:translate(-50%,-50%);width:min(94vw,1536px);height:min(88vh,900px);--R:min(205px,25vh);border-image-width:70px}
 .rg-card{gap:10px}
 .bag-grid{grid-template-rows:repeat(8,minmax(44px,1fr));max-height:560px}
 .st-list{gap:9px}.st-row{min-height:55px}
 .rg-ring{align-self:center}
 .cb-h{font-size:22px}
}
#shop .shopgrid{display:flex;flex-direction:column;gap:10px;grid-template:none;max-height:calc(100% - 160px);overflow:auto;padding:5px;background:none;border:0}
#shop .shop-row{position:relative;display:grid;grid-template-columns:70px minmax(0,1fr) auto;gap:12px;align-items:center;min-height:88px;flex:none;padding:8px 14px;aspect-ratio:auto;background:#fbf7ed;border:1px solid #c9b68e;border-radius:5px;text-align:left}
#shop .shop-row.sel{background:#e3f0f4;outline:2px solid #b99a57;outline-offset:0}
#shop .shop-art{display:block;width:64px;height:64px;position:relative}
#shop .shop-row img.item-art{position:static;width:100%;height:100%}
#shop .shop-row i.pr{position:static;color:#8a682f;text-shadow:none;font-size:15px;white-space:nowrap}
#shop .shop-item-name{color:#21364c;font-size:16px;font-weight:600;justify-self:start;text-align:left}
#shop-sel b{color:#294663!important}
#shop .inv-act{flex-wrap:wrap}
#shop .inv-act button{min-width:100px}
body.shopping #inv.bagwin{transform:none;width:auto;height:auto;box-shadow:0 8px 25px #24354233}
.bag-grid .cell.empty{pointer-events:none}
@media(min-height:561px){
 #inv .rg-ring{--R:min(225px,25vh);height:calc(var(--R)*2.36 + var(--slot));width:calc(var(--R)*1.7 + var(--slot))}
 #inv .wslot{transform:translate(calc(var(--R)*var(--rx)),calc(var(--R)*var(--ry)))}
 #inv .rg-halo{inset:calc(var(--slot)/2);border-radius:48%}
}
@media(max-height:560px){
 #shop .shop-row{grid-template-columns:48px minmax(0,1fr) auto;min-height:64px;padding:4px 8px;gap:7px}
 #shop .shop-art{width:44px;height:44px}
 #shop .shop-item-name{font-size:12px}
 #shop .shop-row i.pr{font-size:12px}
 #shop .shopgrid{max-height:calc(100% - 132px)}
}
/* Touch channels keep full labels and finger-sized targets; scroll the strip if needed. */
body.touch #chatbox:not(.moved),html:not([lang="th"]) body.touch #chatbox:not(.moved){width:min(336px,43vw)}
body.touch #chat-tabs{height:44px;overflow-x:auto;overflow-y:hidden;flex-wrap:nowrap}
body.touch #chat-tabs button,body.touch #chat-grip,body.touch #b-chat{min-width:44px;min-height:44px;height:44px;flex:0 0 auto}
body.touch #chat-tabs button[data-ch]{overflow:visible;text-overflow:clip;min-height:44px;padding:0 6px!important}
body.touch #chatbox{border-radius:5px;background:#f8f3e6b8;box-shadow:0 1px 5px #33483322}
body.touch #chat-row input,body.touch #chat-row button,body.touch #patch-note .pn-title,body.touch #patch-note .pn-ok{min-height:44px}
@media(max-height:560px){body.touch #h-target{top:calc(70px + env(safe-area-inset-top));left:48%}}

/* C / Aether Atelier — active theme, approved by the player after Sky Porcelain.
 * Layout/IDs remain shared; enamel, crystal and chamfered metal replace feathers. */
:root{
 --aether-ink:#183c3f;--aether-teal:#10434a;--aether-light:#f1eedb;--aether-gold:#bda162;
 --sk-ink:var(--aether-ink);--sk-muted:#66746a;--sk-deep:#14616a;--sk-line:#c7bb95;--sk-teal:#218d8e;
 --porcelain:var(--aether-light);--porcelain-ink:var(--aether-ink);--porcelain-gold:var(--aether-gold);
 --th-btn:linear-gradient(#34737a,#124650);--th-btn-hi:linear-gradient(#418f95,#1a5963);--th-btn-sh:#09343b;
 --th-card:linear-gradient(100deg,#eae6ce,#faf7e8);--th-soft:#e7e3cc;
 --ui-frame:url('../assets/ui/aether/panel.webp');--ui-ring:url('../assets/ui/aether/ring.webp');
 --ui-enamel:url('../assets/ui/aether/enamel.webp');--ui-slot:url('../assets/ui/aether/slot.webp');
 --cut:polygon(12% 0,88% 0,100% 12%,100% 88%,88% 100%,12% 100%,0 88%,0 12%);
}
.win,.itip,#scr-login #login-form,#scr-chars .char-glass,#inv.bagwin{border-image-source:var(--ui-frame);border-image-slice:100 fill;color:var(--aether-ink)}
#inv.bagwin{border-image-width:76px}
#h-status,#pc-dock .dk-bar{border-image-source:var(--ui-enamel);border-image-slice:100 fill;border-image-width:26px;color:#f9f5df}
#h-status{background:none}
#h-status .st-info,#h-name,#h-cls{color:#f9f5df;text-shadow:0 1px 2px #03272b}
#h-status .portrait{background:#12474e}
#h-status .portrait::after{inset:-9px}
#h-level{background:#113e45;color:#fff4cf;border-color:#c9ac62}
#h-status .bar{border-color:#c7a551;background:#092d33;border-radius:0;clip-path:polygon(3% 0,97% 0,100% 50%,97% 100%,3% 100%,0 50%)}
#h-status .bar.hp i{background:linear-gradient(#ff8b78,#df302b 65%,#af201d)}
#h-status .bar.mp i{background:linear-gradient(#76e2fa,#169bce 65%,#106aa6)}
#h-status .bar span{color:#fff9e7;text-shadow:0 1px 2px #143e42}
#h-target{background:#103c43ed;border-color:#d1b773;color:#fff5dd;border-radius:3px}
#tg-name,#tg-el{color:#fff5dd}
#minimap-box{border-color:#bc9d56;background:#d7e1bf;box-shadow:0 0 0 2px #143d43,0 3px 10px #07282d70;overflow:visible}
#minimap-box canvas{border-radius:50%}
#minimap-box::after{inset:-9%;background:var(--ui-ring) center/100% 100% no-repeat;pointer-events:none}
#h-map{background:var(--aether-teal)!important;color:#fff4d4!important;border-color:#cfb16b!important;border-radius:2px!important}
#belt .pot,#belt .pot.empty,#hotbar .skill,#hotbar .skill.empty,#hotbar .skill.has,#hotbar .mini,#hotbar .page,
#pc-hud .pc-skill,#pc-hud .pc-skill.empty,#pc-hud .pc-flask{
 background:var(--ui-slot) center/100% 100% no-repeat!important;border:0!important;border-radius:0!important;box-shadow:none!important;color:#fcf4d9!important;
}
#belt .pot.empty{opacity:.68}
#hotbar .skill.has{background:var(--ui-slot) center/100% 100% no-repeat!important}
#hotbar #b-aim,#hotbar #b-page,#hotbar #b-portal{background:var(--ui-slot) center/100% 100% no-repeat!important;border:0!important;border-radius:0!important;box-shadow:none!important}
#b-page b,#b-page small{color:#fff3d2}
#b-chat{background:none!important;border-radius:0!important;box-shadow:none}
#b-atk{background:#12434b!important;border-color:#d3b56c!important;box-shadow:inset 0 0 0 3px #e1cea0,0 3px 8px #03272d77!important}
#b-atk::after{content:'';position:absolute;inset:-10%;background:var(--ui-ring) center/contain no-repeat;pointer-events:none}
#b-atk img.hi{position:relative;z-index:1}
#joy{border:2px solid #d3b875;background:#16515a35;box-shadow:inset 0 0 0 2px #e2d19a80,0 1px 6px #07373c55}
#joy .knob{background:#c9e4d58a var(--ui-ring) center/100% 100% no-repeat;border:0;box-shadow:none}
#h-menu .pill{background:#12434bef!important;color:#fff5dc!important;border-color:#c9aa66!important;border-radius:3px!important}
#h-menu .icons button:hover,#h-menu .icons button.on{filter:drop-shadow(0 0 5px #55dddc)}
#pc-hud .pc-skill .nm{color:#fff8e5;text-shadow:0 1px 2px #092a31}
#pc-hud kbd{background:#faf2d3;color:#143a3e;border-color:#c4a75e;border-radius:2px}
#hud .expbar{background:#123e43;border-color:#e3c36e}
#hud .expbar i{background:linear-gradient(#ffe8a1,#e5ac36)}
#chatbox,body.touch #chatbox{background:#123c43c9!important;border:1px solid #baa269;border-radius:3px;box-shadow:0 2px 7px #173c4266}
#chat-log{background:#0d313760;border:0;color:#fff5dc;text-shadow:0 1px 2px #08272c}
#chat-tabs button[data-ch]{background:#124650!important;border:1px solid #6c8c85;color:#f9f4de!important;border-radius:0!important}
#chat-tabs button[data-ch].on{background:#ece4bf!important;color:#173c3f!important;border-color:#c6a858}
#chat-grip{color:#d8c893}
#chat-row{background:#143f46;border-color:#aa955d}
#chat-row input{background:#0d3239;color:#fff6df;border-color:#83927b}
#chat-input::placeholder{color:#dae0ce}
#h-buffs,#toast,#pick-list,#patch-note{background:#17464c;color:#fff5db;border-color:#cbb475}
#toast{color:#fff5db}
#patch-note .pn-title,#patch-note .pn-title b,#patch-note .pn-title i{color:#fff5db}
#patch-note .pn-ok{background:linear-gradient(#ffe8a1,#dcb151);color:#193c3b;border:1px solid #f8e2a0;border-radius:3px}
.win header{background:var(--aether-teal);color:#fff6df;border:1px solid #bca666;padding:6px 9px;margin-bottom:12px}
.win header b{color:#fff6df}
.win .x,.rg-chips .x{background:var(--ui-slot) center/100% 100% no-repeat;border:0;border-radius:0;color:#fff9e4;box-shadow:none}
.win button:not(.x):not(.row):not(.cell):not(.ghost),.d-act button,#scr-login #btn-guest,#scr-login #btn-login,#scr-chars .char-primary{
 background:linear-gradient(#ffedb3,#e4bf68)!important;color:#183b3a!important;border-color:#aa8740!important;border-radius:2px!important;box-shadow:inset 0 0 0 2px #fff3c8,0 2px 3px #113a3d33!important;
}
.win button.ghost{background:#174a51;color:#fff5dc;border-color:#bca462;border-radius:2px}
.win .row{background:#f4f0de;border-color:#c5b787;border-radius:2px;color:#173d40}
.srow2{border-color:#cec29a;color:#264549}.srow2 select{border-color:#b6a16b;background:#faf5e2;color:#21474c}
.srow2 input[type=range],.srow2 input[type=checkbox]{accent-color:#267b7e}
.rg-chips{justify-self:stretch;align-self:stretch;align-items:center;background:var(--aether-teal);border:1px solid transparent;border-image:var(--ui-enamel) 100 fill / 22px;padding:0 14px;margin:-5px -6px 0;gap:8px}
.rg-title{font:700 23px/1.2 Kanit,'Noto Sans Thai',sans-serif;color:#fff6dc;margin:0 22px 0 6px}
.rg-chips button{border-radius:0;background:#174e56;color:#fff7df;border-color:#93a290}
.rg-chips button.on{background:linear-gradient(#fff5d2,#e5d8a9);color:#173e41;border-color:#d5b967}
.rg-chips button.on svg{color:#24585e}
.rg-chips .x{top:2px;right:8px}
.rg-left,.rg-right{border-color:#c7b886}
.rg-who{border-bottom:1px solid #c7b886;color:#23494c}
.rg-right>.cb-h{padding:5px 8px;background:#15474e;border:1px solid #c4ac68;color:#fff6dc;font-size:20px;min-height:36px;align-items:center}
.rg-right>.cb-h .bag-count{color:#e5e4cc}
.st-row{background:linear-gradient(110deg,#ede8d0,#faf6e5);border-color:#c7b98d;border-radius:2px;box-shadow:inset 0 0 0 2px #fffae980}
.st-plus{background:linear-gradient(#fff0b8,#d5bd7a);color:#233f3b;border-color:#b1975a;border-radius:4px;box-shadow:inset 0 0 0 2px #fff1c0}
.st-points{background:#f5efd8;border-color:#bdaa78;border-radius:2px}
.st-points b,.st-points.has b{background:#e5d6a4;color:#153e3e;border-color:#a8935c;border-radius:2px}
#inv .rg-halo{background:linear-gradient(#f1eedb99,#f1eedb77),url('../assets/ui/porcelain/daylight.webp') center/auto 100% no-repeat;border:1px solid #c0a05a;box-shadow:inset 0 0 0 7px #f1eedb,0 0 0 3px #e5d8b1}
#inv .rg-halo::before{border:1px solid #c4ad71;animation:none}
.wslot,.wslot:not(.filled){border:0;border-radius:0;background:var(--ui-slot) center/100% 100% no-repeat;box-shadow:none}
.wslot::after{display:none}
.wslot .ph{opacity:.5;filter:brightness(1.4)}
.wslot.filled{filter:drop-shadow(0 0 3px #8de0d8)}
.wslot.filled.r1,.wslot.filled.r2{box-shadow:none}
.bag-tabs button{background:#ede7ce;color:#224c4e;border-color:#bdae7f;border-radius:1px}
.bag-tabs button.on{background:#fff1b9;color:#174548;border-color:#c6a554}
.bag-grid .cell,.bag-grid .cell.empty{border-radius:0;border-color:#c6bd9c;background:#ded8bf;box-shadow:inset 0 0 0 1px #fff9e4;clip-path:polygon(5px 0,calc(100% - 5px) 0,100% 5px,100% calc(100% - 5px),calc(100% - 5px) 100%,5px 100%,0 calc(100% - 5px),0 5px)}
.bag-grid .cell.sel{outline:2px solid #e8b638;outline-offset:-2px;background:#fff0b9}
.bag-detail,.bag-zen,.dt-card,.dt-res{background:#f6f0da;border-color:#c7b781;border-radius:2px}
.rg-exp .exp{background:#18454b;border-color:#cfb66e;border-radius:0}
.rg-exp .exp i{background:linear-gradient(#ffdfa0,#e5ae3c)}
.itip .it-head{border-bottom-color:#bfa763}.itip .it-m{color:#216b87}.itip .it-m i{background:#278ab0;color:#fff;border-color:#8dc4cf;border-radius:2px}
#shop .shop-row{background:#f5f0dd;border-color:#c1b27c;border-radius:0}
#shop .shop-row.sel{background:#fff4ce;outline-color:#e3b637;box-shadow:inset 0 0 0 2px #fff7d4}
#shop .shop-item-name,#shop-sel b{color:#183c3f!important}
#scr-login #game-tagline{background:#123d47e6;color:#fff3ce;border:1px solid #c5a963}
#scr-login #login-tabs button{background:#184952;color:#fff4dc;border-radius:0}
#scr-login #login-tabs button.on{background:#eed795;color:#20464a}
#scr-chars .char-screen-header h2{background:#13464ee8;color:#fff5dc;border-color:#c9aa60;border-radius:2px}
#scr-chars .char-secondary{background:#154951;color:#fff4d7;border-color:#b89c61;border-radius:2px}
#scr-chars .char-slot-name{background:#174a53;color:#fff4db;border-color:#c4a45f;border-radius:2px}
#scr-chars .char-slot.is-selected .char-slot-name{background:#f5e2a3;color:#183e43;box-shadow:0 0 0 2px #ceae64}
#scr-chars .char-class,#scr-chars #class-pick .class-card{background:#f3edd6;border-color:#bdad7c;border-radius:2px}
#scr-chars .char-class.is-selected,#scr-chars #class-pick .class-card.sel{background:#d9e9dc;border-color:#3c8582;box-shadow:inset 0 0 0 1px #bba45e}
#dead{background:radial-gradient(ellipse,#102f3960,#061e2ce0)}
#dead span,#pick-list button,#patch-note .pn-list{background:#f1eedb!important;color:#183e42!important;border-color:#b8a36c!important;border-radius:2px!important}
#rotate-hint{background:#f1eedb var(--ui-frame) center/100% 100% no-repeat!important;color:#143f46}
@media(max-height:560px){
 #inv.bagwin{border-image-width:22px}
 .rg-title{font-size:16px;margin:0 8px 0 2px}
 .rg-chips{padding:0 4px;margin:0;gap:5px}.rg-chips .x{top:0;right:0}
 .rg-right>.cb-h{font-size:14px;min-height:28px;padding:2px 4px;gap:4px}
 .rg-right>.cb-h .bag-count{font-size:10px}
 #h-status{border-image-width:18px}
}

/* ---- town services (Claude 2026-09-30): salon colours, storage window ---- */
.salon-colors { display: grid; grid-template-columns: repeat(3, 56px); gap: 12px; justify-content: center; padding: 10px 0 14px; }
#travel .salon-colors button.swatch { width: 56px; height: 56px; min-width: 0; padding: 0; border-radius: 50% !important; border: 3px solid #fffaf0 !important;
  background: var(--c) !important; box-shadow: 0 0 0 1px #b99b62, 0 3px 8px #0003 !important; cursor: pointer; }
#travel .salon-colors button.swatch.cur { box-shadow: 0 0 0 3px #3a95c2, 0 3px 8px #0003 !important; cursor: default; }
.salon-colors .swatch.off { opacity: .4; cursor: not-allowed; }
#shop.storage .pr { display: none; }

/* stat "+" can be held down (repeats): no long-press menu / text selection on touch */
.st-plus { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
@media (max-height: 520px) {                       /* phone landscape: 9 colours in 2 rows so nothing is cut off */
  .salon-colors { grid-template-columns: repeat(5, 42px); gap: 10px; padding: 6px 0 10px; }
  #travel .salon-colors button.swatch { width: 42px; height: 42px; }
}

/* stat − (take points back to the class's starting value) + refund all (user 2026-09-30: "เพิ่มระบบลดค่าที่อัพไป") */
.st-list .st-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.st-pm { display: flex; align-items: center; gap: 4px; }
.st-pm .st-minus { width: 34px; height: 34px; padding: 0; font: 700 20px/1 Kanit, sans-serif; color: #233f3b; background: #efe7cf;
  border: 1px solid #b1975a; border-radius: 4px; box-shadow: inset 0 0 0 2px #fff6dc; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.st-pm .st-minus:hover:not(:disabled) { background: #fff3cc; }
.st-pm .st-minus:disabled { background: #e9e2d5; color: #bdb3a0; border-color: #d4c7af; box-shadow: none; cursor: default; }
.st-pm .st-sp-m { width: 34px; }
.st-points .st-reset { margin-left: auto; padding: 4px 10px; font: 600 12px/1.2 Kanit, sans-serif; color: #7a5a1c; background: #fffaf0;
  border: 1px solid #b1975a; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.st-points .st-reset:hover:not(:disabled) { background: #fff3cc; }
.st-points .st-reset.armed, .st-points .st-reset.armed:hover { background: #b03a2e; border-color: #7e271e; color: #fff; }
.st-points .st-reset:disabled { opacity: .45; cursor: default; }
@media (max-height: 560px) {
  .st-pm { gap: 3px; } .st-pm .st-minus, .st-pm .st-sp-m { width: 30px; } .st-pm .st-minus { height: 36px; font-size: 18px; }
  .st-points .st-reset { padding: 2px 6px; font-size: 11px; }
}
.st-points > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* loading screen between maps (user 2026-09-30); art assets/ui/loading/map<id>.webp, login painting as fallback */
#loadscr { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: flex-end; justify-content: center; background: #0b1a1c; transition: opacity .4s ease; }
#loadscr.hidden { display: none; }
#loadscr.out { opacity: 0; pointer-events: none; }
#loadscr .ls-art { position: absolute; inset: 0; background-size: cover; background-position: center; animation: ls-zoom 9s ease-out both; }
#loadscr .ls-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 24, 26, .05) 35%, rgba(8, 24, 26, .88) 100%); }
#loadscr .ls-box { position: relative; width: min(560px, 86vw); margin-bottom: max(26px, 7vh); text-align: center; color: #f4efdc; }
#loadscr .ls-name { display: block; font: 700 clamp(22px, 4vw, 36px)/1.2 Kanit, sans-serif; letter-spacing: .02em; text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }
#loadscr .ls-tip { display: block; margin: 6px 0 12px; font: 400 14px/1.45 Kanit, sans-serif; color: #dbe8e2; text-shadow: 0 1px 4px rgba(0, 0, 0, .75); }
#loadscr .ls-bar { height: 10px; border-radius: 6px; background: rgba(10, 30, 32, .75); border: 1px solid #bda162; overflow: hidden; box-shadow: inset 0 0 10px rgba(0, 0, 0, .6); }
#loadscr .ls-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #218d8e, #7fe3d6 60%, #f1d58a); box-shadow: 0 0 10px #7fe3d6; }
#loadscr.run .ls-bar i { animation: ls-fill 3.2s cubic-bezier(.2, .7, .3, 1) forwards; }
#loadscr.done .ls-bar i { animation: none; width: 100%; }
@keyframes ls-fill { from { width: 4%; } to { width: 88%; } }
@keyframes ls-zoom { from { transform: scale(1.07); } to { transform: scale(1); } }
@media (max-height: 520px) { #loadscr .ls-tip { font-size: 12px; margin: 3px 0 8px; } #loadscr .ls-bar { height: 8px; } }

/* ===================================================================== skill gems (2026-09-30, PoE-style)
 * #skills: slots 1-4 (gem, level, EXP, sockets) | detail of the selected gem | gems in the bag.
 * #jobs: the Mentor's path cards (damage / toughness / speed bars). Aether colours (cream, teal, gold). */
.gem-ic{display:block;width:100%;height:100%}
.gi{display:inline-grid;place-items:center;flex:none}
.bag-grid .cell svg.gem-ic,.wslot svg.gem-ic{width:74%;height:74%;position:absolute;inset:13%}
.bagwin i.lv.gl{color:#1f6f7a;font-size:10px}
#shop .shop-art svg.gem-ic{width:80%;height:80%;margin:auto}
#skills{position:fixed;left:50%;right:auto;top:50%;transform:translate(-50%,-50%);width:min(820px,96vw);max-height:min(94vh,640px);overflow:auto;z-index:8;padding:10px 14px 12px}
#skills header{gap:10px}
#skills .sw-job{margin-left:auto;margin-right:6px;font:600 13px Kanit,'Noto Sans Thai',sans-serif;color:#e8f3df}
#skills .sw-job em{font-style:normal;color:#ffe39a}
.sw-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:10px;align-items:start}
.sw-slots{display:grid;gap:7px}
.sw-slot{display:grid;grid-template-columns:22px 44px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:62px;padding:6px 9px;text-align:left;cursor:pointer;
  background:linear-gradient(100deg,#ece7cf,#faf6e6);border:1px solid #c7b98d;border-radius:3px;color:#173d40;box-shadow:inset 0 0 0 2px #fffae980}
.sw-slot.sel{border-color:#d4a23a;box-shadow:inset 0 0 0 2px #ffe9a6,0 0 0 2px #e8b63866}
.sw-slot.off{filter:grayscale(.75);opacity:.8}
.sw-slot.empty{grid-template-columns:22px 1fr;border-style:dashed;color:#6b7b72}
.sw-key{display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#15474e;color:#fff4d4;font:700 12px Kanit,sans-serif}
.sw-slot .gi{width:44px;height:44px;filter:drop-shadow(0 2px 3px #0003)}
.sw-info{display:grid;gap:2px;min-width:0}
.sw-info b{font:700 15px/1.15 Kanit,'Noto Sans Thai',sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sw-info small{font-size:11px;color:#58705f}
.sw-xp{display:block;height:5px;border-radius:3px;background:#d2cbb0;overflow:hidden;box-shadow:inset 0 0 0 1px #b8ab83}
.sw-xp>i{display:block;height:100%;background:linear-gradient(90deg,#8fd7c9,#2c9a8f)}
.sw-socks{display:flex;gap:4px}
.sw-socks i,.sw-sock i.sk-hole{display:block;width:18px;height:18px;border-radius:50%}
.sw-socks .sk-hole,.sw-sock .sk-hole{background:radial-gradient(circle at 45% 40%,#6d6457,#2d2a24);box-shadow:inset 0 1px 2px #000a,0 0 0 1.5px #bda66a}
.sw-socks .sk-lock{background:#cfc6a8;opacity:.45;box-shadow:inset 0 0 0 1.5px #b3a57c}
.sw-socks .sk-s svg{width:18px;height:18px;display:block}
.sw-socks .sk-s.bad{filter:grayscale(1);opacity:.6}
.sw-detail{min-height:250px;padding:9px 11px;background:#f6f0da;border:1px solid #c7b781;border-radius:2px;font-size:13px;color:#1d3f42}
.sw-dhead{display:flex;gap:10px;align-items:center;margin-bottom:6px}
.sw-dhead .gi.big{width:54px;height:54px;filter:drop-shadow(0 2px 4px #0004)}
.sw-dhead>div{display:grid;gap:2px;flex:1;min-width:0}
.sw-dhead b{font:700 18px/1.15 Kanit,'Noto Sans Thai',sans-serif;color:var(--gc,#173d40);text-shadow:0 1px 0 #fff}
.sw-dhead small{font-size:12px;color:#58705f}
.sw-tags{display:flex;flex-wrap:wrap;gap:4px;margin:4px 0 6px}
.sw-tags i{font-style:normal;font-size:11px;padding:1px 7px;border-radius:9px;background:#e1ecd9;color:#2b5b4e;border:1px solid #b8cfae}
.sw-desc{margin:4px 0 8px;line-height:1.45;color:#2d4a44}
.sw-stats,.sw-tip .it-body{display:grid;gap:2px}
.sw-r{display:flex;justify-content:space-between;gap:10px;padding:2px 0;border-bottom:1px dashed #d8ceae;font-size:12.5px}
.sw-r>span{color:#4d6358}
.sw-r>b{color:#15474e;font-weight:700;text-align:right}
.sw-r>b small{font-weight:500;color:#5e7064}
.sw-warn{margin:6px 0;padding:5px 8px;border-radius:3px;background:#fbe3dc;color:#a0321f;border:1px solid #eeb4a4;font-weight:600}
.sw-detail h5{margin:10px 0 5px;font:700 13px Kanit,'Noto Sans Thai',sans-serif;color:#15474e}
.sw-socklist{display:grid;gap:5px}
.sw-sock{display:flex;align-items:center;gap:8px;padding:4px 6px;background:#fffaf0;border:1px solid #d6caa0;border-radius:3px}
.sw-sock .gi{width:26px;height:26px}
.sw-sock b{flex:1;font-weight:600}
.sw-sock small{color:#5e7064}
.sw-sock.hole span{flex:1;color:#6b7b72}
.sw-sock button,.sw-acts button{min-height:34px!important;padding:3px 12px;font-size:13px}
.sw-picks{display:grid;gap:5px;margin-top:6px}
.sw-picks .row{display:flex;align-items:center;gap:8px;padding:5px 8px;min-height:40px;text-align:left}
.sw-picks .row .gi{width:26px;height:26px}
.sw-picks .row b{flex:1}
.sw-picks .row.off{opacity:.55}
.sw-acts{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;align-items:center}
.sw-acts.four button{flex:1;min-width:52px;font-size:17px}
.sw-hint{margin:8px 0 4px;color:#44625a;font-weight:600}
.sw-bag{margin-top:10px}
.sw-bag h4{margin:0 0 6px;font:700 13px Kanit,'Noto Sans Thai',sans-serif;color:#15474e}
.sw-chips{display:flex;flex-wrap:wrap;gap:6px}
.sw-chip{display:flex;align-items:center;gap:5px;padding:3px 9px 3px 4px;min-height:36px;border-radius:18px;border:1px solid #c7b98d;background:#fbf7e8;color:#173d40;font-size:12.5px;cursor:pointer}
.sw-chip .gi{width:26px;height:26px}
.sw-chip i{font-style:normal;font-size:11px;color:#5e7064}
.sw-chip.sel{border-color:#d4a23a;background:#fff0b9;box-shadow:0 0 0 2px #e8b63855}
.sw-chip.support{border-radius:6px}
.sw-tip{min-width:250px;max-width:330px}
.sw-tip .it-head{display:flex;align-items:center;gap:8px}
.sw-tip .it-head .gi{width:30px;height:30px}
.sw-tip .it-head b{color:var(--gc,#173d40)}
.sw-tip .it-head .sw-lv{margin-left:auto;font-size:12px;color:#5e7064}
.sw-xprow{margin-top:4px}
/* hotbar + PC dock: the gem behind the skill's name */
#hotbar .skill .gi,#pc-hud .pc-skill .gi{position:absolute;inset:10%;z-index:1;pointer-events:none;filter:drop-shadow(0 0 3px #fff8)}
#hotbar .skill .gi svg,#pc-hud .pc-skill .gi svg{width:100%;height:100%}
#hotbar .skill.has .nm,#pc-hud .pc-skill.has .nm{text-shadow:0 1px 2px #062a2f,0 0 4px #062a2f}
#hotbar .skill.off,#pc-hud .pc-skill.off{filter:grayscale(1);opacity:.6}
#hotbar .skill.nomp .gi,#pc-hud .pc-skill.nomp .gi{filter:saturate(.3) brightness(.7)}
/* the Mentor: paths */
#jobs{position:fixed;left:50%;right:auto;top:50%;transform:translate(-50%,-50%);width:min(980px,97vw);max-height:min(95vh,640px);overflow:auto;z-index:8;padding:10px 14px 12px}
.jw-hint{margin:0 4px 8px;color:#44625a;font-weight:600}
.jw-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}
.jw-card{display:flex;flex-direction:column;gap:6px;padding:9px 10px;background:linear-gradient(170deg,#faf6e6,#ece6cc);border:1px solid #c7b98d;border-radius:3px;color:#173d40;box-shadow:inset 0 0 0 2px #fffae980}
.jw-card.cur{border-color:#2c9a8f;box-shadow:inset 0 0 0 2px #bfeee4,0 0 0 2px #2c9a8f55}
.jw-card h4{margin:0;font:700 17px/1.2 Kanit,'Noto Sans Thai',sans-serif;color:#15474e}
.jw-wt{color:#6b5a2c;font-weight:600}
.jw-bars{display:grid;grid-template-columns:auto 1fr;gap:3px 8px;align-items:center;font-size:12px}
.jw-bars label{color:#4d6358}
.jw-bar{display:flex;gap:3px}
.jw-bar i{flex:1;height:8px;border-radius:2px;background:#d8d0b3;box-shadow:inset 0 0 0 1px #bcae85}
.jw-bar i.on{background:linear-gradient(#ffd97a,#d99a2a);box-shadow:inset 0 0 0 1px #a8761c}
.jw-card p{margin:0;font-size:12.5px;line-height:1.45;color:#2d4a44;flex:1}
.jw-skills,.jw-bonus{list-style:none;margin:0;padding:0;display:grid;gap:3px;font-size:12.5px}
.jw-skills li{display:flex;align-items:center;gap:6px}
.jw-skills svg{width:18px;height:18px;flex:none}
.jw-bonus li b{color:#1f7a55}
.jw-card button{min-height:40px!important;margin-top:4px}
.jw-card button.armed{background:linear-gradient(#ffd0a8,#e98a4a)!important}
.jw-cur{display:block;text-align:center;padding:9px 0;font-weight:700;color:#1f7a6e}
#jobs footer{margin-top:10px;align-items:center}
#jobs footer button{min-height:40px!important;padding:4px 16px}
@media (max-height:520px){
  #skills,#jobs{top:calc(6px + env(safe-area-inset-top));transform:translateX(-50%);max-height:calc(100vh - 12px)}
  .sw-slot{min-height:52px;padding:4px 8px}.sw-slot .gi{width:36px;height:36px}.sw-slot{grid-template-columns:22px 36px minmax(0,1fr) auto}
  .sw-detail{min-height:0}
  .jw-cards{grid-template-columns:repeat(5,minmax(160px,1fr));overflow-x:auto}
  .jw-card p{font-size:12px}
}
@media (max-width:640px){ .sw-body{grid-template-columns:1fr} }

/* ---- town portal button (T; server portal.js): inner ring of the phone arc, next to the PC dock's skills menu.
   A cooldown sweep like the skills; greyed out in towns (no portals there). */
#hotbar #b-portal, #pc-hud #pm-portal { overflow: hidden; }
#hotbar #b-portal .cd, #pc-hud #pm-portal .cd { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; z-index: 2; }
#hotbar #b-portal .hi { width: 64%; height: 64%; position: relative; z-index: 1; filter: drop-shadow(0 1px 2px #1a0a4a88); }
#hotbar #b-portal.off, #pc-hud #pm-portal.off { filter: grayscale(.85); opacity: .55; }

/* Sitting (RO style, 2026-09-30): phone menu #m-sit + PC dock #pm-sit (Insert). Our SVG icon among the painted ones:
   same size as the porcelain icons, and a clear "on" look while sitting. */
#h-menu .icons #m-sit svg.hi { width: 38px; height: 38px; }
#h-menu .icons #m-sit.on svg.hi, #pc-hud #pm-sit.on svg.hi { filter: drop-shadow(0 0 5px #55dddc) drop-shadow(0 0 2px #55dddc); transform: translateY(2px) scale(.94); }

/* skill window v2 (POE style, 2026-10-01): 8 rows with sockets + DPS | detail with the server's numbers by section */
#skills{width:min(1040px,97vw);max-height:min(95vh,720px)}
#skills .sw-body{grid-template-columns:minmax(0,1.05fr) minmax(0,1fr)}
.sw-slots{gap:5px;align-content:start}
.sw-colhead{display:grid;grid-template-columns:22px 44px minmax(0,1fr) 112px 64px;gap:8px;padding:0 9px;font:600 11px Kanit,'Noto Sans Thai',sans-serif;color:#6b7b72;letter-spacing:.04em}
.sw-colhead span:first-child{grid-column:1/4}
.sw-colhead span:last-child{text-align:right}
.sw-slot{grid-template-columns:22px 44px minmax(0,1fr) 112px 64px;min-height:56px;padding:5px 9px}
.sw-slot .sw-socks{gap:3px;justify-content:flex-start}
.sw-slot .sw-socks i{width:19px;height:19px}
.sw-dps{display:grid;justify-items:end;line-height:1.05}
.sw-dps b{font:700 17px Kanit,sans-serif;color:#b2461c;font-variant-numeric:tabular-nums}
.sw-dps small{font:600 10px Kanit,sans-serif;color:#6b7b72;letter-spacing:.08em}
.sw-slot.empty{grid-template-columns:22px 1fr}
.sw-slot.empty .sw-empty{font-size:12.5px}
.gi img.skic{width:100%;height:100%;object-fit:contain;border-radius:6px;display:block}
.sw-bigs{display:grid;grid-template-columns:repeat(auto-fit,minmax(78px,1fr));gap:6px;margin:6px 0 8px}
.sw-big{display:grid;gap:1px;padding:6px 8px;border-radius:4px;background:#fffaf0;border:1px solid #d6caa0;text-align:center}
.sw-big small{font:600 10.5px Kanit,'Noto Sans Thai',sans-serif;color:#6b7b72}
.sw-big b{font:700 18px/1.1 Kanit,sans-serif;color:#15474e;font-variant-numeric:tabular-nums}
.sw-big b i{font-style:normal;font-size:11px;margin-left:2px;color:#5e7064}
.sw-big.dps{background:linear-gradient(180deg,#fff3dc,#ffe5bd);border-color:#e0a860}
.sw-big.dps b{color:#b2461c;font-size:22px}
.sw-secs{display:grid;gap:8px}
.sw-sec h6{margin:0 0 3px;padding-bottom:2px;font:700 12.5px Kanit,'Noto Sans Thai',sans-serif;color:#7a5a1c;border-bottom:2px solid #e3c98a;letter-spacing:.02em}
.sw-sec .sw-r>b{color:var(--ec,#15474e);font-variant-numeric:tabular-nums}
.sw-sec .sw-r>span{color:#4d6358}
.sw-wait{padding:10px 0}
.sw-sock{align-items:flex-start}
.sw-sock>div{flex:1;min-width:0}
.sw-sock>div p{margin:1px 0 0;font-size:11.5px;color:#5e7064;line-height:1.35}
.sw-sock.bad{opacity:.6;filter:grayscale(.6)}
.sw-acts.eight{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:5px}
.sw-acts.eight button{min-width:0;font-size:16px;padding:3px 0}
.sw-chip.star{box-shadow:0 0 0 2px #f2c14e88}
.sw-dhead small{font-size:12px}
@media (max-width:760px){
  #skills .sw-body{grid-template-columns:1fr}
  .sw-colhead{display:none}
  .sw-slot{grid-template-columns:22px 38px minmax(0,1fr) auto;grid-template-rows:auto auto;min-height:50px}
  .sw-slot .gi{width:38px;height:38px}
  .sw-slot .sw-socks{grid-column:3/4;grid-row:2}
  .sw-slot .sw-dps{grid-column:4;grid-row:1/3}
}
/* phone skill bar: the page button flips 1-4 / 5-8 */
body.touch #b-page{display:grid}
.sw-socks .sk-s img.skic{width:19px;height:19px;border-radius:50%}
