:root {
  --ink: #18352d;
  --paper: #f7f5ed;
  --muted: #728277;
  --line: #d9dfd2;
  --accent: #ec7546;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #152e29;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', sans-serif;
}
button,
input {
  font: inherit;
}
button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
summary {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration: none;
}
[hidden] {
  display: none !important;
}
#game {
  position: fixed;
  inset: 0;
}
#game canvas {
  display: block;
  touch-action: none;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--paper);
}
.welcome-art {
  background: #193b30;
  color: var(--paper);
  padding: 40px 8%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  min-height: 100vh;
}
.brand {
  font-size: 20px;
  font-weight: 750;
}
.brand span {
  color: #f3be64;
}
.welcome-art h1 {
  font-size: clamp(38px, 4vw, 62px);
  letter-spacing: -2px;
  line-height: 1.35;
  margin: 20px 0;
}
.welcome-art p:not(.eyebrow) {
  font-size: 14px;
  color: #ccd6c8;
}
.welcome-art img {
  width: 100%;
  border-radius: 8px;
  transform: rotate(-2deg);
  margin: 24px 0;
  box-shadow: 8px 8px 0 #ffffff12;
}
.welcome-art > a:last-child {
  font-size: 12px;
  color: #c6d3c5;
}
.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 2px;
}
.edition {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  color: #bdd0c0;
}
.welcome-form {
  max-width: 530px;
  align-self: center;
  width: 100%;
  padding: 42px 50px;
  margin: auto;
}
.welcome-form h2 {
  font-size: 31px;
  margin: 15px 0;
}
.muted {
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted);
}
fieldset {
  border: 0;
  padding: 0;
  margin: 30px 0 22px;
  display: flex;
  gap: 8px;
}
legend {
  font-size: 12px;
  margin-bottom: 12px;
}
fieldset button {
  border: 1px solid var(--line);
  background: #eeeee3;
  border-radius: 9px;
  flex: 1;
  min-width: 0;
  padding: 8px 3px;
  font-size: 10px;
  color: var(--ink);
}
fieldset button[aria-pressed='true'] {
  border: 2px solid var(--ink);
  background: #dfe7d0;
}
fieldset img {
  display: block;
  width: 100%;
  height: 65px;
  object-fit: contain;
}
.primary {
  border: 0;
  border-radius: 6px;
  padding: 16px 20px;
  background: var(--ink);
  color: white;
  width: 100%;
  text-align: left;
  font-size: 14px;
}
.primary span {
  float: right;
}
.small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}
.scope {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 23px;
}
details {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 25px;
}
summary {
  font-size: 13px;
}
form > label {
  display: block;
  font-size: 12px;
  margin-top: 13px;
}
form > label > input {
  display: block;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-top: 7px;
  background: #fff;
}
form .primary {
  margin-top: 18px;
}
.mode-options {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  font-size: 12px;
}
#login-status {
  font-size: 12px;
  line-height: 1.7;
  color: #986238;
}
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.topbar {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 18px 24px;
  background: linear-gradient(#122c29b5, transparent);
  color: white;
  pointer-events: auto;
}
.wordmark {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}
.wordmark span {
  font-size: 15px;
  color: #f2c56b;
  vertical-align: top;
}
.player-info strong {
  font-size: 13px;
}
.hp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}
.hp-row progress {
  appearance: none;
  width: 130px;
  height: 6px;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  background: #ffffff40;
}
.hp-row progress::-webkit-progress-bar {
  background: #ffffff40;
}
.hp-row progress::-webkit-progress-value {
  background: #c7e896;
}
.hp-row span {
  font-size: 10px;
}
.place {
  margin-left: auto;
  text-align: right;
}
.place strong {
  display: block;
  font-size: 14px;
}
.place small {
  font-size: 10px;
  color: #c7dacb;
}
.icon-button {
  background: #14382dd9;
  color: white;
  border: 1px solid #ffffff35;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
}
.world-badge {
  position: absolute;
  top: 100px;
  left: 24px;
  background: #f7f5edea;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  padding: 10px 15px;
  border-radius: 30px;
  box-shadow: 0 3px 15px #0001;
}
.live-dot {
  width: 6px;
  height: 6px;
  background: #648b56;
  border-radius: 50%;
}
.bottom-bar {
  position: absolute;
  bottom: 22px;
  left: 24px;
  right: 24px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.bottom-bar button {
  pointer-events: auto;
  background: #16382eec;
  color: #eef3dd;
  border: 1px solid #ffffff2a;
  padding: 11px 15px;
  border-radius: 6px;
  font-size: 12px;
}
kbd {
  font: 9px monospace;
  color: #b8ccba;
  margin-left: 12px;
}
#position {
  margin-left: auto;
  font-size: 10px;
  color: white;
  text-shadow: 0 1px 3px #000;
}
.keyboard-hint {
  position: absolute;
  bottom: 73px;
  left: 24px;
  font-size: 10px;
  color: white;
  text-shadow: 0 1px 3px #000;
}
#toast {
  position: absolute;
  top: 145px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(500px, 90vw);
  background: #16382ef0;
  color: white;
  padding: 13px 20px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  width: min(650px, 92vw);
  padding: 26px;
  max-height: 85dvh;
  box-shadow: 0 20px 100px #0005;
}
dialog::backdrop {
  background: #0b211d80;
  backdrop-filter: blur(4px);
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.panel-heading h2 {
  font-size: 23px;
  margin: 0;
}
.panel-heading button,
.chat-heading button {
  border: 0;
  background: none;
  color: inherit;
  font-size: 26px;
}
.world-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.world-option {
  background: #e6ecde;
  border: 1px solid #cbd6c0;
  color: var(--ink);
  border-radius: 8px;
  padding: 20px;
  text-align: left;
}
.world-option strong {
  display: block;
  font-size: 18px;
  margin-bottom: 9px;
}
.world-option small {
  font-size: 10px;
  color: var(--muted);
}
.world-option.current {
  border: 2px solid #254b36;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.list-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
}
.list-row button,
.panel-action {
  background: var(--ink);
  color: white;
  border: 0;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 12px;
}
.panel-action {
  margin: 8px 8px 0 0;
}
.empty {
  padding: 30px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 2;
}
.stats {
  display: flex;
  gap: 22px;
  font-size: 13px;
  padding: 15px 0;
}
.danger {
  background: #8b493b;
}
.notice {
  background: #e8eddf;
  font-size: 12px;
  padding: 14px;
  border-radius: 6px;
  line-height: 1.8;
}
#chat-panel {
  position: fixed;
  bottom: 85px;
  left: 24px;
  z-index: 5;
  background: #f7f5edf5;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: min(360px, calc(100vw - 48px));
  padding: 16px;
  box-shadow: 0 8px 30px #0002;
}
.chat-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
#chat-messages {
  height: 180px;
  overflow: auto;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.8;
}
#chat-messages p {
  margin: 8px 0;
}
#chat-form {
  display: flex;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  gap: 8px;
}
#chat-input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 5px;
}
#chat-form button {
  border: 0;
  background: var(--ink);
  color: white;
  border-radius: 5px;
  white-space: nowrap;
}
#touch-controls {
  display: none;
  position: absolute;
  bottom: max(82px, env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  justify-content: space-between;
  align-items: end;
}
.move-controls,
.action-controls {
  display: flex;
  gap: 10px;
}
.action-controls {
  max-width: 190px;
  flex-wrap: wrap;
  justify-content: end;
}
#touch-controls button {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  border: 1px solid #fff8;
  background: #14372c9e;
  color: white;
  border-radius: 50%;
  width: 54px;
  height: 54px;
  font-size: 13px;
  box-shadow: 0 3px 8px #0002;
}
#touch-controls button.held {
  background: #d3e8a5;
  color: var(--ink);
}
#loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #16382ef5;
  color: var(--paper);
  display: grid;
  place-items: center;
  text-align: center;
}
#loading h2 {
  font-size: 24px;
}
#progress {
  width: 250px;
  height: 5px;
  accent-color: #d7e5a2;
}
#fatal {
  position: fixed;
  inset: 25%;
  z-index: 30;
  background: var(--paper);
  border-radius: 12px;
  padding: 30px;
  line-height: 1.8;
}
@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
  .keyboard-hint,
  kbd {
    display: none;
  }
  .bottom-bar {
    bottom: 16px;
  }
}
@media (max-width: 700px) {
  .overlay {
    grid-template-columns: 1fr;
  }
  .welcome-art {
    min-height: 0;
    padding: 25px;
    gap: 15px;
  }
  .welcome-art > div {
    display: none;
  }
  .welcome-art > a:last-child {
    display: none;
  }
  .welcome-form {
    padding: 28px;
  }
  .topbar {
    gap: 10px;
    padding: 15px;
  }
  .hp-row progress {
    width: 75px;
  }
  .hp-row span {
    font-size: 8px;
  }
  .place strong {
    font-size: 12px;
  }
  .icon-button {
    width: 33px;
    height: 33px;
  }
  .world-badge {
    top: 88px;
    left: 15px;
    font-size: 10px;
  }
  .bottom-bar {
    left: 15px;
    right: 15px;
    gap: 5px;
  }
  .bottom-bar button {
    font-size: 10px;
    padding: 10px;
  }
  #position {
    font-size: 8px;
  }
  .keyboard-hint {
    left: 15px;
    font-size: 9px;
  }
  #touch-controls {
    left: 15px;
    right: 15px;
  }
  .action-controls {
    gap: 8px;
    max-width: 130px;
  }
  #touch-controls button {
    width: 49px;
    height: 49px;
  }
  .world-grid {
    gap: 8px;
  }
  .world-option {
    padding: 15px;
  }
  dialog {
    padding: 20px;
  }
  .hp-row {
    gap: 5px;
  }
}
@media (max-height: 500px) and (pointer: coarse) {
  #touch-controls {
    bottom: 65px;
  }
  .action-controls {
    max-width: none;
  }
  .world-badge {
    top: 75px;
  }
  .topbar {
    padding: 10px 18px;
  }
  .keyboard-hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

