:root {
  --bg: #120e0c;
  --bezel: #2a1c14;
  --bezel-hi: #3d291c;
  --cream: #f4efe4;
  --muted: #cbbba6;
  --gold: #f0c14a;
  --sky: #5c94fc;
  --danger: #e4453a;
  --ink: #1b140f;
  font-family: "Tahoma", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at top, #2b1b12 0%, transparent 52%),
    repeating-linear-gradient(90deg, #15100d 0 16px, #110d0b 16px 32px);
  color: var(--cream);
  touch-action: none;
}

html.touch-on,
html.touch-on body,
html.mumu-immersive,
html.mumu-immersive body,
body.touch-on,
body.mumu-immersive {
  /* lvh = large viewport — mic permission / URL chrome must not shrink the stage */
  height: 100%;
  height: 100vh;
  height: 100lvh;
  max-height: none;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
}

html.touch-on #fit,
body.touch-on #fit,
html.mumu-immersive #fit,
body.mumu-immersive #fit {
  padding: 0;
  gap: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100lvh;
}

body {
  min-height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding: 0;
}

#fit {
  position: relative;
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  gap: 12px;
  padding: 8px 10px;
}

#keys-help {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  width: 188px;
  max-height: 96vh;
  padding: 10px 10px 8px;
  background: rgba(18, 12, 9, 0.92);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  color: var(--cream);
  pointer-events: none;
  overflow: hidden;
}

.help-support {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 2px solid #000;
  background: transparent;
  color: inherit;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
}

.help-support .support-qr-frame {
  max-width: 148px;
  margin: 0 auto;
  padding: 4px;
}

.help-support .support-qr-frame img {
  max-height: min(148px, 22vh);
  object-fit: contain;
}

.help-support .support-note {
  margin: 6px 0 0;
}

.keys-title {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

#keys-help ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#keys-help li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  color: #f4efe4;
}

#keys-help .keys {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

#keys-help kbd {
  display: inline-block;
  min-width: 18px;
  padding: 2px 5px;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font: 700 11px Tahoma, sans-serif;
  box-shadow: 1px 1px 0 #000;
  text-align: center;
}

#support-card {
  display: none;
  flex: 0 0 auto;
  width: 150px;
  max-height: 92vh;
  padding: 10px 8px 8px;
  background: rgba(18, 12, 9, 0.88);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  color: var(--cream);
  text-align: center;
}

.support-qr-frame {
  background: #fff;
  border: 2px solid #000;
  padding: 6px;
  box-shadow: 2px 2px 0 #000;
}

.support-qr-frame img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}

.support-note {
  margin: 8px 0 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

#right-col {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  width: 188px;
  max-height: 96vh;
  min-height: 0;
}

#dev-note {
  display: none;
  flex: 0 1 auto;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: 0;
  max-height: none;
  padding: 12px 12px 10px;
  background: rgba(18, 12, 9, 0.92);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  color: var(--cream);
  text-align: center;
  cursor: pointer;
  overflow: auto;
  appearance: none;
  font: inherit;
  -webkit-user-select: none;
  user-select: none;
}

#dev-note p {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--cream);
}

#dev-note p:last-child {
  margin-bottom: 0;
}

#dev-note .dev-kao,
.dev-note-copy .dev-kao {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

#dev-note .dev-thanks,
.dev-note-copy .dev-thanks {
  margin-top: 8px;
  color: var(--gold);
}

.dev-note-copy {
  margin: 10px 0 0;
  color: var(--cream);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

#emote-pad {
  flex: 0 0 auto;
  padding: 8px 8px 10px;
  background: rgba(18, 12, 9, 0.92);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
}

#emote-pad .keys-title {
  margin-bottom: 8px;
  text-align: center;
}

.emote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.emote-grid button,
.emote-cluster button {
  appearance: none;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font: 700 11px Tahoma, sans-serif;
  padding: 6px 4px 5px;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  line-height: 1.2;
}

.emote-grid button span:last-child {
  display: block;
  margin-top: 3px;
  color: #8a6048;
  font-size: 10px;
  font-weight: 700;
}

.emote-grid button span:first-child {
  display: inline;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.emote-grid button:hover,
.emote-cluster button:hover {
  background: #f0c14a;
}

.emote-grid button:active,
.emote-cluster button:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

#support-dock,
#shop-dock {
  position: fixed;
  left: max(8px, env(safe-area-inset-left));
  top: max(8px, env(safe-area-inset-top));
  z-index: 36;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  transform: scale(var(--pad-s, 1));
  transform-origin: top left;
  pointer-events: auto;
  max-width: min(96vw, 640px);
}

#support-dock[hidden],
#shop-dock[hidden] {
  display: none !important;
}

#btn-support {
  position: relative;
  left: auto;
  top: auto;
  z-index: 1;
  appearance: none;
  box-sizing: border-box;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
  box-shadow: 2px 2px 0 #000;
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

#btn-support[hidden] {
  display: none !important;
}

#fs-shop {
  display: none !important;
  box-sizing: border-box;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  background: rgba(12, 8, 6, 0.86);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  min-height: 34px;
  height: 34px;
  padding: 0 8px;
  white-space: nowrap;
}

body.touch-on #fs-shop.is-on,
body.touch-on #fs-shop.is-on[hidden] {
  display: flex !important;
}

.fs-shop-pts,
.fs-shop-cred {
  color: #f4efe4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  line-height: 1;
}

.fs-shop-pts b,
.fs-shop-cred b {
  color: #f0c14a;
  font-size: 13px;
}

#fs-shop-redeem,
#fs-shop-auth,
#fs-shop-mail {
  appearance: none;
  box-sizing: border-box;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  min-height: 26px;
  height: 26px;
  padding: 0 8px;
  box-shadow: 1px 1px 0 #000;
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

#fs-shop-auth {
  background: #f4efe4;
}

#fs-shop-mail {
  position: relative;
  background: #2a1c14;
  color: #f4efe4;
  padding-right: 10px;
}

/* Only while in a stage (not title / character customize) */
body.touch-on:not(.mumu-in-stage) #fs-shop-mail,
body.touch-on.look-open #fs-shop-mail {
  display: none !important;
}

#fs-shop-mail[hidden] {
  display: none !important;
}

.fs-shop-mail-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: #e4453a;
  color: #fff;
  border: 2px solid #000;
  font-size: 9px;
  font-weight: 800;
  line-height: 10px;
  text-align: center;
  box-sizing: border-box;
}

.fs-shop-mail-badge[hidden] {
  display: none !important;
}

#fs-shop-redeem:disabled {
  opacity: 0.55;
}

#support-overlay {
  position: fixed;
  inset: 0;
  z-index: 43;
  background: rgba(12, 8, 6, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top, 0px)) 12px max(8px, env(safe-area-inset-bottom, 0px));
  touch-action: pan-y;
}

#support-overlay[hidden] {
  display: none !important;
}

.support-sheet {
  width: min(360px, 94vw);
  max-height: min(92vh, 560px);
  overflow-y: auto;
  background: #2a1c14;
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
  padding: 8px 10px 12px;
  text-align: center;
}

/* Support title: always one line (TH + EN) */
#support-overlay .look-sheet-bar {
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
}

#support-overlay .look-sheet-bar > b {
  flex: 1 1 auto;
  max-width: none;
  margin: 0;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
}

#support-overlay .look-sheet-bar > b::before,
#support-overlay .look-sheet-bar > b::after {
  display: none;
}

#support-overlay #btn-support-close {
  flex-shrink: 0;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

.support-sheet .support-qr-frame {
  width: min(168px, 72vw);
  max-width: 100%;
  margin: 0 auto;
  padding: 5px;
}

.support-sheet .support-qr-frame img {
  width: 100%;
  max-width: 168px;
  max-height: min(168px, 36vh);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.support-save-btn {
  appearance: none;
  display: inline-block;
  margin: 8px auto 0;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  font-weight: 800;
  font-size: 12px;
  padding: 6px 12px;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}

.support-save-btn:disabled {
  opacity: 0.65;
}

.support-thanks {
  margin: 8px 0 0;
  color: #f0c14a;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}

.support-thanks .dev-kao {
  display: block;
  margin: 4px 0 2px;
  font-size: 16px;
  color: #fff6e8;
}

.support-thanks .dev-thanks {
  display: block;
  font-size: 12px;
  color: #ffd6e8;
}

@media (max-height: 480px) {
  .support-sheet {
    width: min(220px, 78vw);
    padding: 6px 8px 8px;
  }
  .support-sheet .support-qr-frame {
    width: min(120px, 42vw);
  }
  .support-sheet .support-qr-frame img {
    max-width: 120px;
    max-height: min(120px, 28vh);
  }
  .support-thanks {
    font-size: 12px;
    margin-top: 6px;
  }
  .support-thanks .dev-kao {
    font-size: 14px;
  }
}

#app {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
}

#bezel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  background: linear-gradient(180deg, var(--bezel-hi), var(--bezel));
  border: 4px solid #120c09;
  box-shadow:
    0 0 0 2px #6a4a32,
    0 18px 40px rgba(0, 0, 0, 0.45);
  padding: 6px 6px 8px;
}

