#renewalHud, #renewalDock {
 --hud-brass: #ad854d;
 --hud-ink: #fff0ce;
 --hud-surface: linear-gradient(175deg, #382b1f, #17130e 82%);
 --hud-edge: inset 0 0 0 2px #19130e, inset 0 0 0 3px #735535, 0 3px 10px #21170da0;
}

body.playing:not(.sheet-mode) {
 --field-dock: clamp(64px, 12dvh, 115px);
 background: #1b160f;
}
body.playing:not(.sheet-mode) main { max-width: none; padding: 0; }
body.playing:not(.sheet-mode) main > header,
body.playing:not(.sheet-mode) :is(#join, #leaveButton, #avatarSelect, #settingsOpen, #teamOpen, #eventSchedule, #party, #progressInfo, footer),
body.playing:not(.sheet-mode) #game :is(#collectionOpen, #pvpOpen) { display: none; }

body.playing:not(.sheet-mode) #game {
 min-height: 0;
 max-height: none;
 height: 100dvh;
 aspect-ratio: auto;
}
body.playing:not(.sheet-mode) #game:has(#minimap:not([hidden])) #hud {
 inset: auto auto calc(var(--field-dock) + 4px) 8px;
 max-width: min(82%, 430px);
}
body.playing:not(.sheet-mode) #minimap {
 top: 99px;
 border: 1px solid #ad854d;
 box-shadow: 0 3px 10px #21170d80;
 background: #201911ef;
}
body.playing:not(.sheet-mode) #fieldZoomBar button {
 background: #302319 !important;
 border-color: #ad854d !important;
}
body.playing:not(.sheet-mode) #controls { bottom: calc(var(--field-dock) + 28px); }

#renewalHud { position: absolute; inset: 0 0 auto; z-index: 7; pointer-events: none; }
#renewalProfile, #renewalMenu, #renewalDock {
 border: 1px solid var(--hud-brass);
 background: var(--hud-surface);
 box-shadow: var(--hud-edge);
 color: var(--hud-ink);
}
#renewalProfile {
 display: grid;
 grid-template-columns: auto minmax(0, 1fr);
 gap: 8px;
 align-items: center;
 position: absolute;
 inset: 7px auto auto 8px;
 width: min(240px, 48vw);
 min-height: 77px;
 padding: 7px 9px;
 border-radius: 8px;
}
#game #renewalPortrait {
 width: 48px;
 height: 48px;
 object-fit: contain;
 border-radius: 50%;
 border: 1px solid #ad854d;
 background: radial-gradient(circle at 50% 32%, #765638, #2c2117 74%);
}
#renewalProfile strong, #renewalPlace, #renewalLead {
 display: block;
 overflow: hidden;
 white-space: nowrap;
 text-overflow: ellipsis;
}
#renewalPlace, #renewalLead { font-size: 10px; color: #e7cc9c; }
.renewalVitals { display: grid; grid-template-columns: auto 1fr auto; gap: 4px; align-items: center; font-size: 9px; }
.renewalVitals progress { width: 100%; height: 9px; accent-color: #b84c3b; }
#renewalMenu {
 display: flex;
 position: absolute;
 right: max(8px, env(safe-area-inset-right));
 top: 7px;
 max-width: calc(100vw - 264px);
 padding: 4px;
 gap: 3px;
 border-radius: 8px;
 overflow-x: auto;
 pointer-events: auto;
}
#renewalMenu button, #renewalDock button {
 color: var(--hud-ink);
 background: linear-gradient(#4b3523, #251c13);
 border: 1px solid #9f7848;
}
#renewalMenu button { white-space: nowrap; padding: 7px 9px; font-size: 12px; }
#renewalMenu button:hover, #renewalDock button:hover, #renewalSlots button[aria-pressed="true"] {
 border-color: #f5ce74;
 background: linear-gradient(#755330, #362716);
}
#renewalDock {
 position: absolute;
 z-index: 6;
 inset: auto max(1px, env(safe-area-inset-right)) max(1px, env(safe-area-inset-bottom)) max(1px, env(safe-area-inset-left));
 display: grid;
 grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
 height: var(--field-dock);
 padding: 5px 8px;
 gap: 8px;
 border-radius: 8px;
}
#renewalDock #fieldChat, #renewalParty {
 display: flex;
 flex-direction: column;
 min-width: 0;
 min-height: 0;
 gap: 2px;
 margin: 0;
 padding: 0 4px;
 color: inherit;
 border: 0;
 background: transparent;
}
#renewalDock :is(#fieldChat > strong, #renewalPartyLabel) { font-size: 11px; color: #f2d5a0; }
#renewalDock #fieldChatLog { flex: 1; min-height: 0; margin: 0; font-size: 11px; }
#renewalDock #fieldChatLog strong { color: #efd098; }
#renewalDock #fieldChatForm { margin: 0; }
#renewalDock #fieldChatInput { padding: 3px 4px; font-size: 12px; background: #18140e; border-color: #806343; }
#renewalDock #fieldChatForm button { padding: 3px 5px; font-size: 11px; }
#renewalDock #fieldChatNotice { color: #f7cf85; font-size: 10px; }
#renewalSlots { display: flex; flex: 1; min-height: 0; gap: 5px; overflow-x: auto; }
#renewalSlots button {
 display: grid;
 flex: 0 0 clamp(34px, 6vw, 82px);
 grid-template-rows: minmax(0, 1fr) auto;
 align-items: center;
 justify-items: center;
 padding: 2px 4px;
 font-size: 10px;
 white-space: nowrap;
}
#game #renewalSlots img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.renewalEmpty { align-self: center; font-size: 11px; color: #e0c8a7; }
#renewalEvents { color: #fff0ce; background: #231a13; border: 1px solid #ad854d; border-radius: 8px; max-width: min(90vw, 500px); }
#renewalEvents::backdrop { background: #16110aa0; }