.place {
  min-width: 0;
  max-width: 240px;
}
.place small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-info {
  flex-shrink: 0;
}
.topbar > .icon-button {
  flex-shrink: 0;
}
@media (max-width: 420px) {
  .wordmark {
    display: none;
  }
  .place {
    max-width: 105px;
  }
  .topbar {
    gap: 8px;
  }
  .hp-row span {
    white-space: nowrap;
  }
  .bottom-bar kbd {
    display: none;
  }
  #touch-controls {
    display: flex;
  }
  .keyboard-hint {
    display: none;
  }
  .action-controls {
    max-width: 115px;
  }
}

.form-field {
  display: block;
  margin: 12px 0;
  font-size: 13px;
}
.form-field input,
.form-field select {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-top: 6px;
  background: white;
  color: var(--ink);
}
.message-history {
  max-height: 35dvh;
  overflow: auto;
}
.message {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.message p {
  white-space: pre-wrap;
}
.message small {
  color: var(--muted);
}
.portrait {
  width: 40px;
  height: 48px;
  object-fit: contain;
}
.table-scroll {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  white-space: nowrap;
}
.recovery-code {
  font-size: 24px;
  overflow-wrap: anywhere;
  user-select: all;
}
.skill-bar {
  position: absolute;
  right: 24px;
  bottom: 80px;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: auto;
}
.skill-bar button {
  color: white;
  background: #193a30e8;
  border: 1px solid #ffffff60;
  border-radius: 8px;
  min-width: 52px;
  padding: 10px 8px;
  font-size: 12px;
}
.skill-bar small {
  display: block;
  font-size: 10px;
  color: #dcecb8;
  margin-top: 5px;
}
#quick-consumable {
  position: absolute;
  right: 100px;
  bottom: calc(100% + 10px);
  max-width: 140px;
}
.skill-bar > span {
  font-size: 10px;
  color: white;
}
.skill-bar button:disabled {
  cursor: default;
  opacity: 0.65;
}
@media (max-width: 700px), (pointer: coarse) {
  .skill-bar {
    bottom: 210px;
    right: 15px;
    gap: 4px;
  }
  .skill-bar button {
    padding: 8px 6px;
    min-width: 43px;
    font-size: 11px;
  }
  .skill-bar > span {
    position: absolute;
    top: -20px;
    right: 0;
  }
  .list-row {
    flex-wrap: wrap;
  }
}
@media (max-height: 500px) {
  .skill-bar {
    bottom: 132px;
    right: 15px;
  }
  .skill-bar > span {
    display: none;
  }
}