.topbar {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 2px 6px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.14em;
  text-shadow: 2px 2px 0 #000;
}

.ears {
  width: 22px;
  height: 16px;
  background: #fff6e8;
  clip-path: polygon(0 100%, 18% 0, 42% 100%, 58% 100%, 82% 0, 100% 100%);
  filter: drop-shadow(1px 1px 0 #000);
}

#stage {
  position: relative;
  background: #000;
  border: 3px solid #0b0705;
  overflow: hidden;
  width: 320px;
  height: 240px;
  flex: none;
  margin: 0 auto;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--sky);
}

#game:focus {
  outline: none;
}

#name-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.name-tag {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: 0;
  text-align: center;
  text-shadow:
    -1px -1px 0 #1b140f,
    1px -1px 0 #1b140f,
    -1px 1px 0 #1b140f,
    1px 1px 0 #1b140f;
}

.name-tag .name-lv {
  display: block;
  margin: 0 auto 1px;
  padding: 0 4px 1px;
  width: fit-content;
  max-width: 100%;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: #1b140f;
  background: #f0c14a;
  border: 2px solid #1b140f;
  box-shadow: 1px 1px 0 #1b140f;
  text-shadow: none;
  image-rendering: pixelated;
}

.name-tag .name-title {
  font-weight: 800;
  color: #6a2010;
}

.name-tag .name-lv-num {
  font-weight: 800;
  color: #f0c14a;
  letter-spacing: 0.02em;
}

.name-tag .name-line {
  display: inline;
}

.name-tag .haha-spk,
.name-tag .mic-spk {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(12, 8, 6, 0.45);
  color: #fff6e8;
  line-height: 0;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: 0 0 0 1px #1b140f;
  overflow: visible;
}

.name-tag .haha-spk .tag-ico,
.name-tag .mic-spk .tag-ico {
  display: block;
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
}

.name-tag .haha-spk.is-on,
.name-tag .mic-spk.is-on {
  color: #f0c14a;
  background: rgba(12, 8, 6, 0.62);
}

.name-tag .haha-spk.is-muted,
.name-tag .mic-spk.is-muted {
  color: #9a8f82;
  opacity: 0.92;
}

.name-tag .mic-spk.is-on {
  color: #7dcc5c;
}

.name-tag .mic-spk .mic-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 1px solid rgba(125, 204, 92, 0.55);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}

.name-tag .mic-spk .mic-wave--2 {
  border-color: rgba(240, 193, 74, 0.4);
}

.name-tag .mic-spk.is-talking .mic-wave {
  animation: mumu-mic-wave 1.05s ease-out infinite;
}

.name-tag .mic-spk.is-talking .mic-wave--2 {
  animation-delay: 0.35s;
}

@keyframes mumu-mic-wave {
  0% {
    opacity: 0.55;
    transform: scale(0.75);
  }
  70% {
    opacity: 0.12;
    transform: scale(1.85);
  }
  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

@media (max-height: 640px) {
  body {
    padding: 4px;
  }

  #bezel {
    padding: 4px 4px 6px;
  }

  .topbar {
    padding: 0 4px 4px;
  }

  .brand h1 {
    font-size: 16px;
  }
}

#hud {
  position: absolute;
  top: 8px;
  left: 0;
  right: auto;
  display: block;
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #000, 0 0 4px #000;
  pointer-events: none;
  color: #fff;
}

.hud-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px 5px;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

#hud b {
  color: var(--gold);
}

#hud-fire {
  color: #f0c14a;
  font-weight: 700;
}

#hud-credits {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 4;
  font-size: 12px;
  line-height: 1.35;
  font-weight: bold;
  text-align: right;
  text-shadow: 1px 1px 0 #1b140f, 0 0 4px #1b140f;
  pointer-events: none;
  white-space: normal;
}
#hud-wc-hint,
#hud-points-line {
  white-space: nowrap;
}
#hud-wc-hint.hud-players-total {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.28em;
  color: #fff6e8;
  letter-spacing: 0.02em;
}
#hud-wc-hint .hud-players-label,
#hud-wc-hint .hud-players-unit {
  color: #fff6e8;
  font-weight: 700;
}
#hud-wc-hint .hud-players-num {
  color: #f0c14a;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 1px 1px 0 #1b140f, 0 0 5px rgba(240, 193, 74, 0.35);
}
#hud-rank {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 700;
  color: #f4efe4;
  text-align: right;
}
#hud-rank[hidden] {
  display: none !important;
}
.hud-rank-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.hud-rank-row .c-n {
  color: #cbbba6;
  flex: 0 0 auto;
}
.hud-rank-row .c-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5em;
}
.hud-rank-row .c-score {
  color: #f0c14a;
  min-width: 3.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hud-rank-row.r1,
.hud-rank-row.r1 .c-n,
.hud-rank-row.r1 .c-name,
.hud-rank-row.r1 .c-score {
  color: #f0c14a;
}
.hud-rank-row.me .c-name {
  color: #fff6e8;
}
.hud-rank-row.empty,
.hud-rank-row.empty .c-n,
.hud-rank-row.empty .c-name,
.hud-rank-row.empty .c-score {
  color: #cbbba6;
  opacity: 0.7;
}
#hud-wc-hint {
  color: #fff6e8;
}
body.touch-on #hud,
#fit.touch-on #hud {
  top: 4px;
  left: 0;
  font-size: 8px;
  line-height: 1.2;
}

body.touch-on .hud-stack,
#fit.touch-on .hud-stack {
  padding: 2px 5px 2px;
  gap: 0;
  background: rgba(0, 0, 0, 0.45);
}

body.touch-on #hud-credits,
#fit.touch-on #hud-credits {
  top: 4px;
  right: 4px;
  font-size: 8px;
  line-height: 1.2;
}

body.touch-on #hud-rank,
#fit.touch-on #hud-rank {
  margin-top: 2px;
  font-size: 8px;
  line-height: 1.2;
}

body.touch-on #hud-wc-hint,
#fit.touch-on #hud-wc-hint {
  display: flex;
  font-size: 9px;
  gap: 0.2em;
}
#hud[hidden],
.menu-card[hidden],
.touch-side[hidden],
#rotate-hint[hidden] {
  display: none !important;
}

#menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 8;
}

.menu-card {
  pointer-events: auto;
  touch-action: manipulation;
  text-align: center;
  background: rgba(12, 8, 6, 0.84);
  border: 2px solid #000;
  padding: 16px 18px 14px;
  min-width: 200px;
  box-shadow: 4px 4px 0 #000;
}

#menu-resume .resume-warn-body {
  margin: 8px 0 6px;
  line-height: 1.45;
}
body.touch-on #menu-resume,
#fit.touch-on #menu-resume {
  width: min(300px, 94%);
  padding: 12px 12px 12px;
  text-align: center;
}
body.touch-on #menu-resume .kicker,
body.touch-on #menu-resume h2,
body.touch-on #menu-resume .resume-warn-body,
body.touch-on #menu-resume .stat,
body.touch-on #menu-resume .btn,
#fit.touch-on #menu-resume .kicker,
#fit.touch-on #menu-resume h2,
#fit.touch-on #menu-resume .resume-warn-body,
#fit.touch-on #menu-resume .stat,
#fit.touch-on #menu-resume .btn {
  text-align: center;
}
body.touch-on #menu-resume .resume-warn-body,
#fit.touch-on #menu-resume .resume-warn-body {
  font-size: 12px;
  line-height: 1.5;
  text-wrap: balance;
}

#menu-title {
  max-height: 92%;
  overflow-y: auto;
  min-width: 232px;
}

body.touch-on #menu-title {
  max-height: 96%;
  width: min(300px, 94%);
  padding: 10px 12px 12px;
}

#look-panel {
  margin: 0 0 10px;
  text-align: center;
}

#btn-look,
.btn-look-edit {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  background: #f4efe4;
}

#btn-look {
  margin: 0 0 10px;
}

#btn-look[hidden],
.btn-look-edit[hidden] {
  display: none !important;
}

#look-overlay {
  /* Mobile default: full iframe above pads. PC look-desktop scopes to #bezel. */
  position: fixed;
  inset: 0;
  z-index: 220;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(61, 41, 28, 0.55) 0%, transparent 55%),
    rgba(12, 8, 6, 0.94);
  display: flex;
  align-items: stretch;
  justify-content: center;
  touch-action: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  border-radius: 0;
}

html.look-desktop #look-overlay,
body.look-desktop #look-overlay {
  /* PC only: cover game bezel — keep keys / notes visible */
  position: absolute;
  z-index: 80;
  padding: 0;
}