.sheet-mode :is(#renewalHud, #renewalDock),
#game.battling :is(#renewalHud, #renewalDock),
#game:has(#collectionPanel:not([hidden]), #lab:not([hidden]), #pvpPanel:not([hidden])) #renewalDock { display: none; }
body.playing:not(.sheet-mode) #game.battling #controls { bottom: 6px; }
body.playing:not(.sheet-mode) :is(#notice, #recoveryNotice, #gymAnnouncement, #royalAnnouncement, #legendaryAnnouncement, #dungeonRunHud) {
 position: fixed;
 z-index: 27;
 left: 50%;
 bottom: calc(var(--field-dock) + 4px);
 transform: translateX(-50%);
 width: max-content;
 max-width: min(65vw, 540px);
 margin: 0;
 padding: 4px 8px;
 background: #241a12ee;
 color: #fff0ce !important;
 border-radius: 4px;
 pointer-events: none;
}
body.playing:not(.sheet-mode) #dungeonRunHud { top: 49px; bottom: auto; pointer-events: auto; }
body.playing:not(.sheet-mode) :is(#notice, #recoveryNotice):empty { display: none; }
body.playing:not(.sheet-mode) #recoveryNotice { bottom: calc(var(--field-dock) + 28px); }
body.playing:not(.sheet-mode) :is(#gymAnnouncement, #royalAnnouncement, #legendaryAnnouncement) { top: 76px; bottom: auto; }
@media (hover: hover) and (pointer: fine) {
 body.playing:not(.sheet-mode) #controls { display: none; }
}
@media (max-width: 720px) {
 #renewalMenu { max-width: calc(100vw - 51vw); }
 #renewalMenu button { padding: 6px; font-size: 11px; }
 #renewalDock { grid-template-columns: 43% minmax(0, 1fr); padding: 4px; gap: 3px; }
 #renewalProfile { padding: 5px; gap: 5px; min-height: 67px; }
 #game #renewalPortrait { width: 32px; height: 32px; }
 body.playing:not(.sheet-mode) #minimap { top: 80px; }
}
@media (max-width: 720px) {
 body.playing:not(.sheet-mode) #game:not(.battling) #joystick { width: 108px; height: 108px; }
 body.playing:not(.sheet-mode) #game:not(.battling) #thumb { width: 36px; height: 36px; }
 body.playing:not(.sheet-mode) #game:not(.battling) #controls .ab {
  display: flex; flex-direction: row; position: static; align-items: end; width: auto; height: auto;
 }
 body.playing:not(.sheet-mode) #game:not(.battling) #controls .ab button {
  position: static; width: 47px; height: 47px; margin: 0;
 }
 body.playing:not(.sheet-mode) #game:not(.battling) #controls .ab #interact { width: 57px; height: 57px; }
 #renewalDock #fieldChatInput { font-size: 16px; padding: 2px 4px; }
}

body:not(.sheet-mode) #game #battleScenery,
body:not(.sheet-mode) #teamScenery { image-rendering: auto; }
body:not(.sheet-mode) #battlefield { border: 1px solid #ad854d; border-radius: 7px; overflow: hidden; }
body:not(.sheet-mode) #battle .hpbox {
 width: min(42%, 270px);
 border: 1px solid #aa8659;
 border-radius: 5px;
 padding: 5px 8px;
 background: #231d16eb;
 color: #f8e6c4;
 box-shadow: 0 2px 8px #1b150e9e;
 font: 600 clamp(11px, 1.4vw, 16px) system-ui,sans-serif;
 z-index: 3;
}
body:not(.sheet-mode) #battle .hpbox::after { display: none; }
body:not(.sheet-mode) #battle .hpbox.enemy { left: 8px; }
body:not(.sheet-mode) #battle .hpbox.own { right: 8px; }
body:not(.sheet-mode) #battle #battleBottom,
body:not(.sheet-mode) #battle :is(#battlemsg,#actions,#battleSub) {
 background: #2d241b;
 color: #f9eaca;
 border-color: #987b52;
}
body:not(.sheet-mode) #battle button {
 background: linear-gradient(#715534,#3b2d20);
 color: #fff0cf;
 border-color: #ad854d;
}
body:not(.sheet-mode) #battle button:is(:hover,:focus-visible,.selected) {
 filter: brightness(1.2);
 outline-color: #f0be75;
}