/* iOS action pad: ranged / ultimate / super, attack / jump / defense. */
.skill-bar {
  display: grid;
  grid-template-columns: repeat(3, var(--control-size));
  gap: 10px;
  bottom: max(84px, env(safe-area-inset-bottom));
  right: max(18px, env(safe-area-inset-right));
  z-index: 30;
  touch-action: none;
  user-select: none;
}
.skill-bar > button:not(#quick-consumable) {
  width: var(--control-size); height: var(--control-size); min-width: 0; padding: 5px;
  font-size: 15px;
  border-radius: 50%; touch-action: none;
}
/* I O P / J K L order with the original staggered action pad. */
.skill-bar > [data-skill="ranged"] { grid-area: 1 / 1; }
.skill-bar > [data-skill="ultimate"] { grid-area: 1 / 2; }
.skill-bar > [data-skill="super"] { grid-area: 1 / 3; }
.skill-bar > [data-control="attack"] { grid-area: 2 / 1; }
.skill-bar > [data-control="jump"] { grid-area: 2 / 2; }
.skill-bar > [data-skill="defense"] { grid-area: 2 / 3; }
.skill-bar > [data-skill="ultimate"], .skill-bar > [data-control="jump"] { transform: translateY(-7px); }
.skill-bar > [data-skill="super"], .skill-bar > [data-skill="defense"] { transform: translateY(-14px); }
.skill-bar > span { position: absolute; top: -36px; left: 0; right: auto; }
#quick-consumable { right: 0; bottom: calc(100% + 28px); }
#touch-controls { z-index: 30; right: auto; gap: 12px; pointer-events: none; }
#touch-controls > [data-control="interact"] { position: absolute; bottom: calc(var(--control-size) + 14px); left: 0; }
@media (max-width: 700px) {
  .skill-bar { gap: 7px; right: max(8px, env(safe-area-inset-right)); }
  #touch-controls { left: max(8px, env(safe-area-inset-left)); }
  .move-controls { gap: 6px; }
}