#look-overlay[hidden] {
  display: none !important;
}

.look-sheet {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, #2a1c14 0%, #1a120e 28%, #15100d 100%);
  border: none;
  padding: 0 8px;
  box-sizing: border-box;
  color: var(--cream);
}

.look-sheet-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 10px 8px;
  font-size: 16px;
  position: relative;
  gap: 8px;
  min-height: 44px;
}

.look-sheet-bar > b[data-i18n="lookTitle"],
.look-sheet-bar > b.look-title-tip,
.look-sheet-bar > b:not(.look-credits-bar b) {
  position: relative;
  color: #f0c14a;
  font: 800 14px/1.35 Tahoma, "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  letter-spacing: 0.02em;
  /* Thick black outline — MUMU pixel stamp style */
  -webkit-text-stroke: 0;
  paint-order: stroke fill;
  text-shadow:
    -2px -2px 0 #000,
     0   -2px 0 #000,
     2px -2px 0 #000,
    -2px  0   0 #000,
     2px  0   0 #000,
    -2px  2px 0 #000,
     0    2px 0 #000,
     2px  2px 0 #000,
    -1px -2px 0 #000,
     1px -2px 0 #000,
    -2px -1px 0 #000,
     2px -1px 0 #000,
    -2px  1px 0 #000,
     2px  1px 0 #000,
    -1px  2px 0 #000,
     1px  2px 0 #000,
     3px  3px 0 #000;
  padding: 2px 32px;
  flex: 1 1 auto;
  max-width: min(720px, calc(100% - 160px));
  margin: 0 auto;
  text-align: center;
  white-space: normal;
}

.look-credits-bar {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 4px 8px;
  max-width: min(42%, 200px);
  background: linear-gradient(180deg, #4a3426 0%, #2a1c14 100%);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000, inset 0 0 0 1px rgba(240, 193, 74, 0.25);
  color: #f0c14a;
  font: 800 13px/1.15 Tahoma, sans-serif;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
  z-index: 6;
}

.look-credits-bar b {
  color: #fff6e8;
  font-weight: 800;
  font-size: 14px;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
  padding: 0;
}

.look-credits-colon {
  margin-right: 2px;
  color: #f0c14a;
}

.look-cos-shop-btn {
  margin-left: 8px;
  padding: 3px 8px;
  font: 800 11px/1 Tahoma, sans-serif;
  color: #1b140f;
  background: linear-gradient(180deg, #ffe56a 0%, #f0c14a 100%);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  white-space: nowrap;
}
.look-cos-shop-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

.look-pick.locked {
  opacity: 0.72;
  position: relative;
  padding-right: 18px;
}
.look-pick-lock {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  line-height: 1;
}

#cos-shop-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 8, 6, 0.72);
  padding: 10px;
}
html:not(.look-desktop) #cos-shop-overlay,
body:not(.look-desktop) #cos-shop-overlay {
  position: fixed;
  z-index: 230;
}
#cos-shop-overlay[hidden] { display: none !important; }
.cos-shop-sheet {
  width: min(560px, 96%);
  max-height: 92%;
  overflow: auto;
  background: linear-gradient(180deg, #4a3426 0%, #2a1c14 100%);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000, inset 0 0 0 1px rgba(240, 193, 74, 0.28);
  color: #fff6e8;
  font: 800 12px/1.35 Tahoma, sans-serif;
}
.cos-shop-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 2px solid #000;
}
.cos-shop-bar b {
  flex: 1;
  color: #f0c14a;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
}
.cos-shop-cred-line b { color: #fff6e8; }
#btn-cos-shop-close {
  padding: 4px 10px;
  font: inherit;
  font-weight: 800;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}
.cos-shop-hint {
  margin: 8px 10px 0;
  color: #f0c14a;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
}
.cos-shop-body {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 8px;
  padding: 10px;
}
.cos-shop-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}
.cos-shop-card {
  text-align: left;
  padding: 8px;
  border: 2px solid #000;
  background: #1b140f;
  color: #fff6e8;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  font: inherit;
}
.cos-shop-card b { display: block; color: #f0c14a; }
.cos-shop-card i { display: block; font-style: normal; opacity: 0.85; font-size: 11px; }
.cos-shop-card span { display: block; margin-top: 4px; color: #80d010; }
.cos-shop-card.on {
  outline: 2px solid #f0c14a;
}
.cos-shop-card.owned span { color: #7ec8ff; }
.cos-shop-detail {
  border: 2px solid #000;
  background: #241810;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(240, 193, 74, 0.2);
  min-height: 220px;
}
.cos-detail-preview {
  margin: 0 0 10px;
  text-align: center;
}
.cos-detail-preview-stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 168px;
  height: 112px;
  border: 2px solid #000;
  background:
    linear-gradient(180deg, rgba(255, 246, 232, 0.08), transparent 40%),
    #3a7ae0;
  box-shadow: 2px 2px 0 #000, inset 0 0 0 1px rgba(240, 193, 74, 0.35);
  image-rendering: pixelated;
  overflow: hidden;
}
.cos-detail-preview-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  background: #80d010;
  border-top: 2px solid #000;
  pointer-events: none;
}
#cos-shop-preview {
  width: 144px;
  height: 96px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: relative;
  z-index: 1;
}
.cos-detail-preview-kao {
  position: absolute;
  right: 4px;
  bottom: 16px;
  z-index: 2;
  font-size: 9px;
  color: #fff6e8;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
  pointer-events: none;
  opacity: 0.9;
}
.cos-detail-preview-label {
  margin: 6px 0 0;
  color: #f0c14a;
  font-size: 11px;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
}
.cos-detail-head b {
  display: block;
  color: #f0c14a;
  font-size: 15px;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
}
.cos-detail-head i {
  display: block;
  font-style: normal;
  color: #ffe56a;
  margin-top: 2px;
}
.cos-detail-desc { margin: 8px 0; color: #fff6e8; }
.cos-detail-perks {
  margin: 0 0 10px;
  padding: 8px;
  border: 2px solid #000;
  background: #1b140f;
  box-shadow: inset 0 0 0 1px rgba(240, 193, 74, 0.18);
}
.cos-detail-perks > b {
  display: block;
  color: #f0c14a;
  margin-bottom: 6px;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
}
.cos-detail-perks ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.cos-detail-perks li {
  position: relative;
  padding: 3px 0 3px 16px;
  color: #fff6e8;
  font-size: 11px;
  line-height: 1.35;
}
.cos-detail-perks li::before {
  content: "ฅ";
  position: absolute;
  left: 0;
  top: 3px;
  color: #ff8ec8;
  text-shadow: -1px -1px 0 #000, 1px 1px 0 #000;
}
.cos-detail-price { color: #80d010; margin: 0 0 10px; }
.cos-buy-btn {
  width: 100%;
  padding: 8px 10px;
  font: 800 13px/1 Tahoma, sans-serif;
  border: 2px solid #000;
  background: linear-gradient(180deg, #93c47d 0%, #6aa84f 100%);
  color: #1b140f;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}
.cos-buy-btn:disabled {
  background: #5a5048;
  color: #c8c0b8;
  cursor: not-allowed;
}
@media (max-width: 640px) {
  .cos-shop-body { grid-template-columns: 1fr; }
  .cos-shop-list { max-height: 140px; flex-direction: row; overflow-x: auto; }
  .cos-shop-card { min-width: 120px; flex: 0 0 auto; }
}

/* soft cat-ear marks beside title — cute window, not menu emoji */
.look-sheet-bar > b::before,
.look-sheet-bar > b::after {
  content: "";
  position: absolute;
  top: -2px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 11px solid var(--gold);
  filter: drop-shadow(1px 1px 0 #000);
}

.look-sheet-bar > b::before {
  left: 4px;
  transform: rotate(-18deg);
}

.look-sheet-bar > b::after {
  right: 4px;
  transform: rotate(18deg);
}

/* LOCKED: preview left + menus right — never stacked top/bottom (PC + mobile) */
.look-sheet-main,
#look-overlay .look-sheet-main,
body.look-open #look-overlay .look-sheet-main,
body.touch-on #look-overlay .look-sheet-main,
html.touch-on body.look-open #look-overlay .look-sheet-main,
body.pc-ui #look-overlay .look-sheet-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow: hidden;
  gap: 10px;
  align-items: stretch;
}

.look-preview-col {
  flex: 0 0 min(42vw, 280px) !important;
  width: min(42vw, 280px) !important;
  max-width: 46% !important;
  min-width: 0;
  min-height: 0;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch;
  align-self: stretch;
  gap: 0;
}

.look-preview-dock {
  position: relative;
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 0;
  max-height: none;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch;
  justify-content: center;
  padding: 28px 8px 12px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 28%, #9ec2ff 0%, #5c94fc 42%, #3a6bb8 78%, #2a5699 100%);
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000, inset 0 0 0 2px #f0c14a;
}

.look-dock-lang {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
}

.look-dock-lang .lang-switch {
  margin: 0;
}

.look-preview-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 10px;
  overflow: visible;
}

/* Fixed column: tag always sits above the cat canvas (no absolute jump) */
.look-preview-cat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: min(36vw, 160px);
  margin: 0 auto;
  line-height: normal;
}

.look-preview-tag.name-tag {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 6px;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
  text-align: center;
}

.look-preview-dock #look-preview,
.look-preview-cat #look-preview,
#look-overlay #look-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 48 / 40;
  margin: 0;
  border: 3px solid #000;
  box-shadow: 2px 2px 0 #000;
  background: transparent;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.look-identity {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
  padding: 6px 8px;
  background: linear-gradient(180deg, #4a3426 0%, #3a2a20 100%);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  box-sizing: border-box;
  color: #fff6e8;
}

.look-name-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.look-name-line #look-name-slot {
  flex: 0 1 auto;
  min-width: 0;
}

.look-name-line .look-letters {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.look-identity .look-tag-vis {
  margin: 4px 0 0;
  padding: 4px 6px;
  background: #1b140f;
  border: 2px solid #000;
  box-shadow: 1px 1px 0 #000;
}

.look-identity .look-tag-vis > .look-label,
.look-identity .look-vis-note {
  display: none;
}

.look-identity .look-letter {
  flex: 0 0 auto;
  min-width: 28px;
  min-height: 36px;
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 800;
  background: #1b140f;
  border: 2px solid #000;
  box-shadow: 1px 1px 0 #000;
}

.look-identity .look-checks {
  gap: 6px 10px;
}

.look-identity .look-check {
  font-size: 12px;
  color: #fff6e8;
  font-weight: 800;
}

.look-sheet-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 0 2px 8px;
}

#look-overlay #look-panel {
  margin: 0;
  text-align: left;
}

#look-overlay #look-panel > #look-preview {
  display: none;
}