#battleTurn {
 align-self: center;
 position: absolute;
 top: 0;
 z-index: 6;
 padding: 2px 8px;
 border: 1px solid #aa8659;
 border-radius: 4px;
 background: #251c13;
 color: #f8e6c4;
 font-size: 11px;
}
.sheet-mode #battleTurn { background: #f4f6ee; color: #293c29; border-color: #667c66; }

#fieldChatTabs {
 display: flex;
 flex: 0 0 auto;
 gap: 2px;
 overflow-x: auto;
 scrollbar-width: thin;
}
#fieldChatTabs button {
 font-size: 10px;
 padding: 1px 6px;
 white-space: nowrap;
}
#fieldChatTabs button[aria-pressed="true"] {
 background: #775635;
 color: #fff4dd;
 border-color: #d9b678;
}

#renewalSlots button {
 position: relative;
 grid-template-rows: minmax(0, 1fr) auto 3px;
}
#renewalSlots progress {
 width: 100%;
 height: 3px;
 accent-color: #88bd69;
}
.renewalSlotStatus {
 position: absolute;
 top: 2px;
 left: 2px;
 max-width: calc(100% - 4px);
 overflow: hidden;
 text-overflow: ellipsis;
 color: #fff1ce;
 background: #6f3d3ce5;
 border-radius: 2px;
 padding: 0 2px;
 font-size: 8px;
}

body:not(.sheet-mode) #game.battling,
body:not(.sheet-mode) #game #battle { background: #211a13; }
body:not(.sheet-mode) #battle .sprite {
 width: 34%;
 height: 43%;
}
body:not(.sheet-mode) #battle .sprite img { object-position: center bottom; }
body:not(.sheet-mode) #battle .own-sprite { left: 5%; bottom: 15%; }
body:not(.sheet-mode) #battle .enemy-sprite { top: auto; right: 7%; bottom: 32%; }
body:not(.sheet-mode) #battle :is(#actions,#battleSub) button,
body:not(.sheet-mode) #battle #battleContinue {
 background: linear-gradient(#715534,#3b2d20);
 color: #fff0cf;
 border: 1px solid #987847;
}
body:not(.sheet-mode) #battle :is(#actions,#battleSub) button:disabled { opacity: .5; }