/* Fixed inset is recalculated by the browser on every orientation change.
   Never retain portrait/landscape pixel dimensions on the parent or canvas. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
#hud, #game {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
}
#game { z-index: 0; overflow: hidden; }
#game canvas { width: 100% !important; height: 100% !important; margin: 0 !important; }
#hud { z-index: 1; }
html:fullscreen, html:-webkit-full-screen { overflow: hidden; }
#fullscreen-button { flex-shrink: 0; }
@media (max-height: 500px) and (orientation: landscape) {
  .skill-bar { bottom: max(68px, calc(env(safe-area-inset-bottom) + 60px)); }
  #touch-controls { display: flex; bottom: max(68px, calc(env(safe-area-inset-bottom) + 60px)); }
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); gap: 8px; }
  .world-badge, .keyboard-hint { display: none; }
}

/* Larger visible controls and hit areas share the same responsive dimensions. */
#hud { --control-size: clamp(56px, 16vw, 72px); }
#touch-controls button {
  width: var(--control-size);
  height: var(--control-size);
  flex-shrink: 0;
  font-size: 17px;
}
#quick-consumable {
  min-width: var(--control-size);
  min-height: var(--control-size);
  font-size: 14px;
}
#hud .icon-button { width: 44px; height: 44px; font-size: 21px; }
.bottom-bar { bottom: max(8px, env(safe-area-inset-bottom)); }
.bottom-bar button { min-height: 44px; font-size: 13px; }
@media (max-height: 500px) and (min-width: 600px) and (orientation: landscape) {
  #quick-consumable { right: calc(100% + 14px); bottom: 0; }
}
@media (max-width: 420px) {
  .topbar { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .topbar .place { display: none; }
  .bottom-bar { left: 8px; right: 8px; }
  #position { display: none; }
}

.item-icon {
  display: inline-flex; flex: 0 0 48px; width: 48px; height: 48px;
  align-items: center; justify-content: center; vertical-align: middle;
  border-radius: 8px; background: #e7ecdf; color: #526953; font-size: 25px;
}
.item-icon img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.item-shop-button { display: inline-flex; align-items: center; gap: 10px; margin: 4px; }

#touch-controls > [data-control="interact"] small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  color: #dcecb8;
}

/* iOS Safari needs the prefixed rule on both controls and their child labels. */
#hud button,
#hud button *,
#touch-controls,
#touch-controls *,
.skill-bar,
.skill-bar * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#hud button {
  touch-action: none;
}