.look-easy-hint {
  margin: 0 0 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #f0c14a;
  line-height: 1.35;
  text-shadow: 1px 1px 0 #000;
}

.look-accordions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.look-acc {
  background: #241810;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
}

.look-acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  font: 800 15px Tahoma, sans-serif;
  color: #fff6e8;
  background: linear-gradient(180deg, #4a3426 0%, #3a2a20 100%);
  touch-action: manipulation;
  user-select: none;
  text-shadow: 1px 1px 0 #000;
}

.look-acc > summary::-webkit-details-marker {
  display: none;
}

.look-acc > summary::after {
  content: "+";
  margin-left: auto;
  font-size: 20px;
  color: var(--gold);
  text-shadow: none;
}

.look-acc[open] > summary {
  background: linear-gradient(180deg, #f7d36a 0%, #f0c14a 100%);
  color: var(--ink);
  text-shadow: none;
}

.look-acc[open] > summary::after {
  content: "–";
  color: var(--ink);
}

/* Signal-style menu marks (not cute emoji) */
.look-acc-sig {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  background: transparent;
  position: relative;
}

.look-acc-sig--draw {
  border-radius: 1px;
}
.look-acc-sig--draw::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: currentColor;
  transform: rotate(-32deg);
}

.look-acc-sig--body {
  border-radius: 2px;
  box-shadow: inset 3px 3px 0 currentColor;
}

.look-acc-sig--horns {
  width: 0;
  height: 0;
  border: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid currentColor;
  background: transparent;
}

.look-acc-sig--ears {
  width: 0;
  height: 0;
  border: 0;
  border-top: 14px solid currentColor;
  border-right: 14px solid transparent;
  background: transparent;
}

.look-acc-sig--wings {
  border: 0;
  width: 16px;
  height: 12px;
  background:
    linear-gradient(135deg, currentColor 0 45%, transparent 45%),
    linear-gradient(225deg, currentColor 0 45%, transparent 45%);
  background-size: 50% 100%, 50% 100%;
  background-position: left, right;
  background-repeat: no-repeat;
}

.look-acc-sig--extra {
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px transparent;
  background: currentColor;
}

.look-acc > :not(summary) {
  padding: 10px;
  border-top: 2px solid #000;
  background: #1b140f;
}

.look-acc[hidden] {
  display: none !important;
}

.look-picks-grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

.look-picks-grid .look-pick {
  width: 100%;
  min-height: 28px;
  font-size: 11px;
  padding: 4px 2px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--cream);
  border: 2px solid #000;
  box-shadow: 1px 1px 0 #000;
  color: var(--ink);
  font-weight: 800;
}

.look-picks-grid .look-pick.on {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--ink) inset, 2px 2px 0 #000;
}

.look-advanced-link,
.look-back-easy {
  appearance: none;
  display: block;
  width: 100%;
  margin: 10px 0 0;
  border: 2px dashed #6a5644;
  background: transparent;
  color: #cbbba6;
  font: 700 13px Tahoma, sans-serif;
  min-height: 44px;
  padding: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.look-back-easy {
  border-style: solid;
  border-color: #000;
  background: #f4efe4;
  color: #1b140f;
  margin: 0 0 10px;
}

.look-tab-hint {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: #cbbba6;
}

#look-mode-tabs {
  display: none !important;
}

#btn-look-start-foot,
#btn-look-logout,
#btn-support-close {
  appearance: none;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  font-weight: 800;
  padding: 8px 12px;
  min-height: 50px;
  touch-action: manipulation;
  box-shadow: 2px 2px 0 #000;
}
#btn-look-start-foot {
  background: linear-gradient(180deg, #93e06f 0%, #7dcc5c 100%);
}
#btn-look-logout {
  background: linear-gradient(180deg, #f7d45a 0%, #f0c14a 55%, #d4a82e 100%);
  color: #1b140f;
  min-height: 40px;
  padding: 8px 14px;
  font: 800 13px Tahoma, sans-serif;
  letter-spacing: 0.02em;
  text-shadow: none;
  box-shadow: 2px 2px 0 #000;
  border: 2px solid #000;
}

#btn-look-logout:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

#btn-look-logout.is-logout {
  background: linear-gradient(180deg, #f7d45a 0%, #f0c14a 55%, #d4a82e 100%);
  color: #1b140f;
}

.look-sheet-foot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  background:
    linear-gradient(180deg, #241810 0%, #1a120e 100%);
  border-top: 3px solid #000;
  box-shadow: inset 0 2px 0 rgba(240, 193, 74, 0.25);
  padding: 8px 4px max(10px, env(safe-area-inset-bottom));
  z-index: 5;
}

.char-roster {
  margin: 0 0 8px;
  padding: 8px 8px 6px;
  border: 2px solid #000;
  background: linear-gradient(180deg, #2a1c14 0%, #1a120e 100%);
  box-shadow: inset 0 1px 0 rgba(240, 193, 74, 0.2);
  position: relative;
  z-index: 6;
  pointer-events: auto;
}
.char-roster .look-label {
  margin: 0 0 2px;
}
.char-roster-hint {
  margin: 0 0 8px;
  font: 600 11px/1.35 Tahoma, sans-serif;
  color: #c8b89a;
}
.char-roster-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  position: relative;
  z-index: 7;
  pointer-events: auto;
}
.char-slot {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 6px 4px;
  border: 2px solid #000;
  background: #120c0a;
  color: #f4efe4;
  cursor: pointer;
  font: 700 11px/1.2 Tahoma, sans-serif;
  text-align: center;
  position: relative;
  z-index: 8;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(240, 193, 74, 0.35);
}
.char-slot:hover {
  background: #241810;
}
.char-slot.is-active {
  outline: 2px solid #f0c14a;
  outline-offset: -2px;
  background: #2a2010;
}
.char-slot.is-empty {
  color: #f0c14a;
  border-style: dashed;
}
.char-slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 800 12px/1.2 Tahoma, sans-serif;
  color: #fff6e8;
}
.char-slot.is-empty .char-slot-name {
  color: #f0c14a;
}
.char-slot-meta {
  font: 600 10px/1.2 Tahoma, sans-serif;
  color: #a89880;
}
.char-slot.is-active .char-slot-meta {
  color: #f0c14a;
}
.char-roster-msg {
  margin: 6px 0 0;
  font: 700 11px/1.3 Tahoma, sans-serif;
  color: #e4453a;
}
.char-roster-msg.is-ok {
  color: #7ec87a;
}
.char-save-btn {
  appearance: none;
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 2px solid #000;
  background: linear-gradient(180deg, #f0c14a 0%, #d4a017 100%);
  color: #1a120e;
  font: 800 13px/1.2 Tahoma, sans-serif;
  cursor: pointer;
  box-shadow: 2px 2px 0 #000;
}
.char-save-btn:hover {
  filter: brightness(1.05);
}
.char-save-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

.look-foot-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.look-login-promo {
  margin: 0 0 0 auto;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  align-self: center;
  text-align: right;
  font: 800 14px/1.25 Tahoma, sans-serif;
  color: #f0c14a;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  background: transparent;
  box-shadow: none;
  text-shadow:
    -2px -2px 0 #000,
     0   -2px 0 #000,
     2px -2px 0 #000,
    -2px  0   0 #000,
     2px  0   0 #000,
    -2px  2px 0 #000,
     0    2px 0 #000,
     2px  2px 0 #000,
    -1px -2px 0 #000,
     1px -2px 0 #000,
    -2px -1px 0 #000,
     2px -1px 0 #000,
    -2px  1px 0 #000,
     2px  1px 0 #000,
    -1px  2px 0 #000,
     1px  2px 0 #000,
     3px  3px 0 #000;
}

.look-identity .look-checks {
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 10px;
}

.look-identity .look-login-promo {
  font-size: 14px;
}

.look-foot-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  align-self: flex-end;
}

