/* Keep controls reachable even when a small room is letterboxed. */
.game-shell-v2 {
  --hud-inset-x: 0px;
  --hud-inset-y: 0px;
  --hud-panel: rgba(20, 29, 28, 0.92);
  --hud-border: rgba(204, 217, 204, 0.25);
  --hud-text: #f1f4ec;
  --hud-muted: #bdcbbf;
  --hud-accent: #e5cb82;
  --hud-gap: 12px;
  --skill-rail-gap: 8px;
  --skill-rail-height: calc(var(--skill-button-size, 58px) * 4 + var(--skill-rail-gap) * 3);
}

.game-shell-v2 .combat-hud,
.game-shell-v2 .dimension-quest-tracker,
.game-shell-v2 .skill-bar button,
.game-shell-v2 .game-menu-toggle,
.game-shell-v2 .server-automation-toggle,
.game-shell-v2 .game-screen > .hud-chat ol,
.game-shell-v2 .game-screen > .hud-chat .chat-toggle {
  border: 1px solid var(--hud-border);
  border-radius: 6px;
  background: var(--hud-panel);
  color: var(--hud-text);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  font-family: system-ui, sans-serif;
  text-shadow: none;
  letter-spacing: 0;
}
.game-shell-v2 .combat-hud {
  top: max(env(safe-area-inset-top, 0px), calc(var(--hud-inset-y) + var(--hud-gap)));
  left: max(env(safe-area-inset-left, 0px), calc(var(--hud-inset-x) + var(--hud-gap)));
  width: 280px;
  max-width: calc(100vw - 140px);
  padding: 10px 12px;
  gap: 6px;
  image-rendering: auto;
}
.game-shell-v2 .combat-hud-line,
.game-shell-v2 .combat-users-row .online-count { font-family: system-ui, sans-serif; text-shadow: none; font-size: 13px; line-height: 1.3; letter-spacing: 0; }
.game-shell-v2 .combat-users-row { gap: 7px; }
.game-shell-v2 .combat-users-row .online-count { color: var(--hud-muted); font-size: 11px; }
.game-shell-v2 .combat-users-row .users-toggle { min-height: 26px; font-size: 12px; padding: 3px 7px; }
.game-shell-v2 .combat-meter { height: 21px; grid-template-columns: 30px minmax(0, 1fr); gap: 7px; }
.game-shell-v2 .combat-meter-label { font: 700 11px system-ui, sans-serif; text-shadow: none; letter-spacing: 0; }
.game-shell-v2 .combat-meter-track { border: 1px solid rgba(0, 0, 0, 0.28); border-radius: 3px; background: #0e1817; box-shadow: none; }
.game-shell-v2 .combat-meter-text { font: 600 12px system-ui, sans-serif; text-shadow: 0 1px 2px #111; letter-spacing: 0; }
.game-shell-v2 .combat-meter-fill { box-shadow: none; background-image: none; }
.game-shell-v2 #combat-hp-bar { background: #c95858; }
.game-shell-v2 #combat-mp-bar { background: #438cae; }
.game-shell-v2 #combat-exp-bar { background: #ba9c47; }
.game-shell-v2 .combat-hud-money { color: var(--hud-accent); }
.game-shell-v2 .combat-currency-amount .currency-icon { width: 15px; height: 15px; flex-basis: 15px; }
.game-shell-v2 .combat-buffs { top: 0; left: calc(100% + 8px); }
.game-shell-v2 .context-actions:not(.has-shop-catalog):not(.has-rune-exchange):not(.closedVenue-actions):not(.has-bank-controls) {
  top: calc(max(env(safe-area-inset-top, 0px), var(--hud-gap)) + var(--combat-hud-height, 156px) + var(--hud-gap));
  left: max(env(safe-area-inset-left, 0px), var(--hud-gap));
  max-width: min(720px, calc(100vw - var(--hud-gap) * 2));
}
.game-shell-v2 .context-actions:not(.has-shop-catalog):not(.has-rune-exchange):not(.closedVenue-actions):not(.has-bank-controls) > button {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.game-shell-v2 .game-menu-toggle { top: calc(var(--hud-inset-y) + var(--hud-gap)); right: calc(var(--hud-inset-x) + var(--hud-gap)); width: 46px; height: 46px; }
.game-shell-v2 .server-automation-toggle { top: calc(var(--hud-inset-y) + var(--hud-gap)); right: calc(var(--hud-inset-x) + var(--hud-gap) + 54px); min-width: 56px; height: 46px; font-size: 12px; }
.game-shell-v2 .server-automation-toggle.is-active { border-color: #72bd95; background: #25483a; }
.game-shell-v2 .skill-bar-left { left: calc(var(--hud-inset-x) + var(--hud-gap)); }
.game-shell-v2 .skill-bar-right { right: calc(var(--hud-inset-x) + var(--hud-gap)); }
.game-shell-v2 .quick-login { top: calc(var(--hud-inset-y) + var(--hud-gap)); right: calc(var(--hud-inset-x) + var(--hud-gap) + 118px); min-height: 46px; border-radius: 6px; font: 600 12px system-ui; }
.game-shell-v2 .skill-bar {
  top: clamp(calc(var(--combat-hud-height, 132px) + var(--hud-gap) * 2), calc(50% - var(--skill-rail-height) / 2), calc(100% - var(--skill-rail-height) - var(--hud-gap)));
  bottom: auto;
  transform: none;
  gap: var(--skill-rail-gap);
  z-index: 35;
}
.game-shell-v2 .skill-bar button { padding: 6px; }
.game-shell-v2 .skill-bar button.is-empty { opacity: 0.75; }
.game-shell-v2 .skill-bar button:hover:not(:disabled) { border-color: var(--hud-accent); background: #2b3d33; }
.game-shell-v2 .skill-bar button:focus-visible { outline: 2px solid var(--hud-accent); outline-offset: 3px; }
.game-shell-v2 .skill-bar .interaction-button.has-interaction { border-color: #83c5a0; background: #284c3b; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2); }
.game-shell-v2 .skill-keycap { min-width: 14px; min-height: 14px; left: 3px; top: 3px; border-radius: 3px; background: #304238; color: #dce7dc; font: 700 9px system-ui; }
.game-shell-v2 .skill-button-icon { width: 30px; height: 30px; color: var(--hud-muted); }
.game-shell-v2 .skill-caption { font-size: 10px; line-height: 1.1; }
.game-shell-v2 .skill-quantity { border-radius: 3px; background: #304238; color: #f1f4ec; }
.game-shell-v2 .hud-icon { display: block; width: 24px; height: 24px; pointer-events: none; }
.game-shell-v2 .skill-button-icon .hud-icon { width: 26px; height: 26px; }
.game-shell-v2 .emote-button > .hud-icon { width: 28px; height: 28px; }
.game-shell-v2 .interaction-button-icon::before,
.game-shell-v2 .interaction-button-icon::after { display: none; }
.game-shell-v2 .dimension-quest-tracker { top: calc(var(--hud-inset-y) + var(--hud-gap) + 58px); right: calc(var(--hud-inset-x) + var(--hud-gap)); width: 280px; max-width: calc(100vw - 32px); gap: 7px; padding: 10px 12px; border-left: 3px solid var(--hud-accent); }
.game-shell-v2 .dimension-quest-tracker-icon,
.game-shell-v2 .dimension-quest-tracker-description,
.game-shell-v2 .dimension-quest-tracker-label { display: none; }
.game-shell-v2 .dimension-quest-tracker-header { grid-template-columns: minmax(0, 1fr) 36px; gap: 3px; }
.game-shell-v2 .dimension-quest-tracker-header > div,
.game-shell-v2 .dimension-quest-tracker-status { grid-column: 1; }
.game-shell-v2 .dimension-quest-tracker-toggle { grid-column: 2; grid-row: 1 / span 2; width: 36px; height: 36px; min-height: 36px; padding: 0; border: 1px solid var(--hud-border); border-radius: 4px; background: transparent; color: var(--hud-text); font-size: 18px; pointer-events: auto; }
.game-shell-v2 .dimension-quest-tracker-toggle:focus-visible { outline: 2px solid var(--hud-accent); outline-offset: 2px; }
.game-shell-v2 .dimension-quest-tracker.is-collapsed .dimension-quest-tracker-details,
.game-shell-v2 .dimension-quest-tracker.is-collapsed .dimension-quest-tracker-status { display: none; }
.game-shell-v2 .dimension-quest-tracker.is-collapsed .dimension-quest-tracker-toggle { grid-row: 1; }
.game-shell-v2 .dimension-quest-tracker-title { font-size: 13px; line-height: 1.4; white-space: normal; }
.game-shell-v2 .dimension-quest-tracker-status { justify-self: start; padding: 0; border: 0; background: none; color: var(--hud-muted); font-size: 11px; }
.game-shell-v2 .dimension-quest-tracker-details { padding-top: 6px; font-size: 12px; line-height: 1.4; border-color: var(--hud-border); }
.game-shell-v2 #dimension-quest-tracker-objective { gap: 5px; }
.game-shell-v2 .game-screen > .hud-chat { right: calc(var(--hud-inset-x) + var(--hud-gap)); bottom: max(env(safe-area-inset-bottom, 0px), calc(var(--hud-inset-y) + var(--hud-gap))); width: 340px; max-width: calc(100vw - 32px); gap: 7px; }
.game-shell-v2 .game-screen > .hud-chat ol { padding: 10px 12px; gap: 3px; font-size: 13px; line-height: 1.4; }
.game-shell-v2 .game-screen > .hud-chat li { line-height: inherit; }
.game-shell-v2 .game-screen > .hud-chat .chat-toggle { width: 40px; min-height: 36px; padding: 6px; }
.game-shell-v2 .game-screen > .hud-chat #chat-form input { background: var(--hud-panel); border-color: var(--hud-border); color: var(--hud-text); border-radius: 6px; }
@media (max-width: 900px) {
  .game-shell-v2 { --hud-gap: 8px; --hud-inset-x: 0px; }
  .game-shell-v2 .combat-hud { width: 236px; max-width: calc(100vw - 136px); padding: 7px 8px; gap: 4px; }
  .game-shell-v2 .combat-hud-line { font-size: 12px; }
  .game-shell-v2 .combat-users-row .online-count { font-size: 10px; }
  .game-shell-v2 .combat-users-row .users-toggle { font-size: 11px; padding: 2px 4px; min-height: 22px; }
  .game-shell-v2 .combat-meter { height: 18px; gap: 4px; grid-template-columns: 25px minmax(0, 1fr); }
  .game-shell-v2 .combat-meter-text,
  .game-shell-v2 .combat-meter-label { font-size: 10px; }
  .game-shell-v2 .combat-buffs { top: calc(100% + 5px); left: 0; max-width: 100%; }
  .game-shell-v2 .context-actions:not(.has-shop-catalog):not(.has-rune-exchange):not(.closedVenue-actions):not(.has-bank-controls) {
    top: calc(max(env(safe-area-inset-top, 0px), var(--hud-gap)) + var(--combat-hud-height, 132px) + var(--combat-buffs-height, 0px) + var(--hud-gap) * 2);
    left: max(72px, calc(env(safe-area-inset-left, 0px) + 64px));
    max-width: calc(100vw - 144px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  }
  .game-shell-v2 .quick-login { top: calc(var(--hud-inset-y) + 62px); right: calc(var(--hud-inset-x) + 8px); min-height: 30px; font-size: 11px; }
  .game-shell-v2 .dimension-quest-tracker { top: max(148px, calc(var(--combat-hud-height, 132px) + 16px)); right: 72px; bottom: auto; width: 246px; max-width: calc(100vw - 144px); padding: 7px 9px; gap: 4px; }
  .game-shell-v2 .dimension-quest-tracker-title { font-size: 12px; }
  .game-shell-v2 .dimension-quest-tracker-details { font-size: 11px; }
  .game-shell-v2 .game-screen > .hud-chat { left: 72px; right: 72px; bottom: max(8px, env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; }
  .game-shell-v2 .game-screen > .hud-chat ol { font-size: 12px; max-height: 112px; padding: 7px 9px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .game-shell-v2 .context-actions:not(.has-shop-catalog):not(.has-rune-exchange):not(.closedVenue-actions):not(.has-bank-controls) {
    left: max(72px, calc(env(safe-area-inset-left, 0px) + 64px));
    max-width: calc(100vw - 144px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  }
  .game-shell-v2 .dimension-quest-tracker { top: 104px; bottom: auto; right: 76px; width: 210px; }
  .game-shell-v2 { --skill-button-size: 42px; --skill-rail-gap: 6px; }
  .game-shell-v2 .combat-hud { padding: 5px 8px; gap: 3px; }
  .game-shell-v2 .combat-meter { height: 15px; }
  .game-shell-v2 .skill-bar button { width: 42px; height: 42px; min-height: 42px; padding: 4px; }
  .game-shell-v2 .quick-login { top: 62px; }
  .game-shell-v2 .dimension-quest-tracker-status { display: none; }
  .game-shell-v2 .game-screen > .hud-chat ol { max-height: 70px; }
}
@media (max-height: 360px) {
  .game-shell-v2 { --skill-button-size: 42px; --skill-rail-gap: 6px; --hud-gap: 6px; }
  .game-shell-v2 .combat-hud { max-height: 98px; overflow-y: auto; pointer-events: auto; }
}