#reconnectOverlay {
 position: fixed;
 z-index: 60;
 top: 50%;
 left: 50%;
 transform: translate(-50%,-50%);
 width: min(90vw, 360px);
 padding: 14px;
 border: 1px solid #ad854d;
 border-radius: 8px;
 background: #292018;
 color: #fff0ce;
 text-align: center;
 box-shadow: 0 0 0 100vmax #13100cb3;
}
#reconnectOverlay p { margin: 0 0 10px; }

#avatarOptions button img {
 width: min(100%, 96px);
 height: 96px;
 object-fit: contain;
 background: radial-gradient(ellipse at 50% 78%, #ac8b555c, transparent 67%);
}
#game .residentPortrait {
 background: radial-gradient(ellipse at 50% 80%, #c2aa81, #efe6c9 72%);
 object-fit: contain;
 image-rendering: auto;
}
#game canvas,
#game :is(#starterChoices, .pokemonCard, .dexGrid, #renewalSlots) img,
#game #battle .sprite img,
.teamCard img { image-rendering: auto; }
#game #battle .sprite img {
 transform-origin: 50% 85%;
 filter: drop-shadow(0 4px 4px #201a2466);
}
#game #battle .sprite.cast-down img { opacity: .44; filter: saturate(.34); }
#game #battle .sprite.hit { animation: cast-impact .24s ease-out; }
#game #battle .sprite.faint img { animation: cast-solo-fall .52s ease-out both; }
.cast-team-faint { animation: cast-fall .52s ease-out both; }
#game #battle .sprite.heal img,
.cast-team-heal { animation: cast-heal .6s ease-in-out; }
#game .damage-pop.recovery-pop { color: #acffb7; text-shadow: 0 1px 3px #154a27; }
#game #battle .sprite.hit,
#game #battle .sprite.hit::after,
#game #battle .sprite:is(.hit,.faint,.heal) img,
#game #battle .sprite .damage-pop { animation-delay: var(--battle-effect-delay, 0ms); }
#game #battle .sprite.hit::after,
#game #battle .sprite .damage-pop { animation-fill-mode: forwards; opacity: 0; }
@keyframes cast-impact {
 35% { translate: 4px -2px; }
}
@keyframes cast-fall {
 from { rotate: 0deg; }
 to { rotate: -13deg; translate: 0 7px; }
}
@keyframes cast-solo-fall {
 from { rotate: 0deg; translate: 0 0; opacity: 1; filter: drop-shadow(0 4px 4px #201a2466); }
 to { rotate: -13deg; translate: 0 7px; opacity: .44; filter: saturate(.34); }
}
@keyframes cast-heal {
 45% { filter: brightness(1.22) drop-shadow(0 0 11px #9af7ab); translate: 0 -4px; }
}
@media (prefers-reduced-motion: reduce) {
 #game #battle .sprite:is(.hit,.faint,.heal),
 #game #battle .sprite:is(.faint,.heal) img,
 .cast-team-faint,.cast-team-heal { animation: none; }
}

#game #battle .sprite::before {
 display: block;
 bottom: 15%;
 left: 50%;
 transform: translateX(-50%);
 width: min(45%, 156px);
 height: 10%;
 background: radial-gradient(ellipse, #241b17a6, #241b1744 45%, transparent 73%);
 pointer-events: none;
}
#teamField:has(#teamScenery[data-illustrated])::before { opacity: .32; }
#teamField:has(#teamScenery[data-illustrated]) .teamFigure::before {
 bottom: 10%;
 height: 18%;
 border-color: transparent;
 box-shadow: none;
 background: radial-gradient(ellipse, #251c1880, transparent 72%);
}
#teamField:has(#teamScenery[data-illustrated]) .teamCardActing .teamFigure::before {
 background: radial-gradient(ellipse, #fce28877, transparent 73%);
}

#avatarOptions button img,#game #renewalPortrait,#game .residentPortrait,#game #battle .sprite img,.teamFigure img,#game #renewalSlots img{image-rendering:auto;object-fit:contain}
#game #battle .sprite:not(.cast-down) img{filter:drop-shadow(0 2px 2px #251d1750)}

/* Original monster art only; keep player and NPC rendering unchanged. */
#game img[data-classic-monster="true"], .teamFigure img[data-classic-monster="true"], .teamCard img[data-classic-monster="true"] { image-rendering:pixelated !important; }