.look-logout-foot,
.look-start-foot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  cursor: pointer;
}

.look-start-foot {
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 800;
}

/* Mobile: compact auth/start buttons, flush right */
body.touch-on #look-overlay .look-foot-top,
html.touch-on body.look-open #look-overlay .look-foot-top {
  gap: 6px;
  padding-right: 0;
}

body.touch-on #look-overlay .look-foot-actions,
html.touch-on body.look-open #look-overlay .look-foot-actions {
  flex: 0 0 auto;
  width: max-content;
  max-width: 42%;
  margin-left: auto;
  margin-right: 0;
  align-self: flex-end;
  align-items: stretch;
}

body.touch-on #look-overlay .look-logout-foot,
body.touch-on #look-overlay .look-start-foot,
html.touch-on body.look-open #look-overlay .look-logout-foot,
html.touch-on body.look-open #look-overlay .look-start-foot {
  width: auto;
  min-width: 0;
  padding: 6px 10px;
  min-height: 32px;
  font-size: 12px;
  line-height: 1.15;
}

body.touch-on #look-overlay #btn-look-logout,
html.touch-on body.look-open #look-overlay #btn-look-logout {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

body.touch-on #look-overlay #btn-look-start-foot,
html.touch-on body.look-open #look-overlay #btn-look-start-foot {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

#look-overlay .look-label {
  font-size: 13px;
  color: var(--gold);
  font-weight: 800;
}

body.touch-on #look-overlay .nick-row,
body.look-open #look-overlay .nick-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: #fff6e8;
  white-space: nowrap;
  text-shadow:
    -2px -2px 0 #000,
     0   -2px 0 #000,
     2px -2px 0 #000,
    -2px  0   0 #000,
     2px  0   0 #000,
    -2px  2px 0 #000,
     0    2px 0 #000,
     2px  2px 0 #000,
     3px  3px 0 #000;
}
body.touch-on #look-overlay .nick-row input,
body.look-open #look-overlay .nick-row input {
  width: 7.5em;
  max-width: 42vw;
  min-height: 36px;
  font-size: 16px;
  box-sizing: border-box;
  border: 2px solid #000;
  background: #1b140f;
  color: #fff6e8;
  box-shadow: 1px 1px 0 #000;
  font-weight: 700;
  padding: 4px 8px;
  caret-color: #f0c14a;
}
body.touch-on #look-overlay .nick-row input::placeholder,
body.look-open #look-overlay .nick-row input::placeholder {
  color: rgba(255, 246, 232, 0.4);
  opacity: 1;
  font-weight: 700;
}

/* Look window ALWAYS: preview left + menus right (PC and mobile). */

#look-preview {
  display: block;
  width: 72px;
  height: 60px;
  margin: 0 auto 8px;
  image-rendering: pixelated;
  background: #5c94fc;
  border: 2px solid #000;
}

#menu-title #look-host {
  max-height: min(48vh, 380px);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 0 8px;
}
#menu-title #look-preview {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 96px;
  height: 80px;
  margin: 0 auto 8px;
  box-shadow: 0 8px 0 #1b140f;
}

.look-label {
  margin: 6px 0 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.look-tag-vis {
  margin: 10px 0 12px;
  padding: 10px 12px;
  background: #1b140f;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
}

.look-tag-vis .look-label {
  margin: 0 0 8px;
  color: #f0c14a;
  font-size: 12px;
  font-weight: 800;
}

.look-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.look-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #f4efe4;
  cursor: pointer;
  user-select: none;
}

.look-check input {
  width: 16px;
  height: 16px;
  accent-color: #f0c14a;
  cursor: pointer;
}

.look-vis-note {
  margin: 8px 0 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  color: #cbbba6;
}

.look-vis-toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(92vw, 360px);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  color: #f0c14a;
  background: rgba(12, 8, 6, 0.94);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  pointer-events: none;
}

.look-vis-toast[hidden] {
  display: none !important;
}

.look-letters,
.look-picks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.look-letter,
.look-pick {
  appearance: none;
  border: 2px solid #000;
  background: #f4efe4;
  color: var(--ink);
  min-width: 34px;
  min-height: 40px;
  padding: 4px 8px;
  font: 700 12px Tahoma, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.look-letter {
  min-width: 28px;
  padding: 4px 6px;
}

.look-pick.on,
.look-letter:focus {
  outline: none;
  box-shadow: 0 0 0 2px #f0c14a;
}

.look-pick.on {
  background: #f0c14a;
}

#look-studio {
  width: 100%;
  margin: 0 0 10px;
}

.look-mode-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 0 0 10px;
}

.look-mode-tab {
  appearance: none;
  flex: 1;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font: 700 12px Tahoma, sans-serif;
  min-height: 40px;
  padding: 6px 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.look-mode-tab.on {
  background: #f0c14a;
  box-shadow: 0 0 0 2px #1b140f inset;
}

.look-custom-work {
  display: block;
}

.look-custom-main,
.look-custom-side {
  display: block;
}

.look-custom-bar {
  margin: 8px 0 0;
}

.look-custom-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 6px 0 0;
}

.look-tools,
.look-palette,
.look-custom-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin: 0 0 8px;
}

.look-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

/* Draw mode: collapse menus + start bar so draw studio has room */
body.look-open.look-drawing .look-sheet-foot {
  display: none !important;
}

body.look-open.look-drawing .look-easy-hint {
  display: none !important;
}

body.look-open.look-drawing .look-acc:not(.look-acc-draw) {
  display: none !important;
}

body.look-open.look-drawing .look-acc-draw {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.look-open.look-drawing .look-acc-draw > summary {
  flex: 0 0 auto;
}

body.look-open.look-drawing .look-acc-draw > :not(summary) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 6px;
}

body.look-open.look-drawing .look-accordions,
body.look-open.look-drawing .look-easy,
body.look-open.look-drawing #look-panel,
body.look-open.look-drawing .look-sheet-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

body.look-open.look-drawing .look-preview-col {
  flex: 0 0 min(42vw, 280px) !important;
  width: min(42vw, 280px) !important;
  max-width: 46% !important;
}

body.look-open.look-drawing .look-preview-dock {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 140px;
  max-height: none;
  padding: 28px 8px 12px;
  flex-direction: column !important;
}

/* Mobile: same-line compact credits + title */
body.touch-on #look-overlay .look-credits-bar,
html.touch-on body.look-open #look-overlay .look-credits-bar {
  left: 4px;
  max-width: min(46%, 150px);
  padding: 3px 6px;
  font-size: 11px;
}

body.touch-on #look-overlay .look-credits-bar b,
html.touch-on body.look-open #look-overlay .look-credits-bar b {
  font-size: 12px;
}

body.touch-on #look-overlay .look-sheet-bar > b,
html.touch-on body.look-open #look-overlay .look-sheet-bar > b {
  font-size: 12px;
  line-height: 1.25;
  padding: 2px 18px;
  max-width: min(100%, calc(100% - 108px));
  letter-spacing: 0.01em;
  color: #f0c14a;
  text-shadow:
    -2px -2px 0 #000,
     0   -2px 0 #000,
     2px -2px 0 #000,
    -2px  0   0 #000,
     2px  0   0 #000,
    -2px  2px 0 #000,
     0    2px 0 #000,
     2px  2px 0 #000,
    -1px -2px 0 #000,
     1px -2px 0 #000,
    -2px -1px 0 #000,
     2px -1px 0 #000,
    -2px  1px 0 #000,
     2px  1px 0 #000,
    -1px  2px 0 #000,
     1px  2px 0 #000,
     3px  3px 0 #000;
}

/* Phone / mobile shell — thin preview (do not use PC grid) */
body.touch-on:not(.look-desktop) #look-overlay .look-preview-col,
html.touch-on body.look-open:not(.look-desktop) #look-overlay .look-preview-col {
  flex: 0 0 min(38vw, 160px) !important;
  width: min(38vw, 160px) !important;
  max-width: 42% !important;
}