.appearance-stage { display:flex; justify-content:center; background:radial-gradient(ellipse at bottom,#59605a,#252c35 70%); border-radius:14px; margin-bottom:12px; }
.appearance-stage canvas { width:174px; height:240px; object-fit:contain; }
.appearance-picker { display:grid; grid-template-columns:48px 44px minmax(0,1fr) 44px; align-items:center; gap:8px; margin:12px 0 8px; }
.appearance-picker button { font-size:26px; min-height:44px; padding:0; }
.appearance-picker select { width:100%; min-width:0; }
@media (max-height:700px) { .appearance-stage canvas { width:116px; height:160px; } }

.appearance-controls { min-width:0; }
.appearance-picker button { margin:0; }
@media (max-height:740px) {
  #panel[data-feature-view="appearance"] { padding:16px; max-height:94dvh; }
  #panel[data-feature-view="appearance"] .panel-heading { margin-bottom:10px; }
  .appearance-layout { display:grid; grid-template-columns:minmax(72px, 1fr) minmax(172px, 2fr); gap:14px; align-items:center; }
  .appearance-stage { margin:0; align-self:stretch; align-items:center; min-width:0; }
  .appearance-stage canvas { width:100%; max-width:174px; height:auto; max-height:240px; }
  .appearance-controls > .small { margin:0 0 8px; }
  .appearance-picker { grid-template-columns:36px minmax(0,1fr) 36px; gap:4px; margin:8px 0; }
  .appearance-picker > span { grid-column:1 / -1; font-size:12px; }
  .appearance-picker select { padding:8px 4px; }
}
@media (max-height:450px) and (min-width:540px) {
  .appearance-picker { grid-template-columns:36px 40px minmax(0,1fr) 40px; }
  .appearance-picker > span { grid-column:auto; }
  .appearance-stage canvas { max-height:190px; width:auto; max-width:100%; }
}

.friend-identity { display:flex; align-items:center; gap:10px; min-width:0; flex:1; }
.friend-identity > span { overflow-wrap:anywhere; }
.friend-portrait { width:44px; height:44px; flex:0 0 44px; border-radius:50%; background:#e6ecde; border:1px solid var(--line); }
.friend-row > button { flex-shrink:0; }
@media (max-width: 600px) {
  .topbar .player-info { flex:1 1 auto; min-width:0; }
  .topbar .player-info strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .topbar .hp-row { flex-wrap:wrap; gap:2px; }
  .topbar .hp-row progress { width:100%; min-width:0; }
  .topbar .place { display:none; }
}

@media (max-width:600px) {
  .topbar { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:5px; padding:8px; }
  .topbar .wordmark, .topbar .place { display:none; }
  .topbar .player-info { grid-column:1 / -1; display:flex; align-items:center; gap:12px; }
  .topbar .player-info strong { flex:1; }
  .topbar .hp-row { flex-wrap:nowrap; width:150px; }
  .topbar .hp-row progress { width:80px; }
  .topbar .hp-row span { white-space:nowrap; }
  .topbar > .icon-button { justify-self:end; }
}

/* Bottom HUD row removed: keep both control pads near the safe bottom edge. */
.skill-bar, #touch-controls { bottom:calc(env(safe-area-inset-bottom, 0px) + 12px); }

#quick-consumable .quick-key-hint {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #ffffff80;
  border-radius: 5px;
  background: #16352e;
  color: #fff;
  font: 700 12px/1 sans-serif;
  pointer-events: none;
}

.inventory-preview { margin-bottom:18px; }
.inventory-preview .appearance-stage { min-height:160px; }
.inventory-preview .appearance-stage canvas { width:145px; height:200px; }
.inventory-preview .appearance-picker { margin:8px 0; }
.inventory-preview .small { text-align:center; }

.inventory-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin-bottom:16px; }
.inventory-tabs .inventory-tab { margin:0; padding:10px 4px; min-height:44px; font-size:13px; border:1px solid #b6c7bf; border-radius:10px; background:#edf3ef; color:#264437; }
.inventory-tabs .inventory-tab[aria-current="page"] { background:#235d48; color:white; border-color:#235d48; font-weight:700; }
.inventory-tabs .inventory-tab:focus-visible { outline:3px solid #d69232; outline-offset:2px; }

.inventory-categories { grid-template-columns:repeat(5,minmax(0,1fr)); margin-top:12px; }
