/* The compact reserve has a title/control row and an explicit card shelf. */
main.shell>.hand-panel{
  min-width:0;max-width:100%;
}
.hand-panel>.hand-heading{min-width:0;max-width:100%;flex-wrap:wrap}
.hand-panel>.hand-heading>h3,.hand-panel .hand-count{min-width:0;white-space:normal;overflow-wrap:anywhere}
.hand-title-heading{display:grid;grid-template-columns:minmax(0,1fr) 48px;align-items:center;gap:4px;flex:0 1 auto;min-width:0;max-width:100%}
.hand-title-heading>h3{min-width:0;margin:0;white-space:normal;overflow-wrap:anywhere}
.hand-title-heading>.info-control{flex:none}
.hand-panel>.hand-strip{min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain}
.hand-panel>.hand-strip:not(:has(>.hand-card)){min-height:72px;height:auto;border:1px dashed #9b9c7155;border-radius:5px}
/* Web reserve always offers one real shop slot; cards remain native drop targets. */
html:not([data-platform="android"]) main.shell>.hand-panel{
  height:auto;min-height:0;grid-template-rows:auto auto;row-gap:4px;
}
html:not([data-platform="android"]) .hand-panel>.hand-heading{min-height:0;height:auto;margin:0}
html:not([data-platform="android"]) .hand-panel .hand-count{display:none}
html:not([data-platform="android"]) .hand-panel>.hand-strip:has(>.hand-shop-slot){
  height:auto;min-height:112px;padding:4px 3px 8px;align-items:stretch;border:0;background:transparent;
}
html:not([data-platform="android"]) .hand-strip>.hand-shop-slot{
  display:flex;align-items:center;justify-content:center;flex:0 0 112px;align-self:stretch;
  width:112px;min-width:112px;min-height:104px;margin:0;padding:12px;
  border:2px solid #bda16a;border-radius:6px;background:#b99a4b12;color:#ead5a2;
  box-shadow:inset 0 0 0 2px #c7aa6340,0 0 5px #c9a95b38;font:400 var(--type-heading)/1 var(--sans);
  animation:reserve-slot-gold 3.6s ease-in-out infinite;
}
html:not([data-platform="android"]) .hand-shop-slot>.hand-shop-plus{display:block;flex:0 0 36px;width:36px;height:36px;background:linear-gradient(currentColor,currentColor) center/3px 100% no-repeat,linear-gradient(currentColor,currentColor) center/100% 3px no-repeat;pointer-events:none}
html:not([data-platform="android"]) .hand-strip>.hand-shop-slot:focus-visible{outline:3px solid #f0d391;outline-offset:2px}
html:not([data-platform="android"]) .hand-strip>.hand-shop-slot:hover{background:#b99a4b26}
@keyframes reserve-slot-gold{0%,100%{border-color:#bda16a;box-shadow:inset 0 0 0 2px #c7aa6340,0 0 5px #c9a95b38}50%{border-color:#f0d391;box-shadow:inset 0 0 0 2px #e5c87877,0 0 14px #d9b75b77}}
@media(prefers-reduced-motion:reduce){html:not([data-platform="android"]) .hand-strip>.hand-shop-slot{animation:none;border-color:#e4c37a;box-shadow:inset 0 0 0 2px #e5c87866,0 0 10px #d9b75b66}}
@media(min-width:1000px) and (min-height:680px){
  main.shell:has(>.hand-panel){
    height:auto;min-height:100dvh;
    grid-template-rows:auto auto minmax(min-content,1fr) auto auto auto;
  }
  main.shell>.hand-panel{
    display:grid;grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto minmax(112px,auto);gap:4px;padding:8px 10px;
  }
  .hand-panel>.hand-heading{grid-column:1;grid-row:1;margin:0}
  .hand-panel>.hand-strip{
    grid-column:1;grid-row:2;height:auto;min-height:112px;padding:4px 3px 8px;align-items:stretch;
  }
  main.shell>.hand-panel:has(>.hand-strip:not(:has(>.hand-card))){grid-template-rows:auto minmax(72px,auto)}
  .hand-panel>.hand-strip:not(:has(>.hand-card)){min-height:72px}
  .hand-panel .hand-auto{min-height:48px;padding:6px 10px}
  .hand-panel .hand-strip>.hand-card{
    display:grid;grid-template-columns:74px minmax(0,1fr);align-items:stretch;
    height:auto;min-height:96px;flex-shrink:0;
  }
  .hand-panel .hand-card .portrait{position:relative;inset:auto;width:74px;height:auto}
  .hand-panel .hand-card .unit-body{position:static;inset:auto;min-width:0;padding:6px}
}
/* Rank and faction occupy portrait corners; stats and defense keep their own rows. */
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card{
  display:grid;grid-template-columns:minmax(0,1fr);grid-auto-rows:auto;align-content:start;align-items:start;
  gap:4px;position:relative;height:auto;min-height:0;max-height:none;padding:8px;overflow:visible;
}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.portrait{
  grid-column:1;grid-row:1;position:relative;inset:auto;width:100%;max-width:none;height:auto;aspect-ratio:1;align-self:start;
}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.faction-icon{
  grid-column:auto;grid-row:auto;position:absolute;inset:12px auto auto 12px;
  width:20px;height:20px;margin:0;z-index:7;pointer-events:none;
}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.rank{
  grid-column:auto;grid-row:auto;position:absolute;inset:12px 12px auto auto;
  width:max-content;min-width:20px;max-width:36px;min-height:20px;margin:0;padding:2px 4px;gap:0;
  border:1px solid #9d8151;background:#eadbb8;color:#443421;text-shadow:none;line-height:1;z-index:7;pointer-events:none;
}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.rank>.ranksteps{display:none}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.unit-body{
  grid-column:1;grid-row:2;position:static;inset:auto;min-width:0;width:100%;max-width:100%;height:auto;
  padding:4px 0;overflow:visible;box-sizing:border-box;
}
html:not([data-platform="android"]) #app .hand-panel .hand-card .unit-name{
  display:block;min-width:0;max-width:100%;font:600 var(--type-body)/1.25 var(--sans);
  white-space:normal;overflow:visible;overflow-wrap:anywhere;text-overflow:clip;-webkit-line-clamp:unset;
}
html:not([data-platform="android"]) #app .hand-panel .hand-card .unit-stats{
  display:flex;flex-direction:column;align-items:flex-start;gap:3px;min-width:0;max-width:100%;
}
html:not([data-platform="android"]) #app .hand-panel .hand-card :is(.hp-text,.attack-stat){min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.shield-pill{
  grid-column:1;grid-row:3;position:static;inset:auto;align-self:start;justify-self:start;
  width:fit-content;min-width:0;max-width:100%;margin:0;padding:3px 5px;
  white-space:normal;overflow-wrap:anywhere;line-height:1.2;box-sizing:border-box;
}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.shield-pill.hidden{display:none}
html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.hand-merge-status{
  grid-column:1/-1;grid-row:4;min-width:0;max-width:100%;margin:0;padding:6px 0;box-sizing:border-box;
}
@media(min-width:1000px) and (min-height:680px){
  html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card{grid-template-columns:74px minmax(0,1fr);column-gap:8px}
  html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.rank{right:calc(100% - 80px)}
  html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.portrait{grid-column:1;grid-row:1;width:74px;height:74px}
  html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.unit-body{grid-column:2;grid-row:1}
  html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.shield-pill{grid-column:1/-1;grid-row:2}
  html:not([data-platform="android"]) #app main.shell>.hand-panel>.hand-strip>.hand-card>.hand-merge-status{grid-row:3}
}