body.touch-on:not(.look-desktop) #look-overlay .look-preview-dock,
html.touch-on body.look-open:not(.look-desktop) #look-overlay .look-preview-dock {
  padding: 26px 4px 8px;
  min-height: 0;
}

body.look-open.look-drawing .look-preview-stage {
  display: flex !important;
}

body.look-open.look-drawing .look-sheet-main {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 10px;
}

body.look-open.look-drawing #look-custom-hint {
  display: none !important;
}

body.look-open.look-drawing .look-custom-work {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

body.look-open.look-drawing .look-custom-main {
  flex: 0 0 auto;
  width: min(40vw, 156px);
  min-width: 0;
}

body.look-open.look-drawing .look-custom-side {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.look-open.look-drawing #look-draw {
  width: 100% !important;
  max-width: 156px;
  height: auto;
  margin: 0 !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 3px solid #1b140f;
  background: #5c94fc;
  touch-action: none;
  cursor: crosshair;
}

body.look-open.look-drawing .look-custom-bar {
  width: 100%;
  max-width: 156px;
  margin: 6px 0 0;
}

body.look-open.look-drawing .look-acc-scale-row {
  margin: 0;
  font-size: 11px;
}

body.look-open.look-drawing .look-acc-scale-row input[type="range"] {
  min-width: 0;
}

body.look-open.look-drawing .look-custom-bar-actions {
  margin: 4px 0 0;
  gap: 3px;
}

body.look-open.look-drawing .look-custom-bar-actions .look-pick,
body.look-open.look-drawing .look-tools .look-pick {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  min-height: 34px;
  padding: 4px 5px;
  font-size: 11px;
  line-height: 1.15;
}

body.look-open.look-drawing .look-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1 1 auto;
  margin: 0;
}

body.look-open.look-drawing .look-palette {
  display: grid;
  grid-template-rows: repeat(8, 22px);
  grid-auto-flow: column;
  grid-auto-columns: 22px;
  gap: 3px;
  justify-content: start;
  margin: 0;
}

body.look-open.look-drawing #look-acc-label {
  margin: 0;
  font-size: 11px;
}

body.look-open.look-drawing #look-acc-picks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
}

body.look-open.look-drawing #look-acc-picks .look-pick {
  width: 100%;
  min-height: 28px;
  font-size: 11px;
  padding: 4px 4px;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.look-open.look-drawing .look-acc-row input[type="range"]:disabled {
  opacity: 0.45;
}

body.look-open.look-drawing .look-pick:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.look-swatch {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #000;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.look-swatch.on {
  outline: 2px solid #f0c14a;
  outline-offset: 1px;
}

.look-acc-edit {
  margin: 0 0 10px;
  padding: 8px;
  border: 2px solid #000;
  background: #1b140f;
  color: #f4efe4;
}

.look-acc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  font: 700 12px Tahoma, sans-serif;
}

.look-acc-row input[type="range"] {
  flex: 1;
}

.look-acc-row input[type="color"] {
  width: 44px;
  height: 28px;
  border: 2px solid #000;
  background: #f4efe4;
  padding: 0;
}

.menu-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  margin: 0 0 10px;
  border: 2px solid #000;
  border-radius: 999px;
  overflow: hidden;
  background: #f4efe4;
  box-shadow: 2px 2px 0 #000;
  user-select: none;
  vertical-align: middle;
}

.lang-switch .lang-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--gold);
  transition: transform 0.18s ease;
  z-index: 0;
  pointer-events: none;
}

.lang-switch[data-lang="th"] .lang-slider {
  transform: translateX(100%);
}

.lang-switch button {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 46px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 5px 11px;
  cursor: pointer;
  touch-action: manipulation;
}

#name-lang-block {
  margin: 0 0 2px;
}

.nick-row {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.nick-row input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 2px solid #000;
  background: #f4efe4;
  color: var(--ink);
  font: inherit;
  text-align: center;
  touch-action: manipulation;
}

.nick-row input:disabled {
  opacity: 0.7;
}

.nick-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.nick-hint.is-err {
  color: #e4453a;
  font-weight: 700;
}

.nick-hint.is-ok {
  color: #3d9a4a;
}

.kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.danger-text {
  color: var(--danger);
}

.stat,
#dead-msg {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.stat b {
  color: var(--gold);
}

#win-breakdown {
  margin: 0 0 8px;
}

#win-breakdown .stat {
  margin: 0 0 3px;
}

#win-total {
  color: var(--gold);
}

.btn {
  appearance: none;
  border: 2px solid #000;
  background: var(--gold);
  color: var(--ink);
  padding: 10px 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  touch-action: manipulation;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

.pc-fire-hint {
  margin: 10px 0 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.pc-fire-hint kbd {
  display: inline-block;
  min-width: 16px;
  padding: 1px 5px;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font: 700 11px Tahoma, sans-serif;
  box-shadow: 1px 1px 0 #000;
}

body.touch-on .pc-fire-hint {
  display: none;
}

#mumu-screen-dim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#mumu-screen-dim.on {
  display: block;
}

.mobile-play-hint {
  display: block;
  margin: 10px 0 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0.02em;
  text-align: center;
}

#fit.touch-on {
  justify-content: center;
  align-items: center;
  padding: 0;
  position: relative;
  z-index: 1;
  isolation: isolate;
}

#fit.touch-on #app {
  position: absolute;
  flex: none;
  min-width: 0;
  max-width: none;
  max-height: none;
}

#fit.touch-on .topbar {
  display: none;
}

#touch-ui {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

#touch-ui .touch-item,
#pad-chrome,
#pad-layout,
#pad-minimize,
#pad-close,
#btn-share,
#pad-edit-bar,
.emote-cluster,
#support-dock,
#shop-dock,
#dev-note[data-pad] {
  pointer-events: auto;
  touch-action: none;
}

.touch-item {
  --pad-s: 1;
  position: absolute;
  z-index: 26;
  -webkit-user-select: none;
  user-select: none;
  transform: scale(var(--pad-s));
  transform-origin: top left;
}

body.pad-edit .touch-item.selected,
body.pad-edit [data-pad].selected {
  outline: 3px solid #f0c14a;
  outline-offset: 4px;
  z-index: 32;
}

body.pad-edit [data-pad="stage"].selected {
  z-index: 1;
}

#pad-chrome {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  top: max(8px, env(safe-area-inset-top));
  z-index: 36;
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 4px;
  transform: scale(var(--pad-s, 1));
  transform-origin: top right;
}

html.touch-on #pad-chrome,
body.touch-on #pad-chrome {
  display: inline-flex;
}

#pad-chrome button,
#pad-layout,
#pad-minimize,
#pad-close {
  position: relative;
  right: auto;
  top: auto;
  z-index: 1;
  appearance: none;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.1;
  min-height: 34px;
  height: 34px;
  padding: 0 8px;
  box-shadow: 2px 2px 0 #000;
  transform: none;
  white-space: nowrap;
  flex-shrink: 0;
}

#pad-minimize {
  background: #f0c14a;
}

#pad-close {
  background: #e4453a;
  color: #fff6e8;
}

#pad-layout {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  top: max(8px, env(safe-area-inset-top));
  z-index: 36;
  appearance: none;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 8px;
  box-shadow: 2px 2px 0 #000;
  transform: scale(var(--pad-s, 1));
  transform-origin: top left;
}

html.touch-on #pad-layout,
body.touch-on #pad-layout {
  position: relative;
  right: auto;
  top: auto;
  transform: none;
  padding: 0 8px;
  min-height: 34px;
  height: 34px;
}

.mumu-share-btn {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  top: max(8px, env(safe-area-inset-top));
  z-index: 40;
  appearance: none;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  min-height: 34px;
  padding: 6px 10px;
  box-shadow: 2px 2px 0 #000;
  transform: scale(var(--pad-s, 1));
  transform-origin: top right;
  display: none;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  image-rendering: pixelated;
  pointer-events: auto;
  touch-action: manipulation;
}

html.touch-on .mumu-share-btn:not([hidden]),
body.touch-on .mumu-share-btn:not([hidden]) {
  display: inline-flex;
}

body.touch-on .mumu-share-btn {
  top: max(44px, calc(env(safe-area-inset-top) + 40px));
  transform-origin: top left;
}

.mumu-share-btn[hidden] {
  display: none !important;
}

.mumu-share-btn .share-ico,
.mumu-share-btn .share-ico-cat {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

#share-overlay {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(12, 8, 6, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#share-overlay[hidden] {
  display: none !important;
}

.share-sheet {
  width: min(320px, 94vw);
  background: #2a1c14;
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
  padding: 10px 12px 14px;
  color: #f4efe4;
}

.share-hint {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: #cbbba6;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-act {
  appearance: none;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font-weight: 800;
  font-size: 12px;
  padding: 8px 6px;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}

.share-act[data-share="system"],
.share-act[data-share="copy"] {
  background: #f0c14a;
}

.share-link {
  margin: 10px 0 0;
  font-size: 11px;
  font-weight: 700;
  color: #f0c14a;
  word-break: break-all;
  line-height: 1.35;
}

.share-toast {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: #b4f070;
}

#pad-edit-bar {
  position: fixed;
  left: 50%;
  top: max(6px, env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  max-width: 96vw;
  background: rgba(12, 8, 6, 0.96);
  border: 2px solid #000;
  color: #f4efe4;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  pointer-events: auto;
  touch-action: none;
  cursor: default;
}

#pad-edit-bar.is-moved {
  transform: none;
}

#pad-edit-bar[hidden] {
  display: none;
}

#pad-edit-bar .pad-edit-move {
  appearance: none;
  border: 2px solid #000;
  background: #f4efe4;
  color: #1b140f;
  font-weight: 800;
  padding: 5px 8px;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

#pad-edit-bar .pad-edit-move:active {
  cursor: grabbing;
}

#pad-edit-bar button:not(.pad-edit-move) {
  appearance: none;
  border: 2px solid #000;
  background: #f0c14a;
  color: #1b140f;
  font-weight: 700;
  padding: 5px 8px;
  touch-action: manipulation;
}

.touch-fire.is-off {
  opacity: 0.38;
  filter: grayscale(0.85);
}

.touch-fire,
.touch-jump {
  appearance: none;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  color: var(--ink);
  font-weight: 700;
  -webkit-user-select: none;
  user-select: none;
}

.touch-fire {
  width: 52px;
  height: 52px;
  background: rgba(244, 239, 228, 0.9);
  position: absolute;
}

.touch-fire::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 10px;
  transform: translate(-50%, -50%);
  background: #e4453a;
  border: 2px solid #000;
  border-radius: 6px 2px 2px 6px;
}

.touch-fire:active,
.touch-jump:active,
.stick:active {
  transform: scale(var(--pad-s, 1)) translate(1px, 1px);
  box-shadow: 1px 1px 0 #000;
}

.touch-jump {
  min-width: 72px;
  min-height: 64px;
  padding: 10px 12px;
  background: #f0c14a;
  font-size: 14px;
}

.emote-cluster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 88px;
  padding: 4px;
  background: rgba(18, 12, 9, 0.82);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
}

.emote-cluster button {
  min-height: 32px;
  padding: 4px 2px;
  font-size: 11px;
}

body.pad-edit .emote-cluster button {
  pointer-events: none;
}

.stick {
  position: absolute;
  width: 108px;
  height: 108px;
  max-width: 28vw;
  max-height: 28vw;
  border: 3px solid #000;
  border-radius: 50%;
  background: rgba(244, 239, 228, 0.22);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  height: 42%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(244, 239, 228, 0.82);
  border: 3px solid #000;
  pointer-events: none;
}

.stick-arr {
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  pointer-events: none;
}

.stick-arr.u {
  top: 8px;
  left: 50%;
  margin-left: -8px;
  border-bottom-color: rgba(244, 239, 228, 0.95);
  border-top-width: 0;
}

.stick-arr.d {
  bottom: 8px;
  left: 50%;
  margin-left: -8px;
  border-top-color: rgba(244, 239, 228, 0.95);
  border-bottom-width: 0;
}

.stick-arr.l {
  left: 8px;
  top: 50%;
  margin-top: -8px;
  border-right-color: rgba(244, 239, 228, 0.95);
  border-left-width: 0;
}

.stick-arr.r {
  right: 8px;
  top: 50%;
  margin-top: -8px;
  border-left-color: rgba(244, 239, 228, 0.95);
  border-right-width: 0;
}

#rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 8, 6, 0.92);
  color: #f0c14a;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#rotate-hint .rotate-hint-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 88vw;
}

#rotate-hint #rotate-hint-cat {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #5c94fc;
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
}

#rotate-hint p {
  margin: 0;
  color: #f0c14a;
  font-weight: 800;
  font-size: clamp(18px, 5.5vw, 24px);
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 0 #000;
}

#rotate-hint.is-crying #rotate-hint-cat {
  animation: mumu-cry-bounce 0.35s ease-in-out infinite alternate;
}

@keyframes mumu-cry-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(4px); }
}

@media (pointer: fine) {
  #touch-ui {
    display: none !important;
  }
  html.touch-on #touch-ui:not([hidden]),
  body.touch-on #touch-ui:not([hidden]) {
    display: block !important;
  }
  #rotate-hint {
    display: none !important;
  }
  html.touch-on #rotate-hint:not([hidden]),
  body.touch-on #rotate-hint:not([hidden]) {
    display: flex !important;
  }
}

html.touch-on #touch-ui,
body.touch-on #touch-ui {
  display: block !important;
}
/* Look customize must fully cover game pads — hide controls, not just disable clicks */
body.look-open #touch-ui,
html.touch-on body.look-open #touch-ui,
body.touch-on.look-open #touch-ui {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
body.look-open #btn-share,
body.look-open #pad-chrome,
body.look-open #pad-layout,
body.look-open #pad-edit-bar,
body.touch-on.look-open #touch-ui .touch-item,
body.touch-on.look-open #pad-chrome,
body.touch-on.look-open #pad-layout,
body.touch-on.look-open #btn-share {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (pointer: fine) and (min-width: 720px) {
  #keys-help {
    display: flex;
    flex-direction: column;
  }
  #right-col,
  #dev-note {
    display: flex;
  }
}

body.touch-on #keys-help {
  display: none !important;
}

body.touch-on #right-col {
  display: contents;
}

body.touch-on #emote-pad {
  display: none !important;
}

body.touch-on #dev-note {
  display: flex;
  position: fixed;
  z-index: 36;
  width: 168px;
  max-height: 240px;
  padding: 8px 8px 7px;
  pointer-events: auto;
}

body.touch-on #dev-note p {
  margin: 0 0 4px;
  font-size: 10px;
  line-height: 1.35;
}

body.touch-on #dev-note .dev-kao {
  margin-bottom: 5px;
  font-size: 12px;
}

body.pad-edit #app[data-pad] {
  cursor: grab;
}

@media (pointer: coarse) and (orientation: portrait) {
  #rotate-hint:not([hidden]) {
    display: flex;
  }
}

/* World chat — under HUD, light panel, scrollable */
#world-chat {
  --wc-name-w: 3.2em;
  --wc-panel-w: min(52vw, 200px);
  --wc-font: 11px;
  --wc-panel-bg: rgba(198, 198, 198, 0.96);
  --wc-line: rgba(0, 0, 0, 0.2);
  --wc-compose: #1a1a1a;
  --wc-shadow: none;
  --wc-outline:
    -1px -1px 0 #fff,
     1px -1px 0 #fff,
    -1px  1px 0 #fff,
     1px  1px 0 #fff,
    -1px 0 0 #fff,
     1px 0 0 #fff,
     0 -1px 0 #fff,
     0 1px 0 #fff;
  position: absolute;
  left: 0;
  top: 72px;
  height: 110px;
  z-index: 7;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  pointer-events: none;
  max-width: calc(100% - 8px);
}
#world-chat[hidden] {
  display: none !important;
}
#world-chat .wc-toggle {
  pointer-events: auto;
  align-self: flex-start;
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 4px;
  min-width: 0;
  width: auto;
  height: auto;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.05;
  color: var(--cream);
  background: rgba(18, 12, 9, 0.86);
  border: 2px solid #000;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
  z-index: 2;
  box-sizing: border-box;
}
#world-chat.is-open .wc-toggle {
  background: rgba(42, 28, 20, 0.94);
  color: var(--gold);
  align-self: stretch;
  height: auto;
  min-height: 100%;
}
#world-chat .wc-panel {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  width: 0;
  max-width: var(--wc-panel-w);
  height: 100%;
  opacity: 0;
  overflow: hidden;
  background: var(--wc-panel-bg);
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-left: 0;
  border-right: 0;
  box-shadow: none;
  transform: translateX(-4px);
  transition: width 0.18s ease, opacity 0.15s ease, transform 0.18s ease;
}
#world-chat.is-open .wc-panel {
  pointer-events: auto;
  width: var(--wc-panel-w);
  opacity: 1;
  transform: translateX(0);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}
.wc-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 2px 5px 2px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  pointer-events: auto;
}
.wc-line {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  font-size: var(--wc-font);
  font-weight: 700;
  line-height: 1.35;
  text-shadow: var(--wc-shadow);
  flex: 0 0 auto;
  padding: 3px 0 4px;
  border-bottom: 1px solid var(--wc-line);
  min-width: 0;
}
.wc-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  text-shadow: var(--wc-outline);
  -webkit-text-stroke: 0;
}
.wc-meta .wc-name,
.wc-meta .wc-colon,
.wc-meta .wc-time {
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
  text-shadow: var(--wc-outline);
}
.wc-meta .wc-colon::after {
  content: " ";
}
.wc-compose {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  font-size: var(--wc-font);
  font-weight: 700;
  line-height: 1.35;
  text-shadow: var(--wc-shadow);
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 5px 5px;
  border-top: 1px solid var(--wc-line);
  background: var(--wc-panel-bg);
  color: var(--wc-compose);
}
.wc-compose .wc-name,
.wc-compose .wc-colon {
  flex: 0 0 auto;
}
.wc-name {
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
}
.wc-colon {
  white-space: nowrap;
}
.wc-compose .wc-colon::after,
.wc-preview-colon::after {
  content: " ";
}
.wc-time {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: 0;
}
.wc-msg {
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  text-shadow: none;
}
#wc-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
  height: 1.35em;
  max-height: 1.35em;
  white-space: nowrap;
  text-shadow: var(--wc-shadow);
  caret-color: #333;
}
#wc-input::placeholder {
  color: rgba(40, 40, 40, 0.45);
  text-shadow: none;
  font-weight: 600;
}
#wc-measure {
  position: absolute;
  left: -9999px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}
.wc-mobile-preview,
.wc-chat-banner {
  position: absolute;
  left: 50%;
  right: auto;
  top: 0;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: max-content;
  max-width: 92%;
  padding: 2px 3ch;
  background: var(--wc-preview-bg, rgba(230, 230, 230, 0.78));
  color: var(--wc-preview-fg, #111);
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
  max-height: 1.35em;
  overflow: hidden;
  box-sizing: border-box;
  white-space: nowrap;
  transform: translateX(-50%);
}
body.pc-ui .wc-mobile-preview,
body.pc-ui .wc-chat-banner {
  font-size: 10px;
  padding: 3px 3ch;
  max-height: 1.4em;
}
/* Mobile: hug text (พอดี) — do not force-shrink / ellipsis */
body.touch-on .wc-mobile-preview,
body.touch-on .wc-chat-banner,
#fit.touch-on .wc-mobile-preview,
#fit.touch-on .wc-chat-banner {
  max-width: none;
  width: max-content;
  /* 1 space padding left/right for background */
  padding: 2px 1ch;
  font-size: 9px;
  z-index: 22;
  max-height: none;
  overflow: visible;
  white-space: nowrap;
  /* Shift 2 spaces to the right of center */
  transform: translateX(calc(-50% + 2ch));
}
/* Exactly 1 space: Name: → msg → time (no extra ::after space) */
body.touch-on .wc-preview-colon::after,
#fit.touch-on .wc-preview-colon::after {
  content: "";
}
body.touch-on .wc-preview-text,
#fit.touch-on .wc-preview-text {
  margin-left: 1ch;
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
}
body.touch-on .wc-preview-time,
#fit.touch-on .wc-preview-time {
  margin-left: 1ch;
}
/* Fixed to visual viewport top while typing / keyboard open */
.wc-mobile-preview.wc-banner-fixed,
.wc-chat-banner.wc-banner-fixed {
  position: fixed !important;
  z-index: 2147483000 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  max-height: none !important;
  overflow: visible !important;
}
body.touch-on.wc-chat-composing .wc-mobile-preview,
body.touch-on.wc-chat-composing .wc-chat-banner {
  z-index: 2147483000;
}
.wc-mobile-preview[hidden],
.wc-chat-banner[hidden] {
  display: none !important;
}
.wc-preview-name,
.wc-preview-colon,
.wc-preview-time {
  flex: 0 0 auto;
  white-space: nowrap;
  /* white edge on name + time */
  -webkit-text-stroke: 0.4px #ffffff;
  paint-order: stroke fill;
  text-shadow:
    -1px 0 0 #fff,
    1px 0 0 #fff,
    0 -1px 0 #fff,
    0 1px 0 #fff;
}
.wc-preview-text {
  flex: 0 1 auto;
  min-width: 0;
  /* 3 spaces after "Name:" */
  margin-left: 3ch;
  padding-left: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
.wc-preview-time {
  /* 5 spaces before time */
  margin-left: 5ch;
  opacity: 0.92;
  font-weight: 700;
}
.wc-preview-time[hidden] {
  display: none !important;
}
.wc-preview-text.is-ph {
  opacity: 0.45;
  font-weight: 600;
}
body.touch-on #world-chat,
#fit.touch-on #world-chat {
  top: 52px;
  height: 120px;
  left: 0;
  --wc-panel-w: min(62vw, 220px);
}
body.touch-on #world-chat .wc-toggle,
#fit.touch-on #world-chat .wc-toggle {
  align-self: flex-start;
  font-size: 10px;
  padding: 5px 3px;
  min-width: 0;
  width: auto;
  height: auto;
  min-height: 0;
  letter-spacing: 0.06em;
  line-height: 1.05;
}
body.touch-on #world-chat.is-open .wc-toggle,
#fit.touch-on #world-chat.is-open .wc-toggle {
  align-self: stretch;
  min-height: 100%;
  height: auto;
}

/* === FINAL LOCK: character customize always side-by-side (preview | menus) === */
#look-overlay .look-sheet-main,
body.look-open #look-overlay .look-sheet-main,
body.touch-on #look-overlay .look-sheet-main,
html.touch-on body.look-open #look-overlay .look-sheet-main,
body.pc-ui #look-overlay .look-sheet-main,
html.pc-ui #look-overlay .look-sheet-main,
body.look-open.look-drawing #look-overlay .look-sheet-main {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
  min-height: 0 !important;
}
#look-overlay #look-preview-col,
body.look-open #look-overlay #look-preview-col {
  order: 0 !important;
  flex: 0 0 min(42vw, 280px) !important;
  width: min(42vw, 280px) !important;
  max-width: 46% !important;
  min-width: 120px !important;
  align-self: stretch !important;
}
#look-overlay #look-sheet-body,
body.look-open #look-overlay #look-sheet-body {
  order: 1 !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
}
/* Mobile shell / touch phone — keep compact preview even if CSS width >= 720 (landscape) */
body.touch-on:not(.look-desktop) #look-overlay #look-preview-col,
html.touch-on body.look-open:not(.look-desktop) #look-overlay #look-preview-col {
  flex: 0 0 min(38vw, 160px) !important;
  width: min(38vw, 160px) !important;
  max-width: 42% !important;
  min-width: 96px !important;
}

/* PC desktop look only (class set in JS — never mobile shell) */
html.look-desktop #look-overlay .look-sheet-bar,
body.look-desktop #look-overlay .look-sheet-bar {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 12px !important;
  padding: 8px 10px !important;
  min-height: 48px !important;
  overflow: hidden !important;
}
html.look-desktop #look-overlay .look-credits-bar,
body.look-desktop #look-overlay .look-credits-bar {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  max-width: none !important;
  width: max-content !important;
  justify-self: start !important;
  z-index: 1 !important;
  flex-wrap: nowrap !important;
}
html.look-desktop #look-overlay .look-sheet-bar > b.look-title-tip,
html.look-desktop #look-overlay .look-sheet-bar > b[data-i18n="lookTitle"],
body.look-desktop #look-overlay .look-sheet-bar > b.look-title-tip,
body.look-desktop #look-overlay .look-sheet-bar > b {
  grid-column: 2 !important;
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 2px 28px !important;
  font-size: 13px !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: none !important;
  justify-self: stretch !important;
}

html.look-desktop #look-overlay .look-sheet-main,
body.look-desktop #look-overlay .look-sheet-main,
body.look-desktop.look-open.look-drawing #look-overlay .look-sheet-main {
  display: grid !important;
  grid-template-columns: minmax(220px, 40%) minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: 12px !important;
  align-items: stretch !important;
  flex-direction: unset !important;
  flex-wrap: unset !important;
}
html.look-desktop #look-overlay #look-preview-col,
body.look-desktop #look-overlay #look-preview-col {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: auto !important;
  max-width: none !important;
  min-width: 220px !important;
  flex: none !important;
  order: unset !important;
}
html.look-desktop #look-overlay #look-sheet-body,
body.look-desktop #look-overlay #look-sheet-body {
  grid-column: 2 !important;
  grid-row: 1 !important;
  width: auto !important;
  min-width: 0 !important;
  flex: none !important;
  order: unset !important;
}
html.look-desktop #look-overlay .look-sheet,
body.look-desktop #look-overlay .look-sheet {
  width: 100% !important;
}
.look-credits-bar {
  flex-wrap: nowrap !important;
  white-space: nowrap;
  max-width: min(48%, 240px);
}
html.look-desktop #look-overlay .look-credits-bar,
body.look-desktop #look-overlay .look-credits-bar {
  max-width: none !important;
}
.look-cos-shop-btn {
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 10px;
}

