:root {
  --iron1: #15151d;
  --iron2: #1e1e29;
  --line: #3a3a48;
  --blood: #a12323;
  --blood-b: #e04040;
  --gold: #c9a227;
  --gold-b: #ffd54a;
  --gold-soft: #e6cf8a;
  --jade: #426c66;
  --ink: #08090d;
  --bone: #d8cfc0;
  --bg: #050508;
  --panel: rgba(12, 12, 18, 0.94);
  --serif: "Batang", "BatangChe", "Gungsuh", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; height: 100dvh; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: #ddd8cc;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font-family: inherit; cursor: pointer; touch-action: manipulation; min-height: 44px; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0a10; }
::-webkit-scrollbar-thumb { background: #2c2c38; border-radius: 4px; }

#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; z-index: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }

#dim {
  position: absolute; inset: 0; z-index: 35;
  background: #000; opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
#dim.on { opacity: 0.82; }

#flash {
  position: absolute; inset: 0; z-index: 40;
  pointer-events: none; opacity: 0;
}

#loading {
  position: absolute; inset: 0; z-index: 95;
  background: radial-gradient(ellipse at center, #0d0d16, #030308);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s;
}
#loading.off { opacity: 0; pointer-events: none; }
.load-inner { text-align: center; }
.load-mark {
  font-family: var(--serif); font-size: 84px; color: var(--gold);
  text-shadow: 0 0 40px rgba(201,162,39,.4);
  animation: loadpulse 1.6s ease-in-out infinite;
  display: block;
}
@keyframes loadpulse { 0%,100% { opacity:.5; transform: scale(.96);} 50% { opacity:1; transform: scale(1.04);} }
.load-inner p { margin-top: 14px; color: #8f8a96; letter-spacing: 3px; font-size: 14px; }

.panel-ornate {
  position: relative;
  background: linear-gradient(180deg, var(--iron2), var(--iron1));
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05);
}
.panel-ornate::before, .panel-ornate::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border-color: var(--gold); border-style: solid; opacity: .8;
}
.panel-ornate::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel-ornate::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(5,5,9,.92), rgba(5,5,9,.55) 75%, transparent);
  border-bottom: 1px solid rgba(201,162,39,.25);
}
.profile { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #2a2a36, #101018);
  border: 2px solid var(--gold);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  font-family: var(--serif); font-size: 22px; color: var(--gold-b);
  text-shadow: 0 0 8px rgba(255,213,74,.5);
}
.pinfo { display: flex; flex-direction: column; gap: 2px; }
.pinfo b { font-size: 13px; color: var(--bone); }
.pinfo span { font-size: 11px; color: var(--gold-b); font-weight: 700; }
.expbar { width: 130px; height: 5px; background: #0c0c12; border-radius: 3px; overflow: hidden; }
.expbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6e1a1a, var(--blood-b)); transition: width .3s; }
.currencies { display: flex; gap: 8px; }
.res {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #1c1c26, #0e0e15);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 5px 13px; font-weight: 700; font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.res i { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.res.gem i { background: radial-gradient(circle at 35% 35%, #9fd8ff, #2f7fd6 60%, #123c74); }
.res.shard i { background: radial-gradient(circle at 35% 35%, #e8d8a8, #a12323 65%, #4a0f0f); }

#bottomnav {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: linear-gradient(0deg, rgba(4,4,7,.97), rgba(8,8,13,.88));
  border-top: 1px solid rgba(201,162,39,.3);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
#bottomnav button {
  flex: 1; background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 0 8px; color: #77778a;
  border-top: 2px solid transparent;
  transition: .15s;
}
#bottomnav button i {
  font-style: normal; font-family: var(--serif);
  font-size: 21px; line-height: 1.1;
}
#bottomnav button span { font-size: 11px; letter-spacing: 2px; }
#bottomnav button.on {
  color: var(--gold-b);
  border-top-color: var(--gold);
  background: linear-gradient(180deg, rgba(201,162,39,.12), transparent);
  text-shadow: 0 0 10px rgba(255,213,74,.4);
}
#bottomnav button:hover { color: #b8b4a4; }

.screen {
  position: absolute; inset: 0; z-index: 10;
  top: 62px; bottom: 58px;
  display: none;
}
.screen.active { display: flex; }

#scr-home { flex-direction: column; justify-content: center; overflow-y: auto; }
.event-strip {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: center; gap: 14px; align-items: center;
  background: linear-gradient(90deg, rgba(110,15,15,.0), rgba(110,15,15,.4) 20%, rgba(110,15,15,.4) 80%, rgba(110,15,15,0));
  padding: 6px 0; font-size: 12px; color: #e8b8b0;
}
.event-strip b { color: var(--gold-b); font-family: var(--serif); letter-spacing: 2px; }
.home-wrap {
  margin: auto; width: min(1080px, 96vw);
  display: grid; grid-template-columns: 340px 1fr; gap: 28px;
  align-items: center; padding: 30px 0 10px;
}
@media (max-width: 900px) {
  .home-wrap { grid-template-columns: 1fr; }
}

.banner-card {
  position: relative;
  border: 2px solid #2c2c38;
  outline: 1px solid rgba(201,162,39,.4);
  border-radius: 12px; overflow: hidden;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0,0,0,.75);
  height: 470px; display: flex; flex-direction: column;
}
.banner-card img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top; opacity: .88;
}
.banner-tag {
  position: relative; z-index: 2;
  background: linear-gradient(90deg, #4a0c0c, #8b1a1a 50%, #4a0c0c);
  color: #f0c8c0; text-align: center; font-size: 12px;
  letter-spacing: 3px; padding: 6px;
  border-bottom: 1px solid rgba(224,64,64,.4);
}
.banner-info {
  position: relative; z-index: 2; margin-top: auto;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(3,3,6,.95) 45%);
}
.banner-info h2 { font-family: var(--serif); font-size: 36px; color: #f2eee2; text-shadow: 0 0 14px rgba(224,64,64,.35), 0 2px 8px #000; }
.banner-info p { margin-top: 4px; }
.chip-tier {
  display: inline-block; font-weight: 900; font-size: 12px;
  padding: 2px 10px; border-radius: 4px; margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,.6);
}
.dim { color: #8f8a96; font-size: 13px; }
.small { font-size: 11px; }
.gold { color: var(--gold-b); }
.banner-shine {
  position: absolute; inset: -40%; z-index: 1;
  background: linear-gradient(115deg, transparent 42%, rgba(255,240,210,.13) 50%, transparent 58%);
  animation: shine 4.5s ease-in-out infinite;
}
@keyframes shine {
  0%, 60% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

.summon-panel { text-align: center; padding: 26px; border-radius: 12px; }
.title-main {
  font-family: var(--serif); font-size: clamp(34px, 5vw, 54px);
  color: var(--gold-b); letter-spacing: 8px;
  text-shadow: 0 0 26px rgba(224,64,64,.35), 0 0 40px rgba(201,162,39,.25), 0 3px 10px #000;
}
.sub { margin-top: 8px; color: #a09aa4; }

.pity-box {
  max-width: 460px; margin: 22px auto; padding: 14px 18px;
  background: rgba(6,6,10,.6); border: 1px solid var(--line); border-radius: 10px;
}
.pity-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.pity-head b { color: var(--blood-b); }
.pity-bar { height: 8px; border-radius: 4px; background: #0c0c12; overflow: hidden; border: 1px solid #26262f; }
.pity-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #6e1a1a, var(--blood-b) 60%, var(--gold-b));
  transition: width .4s;
  box-shadow: 0 0 8px rgba(224,64,64,.5);
}
.linklike {
  margin-top: 10px; background: none; border: none;
  color: #9a8fe8; font-size: 12px; text-decoration: underline;
}
.btn-row { display: flex; gap: 16px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.btn-row.center { margin-top: 20px; }

.gacha-btn {
  position: relative;
  min-width: 195px; padding: 15px 24px;
  border: 1px solid #6e5618; border-radius: 10px;
  background: linear-gradient(180deg, #2c2010 0%, #17100a 55%, #0e0a06 100%);
  color: #fff; transition: .15s;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,220,140,.18), 0 6px 18px rgba(0,0,0,.6);
}
.gacha-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255,235,180,.16), transparent);
  animation: btnshine 3.4s ease-in-out infinite;
}
@keyframes btnshine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
.gacha-btn em {
  display: block; font-style: normal;
  font-family: var(--serif); font-size: 21px; letter-spacing: 3px;
  color: var(--gold-b);
  text-shadow: 0 0 12px rgba(255,213,74,.35);
}
.gacha-btn span { display: block; margin-top: 4px; font-size: 12px; color: #a89a78; }
.gacha-btn.big em { font-size: 25px; color: #f0c0b0; text-shadow: 0 0 14px rgba(224,64,64,.45); }
.gacha-btn.big { border-color: #6e1a1a; }
.gacha-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255,220,140,.25), 0 10px 30px rgba(224,64,64,.28);
  border-color: var(--gold-b);
}
.gacha-btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.gacha-btn:disabled { opacity: .35; cursor: not-allowed; }
.gacha-btn.ghost { background: rgba(18,18,26,.9); border-color: #3a3a48; }
.gacha-btn.ghost em { color: #b8b4c4; text-shadow: none; }
.gacha-btn.ghost::after { display: none; }
.danger { background: #4a0f14; color: #f0b8b8; border: 1px solid #8b2b36; border-radius: 8px; padding: 8px 16px; }

#scr-summon { z-index: 12; }
.skipbtn { position: absolute; top: 14px; right: 18px; z-index: 5; font-size: 15px; padding: 9px 18px; }
.exitbtn { position: absolute; top: 14px; right: 118px; z-index: 5; font-size: 15px; padding: 9px 14px; }
.hbtn {
  background: linear-gradient(180deg, #1c1c26, #0e0e15); color: #c8c4b8;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; font-size: 13px; transition: .15s;
}
.hbtn:hover { background: rgba(201,162,39,.15); border-color: var(--gold); color: var(--gold-b); }
.colback { position: absolute; top: 10px; right: 14px; z-index: 20; }

#narration {
  position: absolute; bottom: 10vh; left: 0; right: 0;
  text-align: center; font-family: var(--serif);
  font-size: clamp(21px, 3.4vw, 36px); color: #f0e6d0;
  text-shadow: 0 0 18px rgba(224,64,64,.45), 0 2px 6px #000;
  opacity: 0; transition: opacity .3s; pointer-events: none;
  padding: 0 20px;
}

/* Pachislot-inspired expectation layer: omens, chance-ups and a final PUSH. */
.slot-hud {
  position: absolute; inset: 0; z-index: 4;
  pointer-events: none; overflow: hidden;
  --cue: #64a9ff; --cue-glow: rgba(70, 145, 255, .7);
}
.slot-hud[data-level="2"] { --cue: #64e7ff; --cue-glow: rgba(60, 220, 255, .72); }
.slot-hud[data-level="3"] { --cue: #c77dff; --cue-glow: rgba(178, 70, 255, .78); }
.slot-hud[data-level="4"] { --cue: #ff4538; --cue-glow: rgba(255, 45, 30, .82); }
.slot-hud[data-level="5"] { --cue: #ffe36a; --cue-glow: rgba(255, 201, 45, .9); }
.slot-hud::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0;
  background: #000; transition: opacity .16s;
}
.slot-hud::after {
  content: ""; position: absolute; inset: 0; z-index: 1; opacity: .18;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.04) 4px);
  mix-blend-mode: screen;
}
.slot-hud.is-blackout::before { opacity: .96; }
.slot-hud.is-reversal::before {
  opacity: .38;
  background: radial-gradient(circle, rgba(255,218,80,.2), rgba(120,0,0,.68) 54%, #000 90%);
  animation: reversalBg .5s steps(2) infinite;
}
.omen-ribbon {
  position: absolute; z-index: 3; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 270px)); min-width: 310px;
  display: grid; grid-template-columns: auto 1fr; column-gap: 11px; align-items: center;
  padding: 8px 16px 9px;
  background: linear-gradient(180deg, rgba(16,18,28,.95), rgba(4,5,10,.88));
  border: 1px solid color-mix(in srgb, var(--cue) 78%, #fff 22%);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 18px 100%, 0 50%);
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--cue-glow) 24%, transparent), 0 0 20px var(--cue-glow);
  transition: border-color .25s, box-shadow .25s;
}
.omen-ribbon span {
  grid-row: 1 / 3; min-width: 58px; color: #06070b; background: var(--cue);
  padding: 5px 9px; text-align: center; font-family: var(--serif); font-size: 18px; font-weight: 900;
  text-shadow: 0 1px rgba(255,255,255,.35); box-shadow: 0 0 14px var(--cue-glow);
}
.omen-ribbon b { color: #fff7df; font-family: var(--serif); font-size: 17px; letter-spacing: .08em; }
.omen-ribbon i { color: color-mix(in srgb, var(--cue) 72%, #fff 28%); font-size: 10px; font-style: normal; letter-spacing: .12em; }

.chance-meter {
  position: absolute; z-index: 3; top: 50%; left: 20px; transform: translateY(-50%);
  display: flex; flex-direction: column-reverse; gap: 5px; padding: 9px 7px;
  background: rgba(4,5,10,.78); border: 1px solid rgba(255,255,255,.14); border-radius: 4px;
}
.chance-meter::before {
  content: "期待度"; color: #b8b9c4; font-size: 9px; writing-mode: vertical-rl;
  position: absolute; left: 33px; bottom: 2px; letter-spacing: 3px;
}
.chance-meter span {
  width: 17px; height: 34px; display: block; transform: skewY(-13deg);
  background: #171925; border: 1px solid #303445; box-shadow: inset 0 0 8px #000;
}
.slot-hud[data-level="1"] .chance-meter span:nth-child(-n+1),
.slot-hud[data-level="2"] .chance-meter span:nth-child(-n+2),
.slot-hud[data-level="3"] .chance-meter span:nth-child(-n+3),
.slot-hud[data-level="4"] .chance-meter span:nth-child(-n+4),
.slot-hud[data-level="5"] .chance-meter span:nth-child(-n+5) {
  background: linear-gradient(90deg, color-mix(in srgb, var(--cue) 45%, #111), var(--cue), #fff4c0);
  border-color: var(--cue); box-shadow: 0 0 12px var(--cue-glow), inset 0 0 8px rgba(255,255,255,.5);
}
.slot-hud[data-level="5"] .chance-meter { animation: meterRainbow .5s linear infinite; }

.slot-alert {
  position: absolute; z-index: 4; top: 29%; left: 50%; transform: translate(-50%, -50%) scale(.7);
  min-width: 210px; text-align: center; padding: 5px 22px;
  color: #fff; font-family: var(--serif); font-size: clamp(24px, 4.4vw, 58px); font-weight: 900;
  letter-spacing: .08em; opacity: 0;
  text-shadow: 0 0 4px #000, 0 0 15px var(--cue), 3px 4px 0 #470b0b;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--cue) 75%, #fff 25%);
}
.slot-alert.burst { animation: alertBurst .7s cubic-bezier(.1,.85,.2,1) both; }

.stop-lamps {
  position: absolute; z-index: 4; bottom: 3.5vh; left: 50%; transform: translateX(-50%);
  display: flex; gap: clamp(12px, 4vw, 54px);
}
.stop-lamps span {
  width: 72px; height: 45px; display: flex; align-items: center; justify-content: center; gap: 5px;
  color: #555b69; background: linear-gradient(180deg, #161923, #06070c);
  border: 2px solid #353846; border-radius: 6px 6px 18px 18px;
  box-shadow: inset 0 -7px 12px #000, 0 3px 0 #020205;
}
.stop-lamps b { font-family: var(--serif); font-size: 18px; }
.stop-lamps i { font-size: 8px; font-style: normal; letter-spacing: 1px; }
.stop-lamps span.next {
  color: #15100a; background: linear-gradient(180deg, #fffbd1, var(--cue)); border-color: #fff;
  box-shadow: 0 0 22px var(--cue-glow), inset 0 2px rgba(255,255,255,.8);
  animation: stopNext .38s steps(2) infinite;
}
.stop-lamps span.locked {
  color: #fff; border-color: var(--cue); background: linear-gradient(180deg, color-mix(in srgb, var(--cue) 58%, #222), #18131a);
  box-shadow: 0 0 16px var(--cue-glow), inset 0 0 8px rgba(255,255,255,.25);
}

.slot-push {
  position: absolute; z-index: 8; left: 50%; bottom: 14vh; transform: translateX(-50%) scale(.55);
  width: 126px; height: 126px; border-radius: 50%; pointer-events: none; opacity: 0;
  color: #120b03; border: 7px solid #2a1a0b;
  background: radial-gradient(circle at 42% 32%, #fffbd0 0 8%, #ffd447 28%, #e25819 66%, #5d1008 72%);
  box-shadow: 0 0 0 4px #d3a943, 0 0 45px #ff3b20, inset 0 -16px 18px rgba(80,0,0,.5);
  font-family: var(--serif); cursor: pointer;
}
.slot-push small { display: block; margin-top: 12px; font-size: 10px; }
.slot-push b { display: block; font-size: 27px; letter-spacing: .04em; }
.slot-push.ready { pointer-events: auto; opacity: 1; transform: translateX(-50%) scale(1); animation: pushReady .56s ease-in-out infinite alternate; }
.slot-push.pressed { animation: pushPressed .28s ease-out both; }
.slot-hud.is-confirm .omen-ribbon { animation: confirmRibbon .6s ease-out both; }

@keyframes alertBurst {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(2.4); filter: blur(10px); }
  22% { opacity: 1; transform: translate(-50%,-50%) scale(.84); filter: none; }
  38%, 78% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.08); }
}
@keyframes stopNext { 50% { filter: brightness(1.7); transform: translateY(2px); } }
@keyframes pushReady { to { filter: brightness(1.32); box-shadow: 0 0 0 5px #fff0a0, 0 0 70px #ff3020, inset 0 -12px 16px rgba(80,0,0,.42); } }
@keyframes pushPressed { from { opacity: 1; transform: translateX(-50%) scale(1); } to { opacity: 0; transform: translateX(-50%) scale(1.7); } }
@keyframes reversalBg { 50% { filter: hue-rotate(35deg) brightness(1.5); } }
@keyframes meterRainbow { to { filter: hue-rotate(360deg); } }
@keyframes confirmRibbon { 35% { transform: translateX(-50%) scale(1.08); filter: brightness(1.8); } }

.overlay {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,2,5,.86);
  opacity: 0; visibility: hidden; transition: .25s;
}
.overlay.open { opacity: 1; visibility: visible; }
.panel {
  background: linear-gradient(180deg, #14141c, #0a0a10);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.05);
  max-width: 94vw;
  position: relative;
}
.panel::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201,162,39,.5), transparent);
}
.result-panel { width: min(880px, 94vw); text-align: center; }
.res-hero { margin-bottom: 6px; }
.res-hero em { font-style: normal; font-family: var(--serif); font-size: 42px; color: #f2eee2; margin-right: 12px; }
.res-hero b { font-size: 18px; vertical-align: middle; }
.t-ssr .res-hero b, .t-ssr b { color: var(--gold-b); }
.t-sr .res-hero b, .t-sr b { color: #b07ce8; }
.t-r .res-hero b, .t-r b { color: #5a8fd4; }
.t-n .res-hero b, .t-n b { color: #9aa2ad; }
.res-line { color: #c9b06a; margin-bottom: 14px; }

.res-single { position: relative; display: inline-block; }
.res-single img { max-width: min(380px, 70vw); border-radius: 10px; position: relative; z-index: 2; box-shadow: 0 0 60px rgba(224,64,64,.22); }
.res-single.epic img { box-shadow: 0 0 80px rgba(255,64,48,.4), 0 0 120px rgba(201,162,39,.25); }
.res-single .rays {
  position: absolute; inset: -24% -42%; z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(82deg, transparent 40%, rgba(255,213,74,.18) 41% 43%, transparent 44%),
    linear-gradient(98deg, transparent 46%, rgba(255,64,48,.2) 47% 50%, transparent 51%),
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(255,190,70,.08) 30px 34px, transparent 36px 62px);
  clip-path: polygon(8% 100%, 22% 8%, 34% 100%, 49% 0, 62% 100%, 79% 12%, 92% 100%);
  animation: warGlow 1.3s ease-in-out infinite alternate;
}
@keyframes warGlow { to { opacity: .56; filter: brightness(1.45); transform: translateY(-5px); } }
.pop-in { animation: popIn .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.res-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px; margin-top: 8px;
}
.res-grid .cell { animation: cellIn .35s ease-out both; }
.delay-0 { animation-delay: 0s; } .delay-1 { animation-delay: .08s; }
.delay-2 { animation-delay: .16s; } .delay-3 { animation-delay: .24s; }
@keyframes cellIn { from { transform: translateY(16px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.cell {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid #26262f; background: #0a0a10;
  height: 158px; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.cell:hover { transform: translateY(-3px); }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.cell.revealed img { opacity: 1; }
.cell .chip {
  position: absolute; top: 5px; left: 5px; z-index: 2;
  font-size: 10px; font-weight: 900; color: #0c0c10;
  padding: 1px 7px; border-radius: 3px;
}
.cell .cell-name {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  font-size: 12px; text-align: center; padding: 4px 2px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.92));
  white-space: nowrap; overflow: hidden;
}
.cell.locked img { filter: grayscale(1) brightness(.28); }
.cell.locked .cell-name { color: #565664; }
.cell.t-ssr { border-color: #a8842c; box-shadow: 0 0 14px rgba(240,196,55,.3); }
.cell.t-sr { border-color: #7c4ec8; }
.cell.t-r { border-color: #2e4a6e; }
.rare-pulse { animation: rarePulse 1.6s infinite !important; }
@keyframes rarePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,64,48,.4); }
  50% { box-shadow: 0 0 28px rgba(255,64,48,.95); }
}

.detail-panel { width: min(760px, 94vw); }
.det-flex { display: flex; gap: 22px; align-items: flex-start; }
.det-flex img { width: min(300px, 44vw); border-radius: 10px; box-shadow: 0 0 44px rgba(224,64,64,.18); }
.det-info h2 { font-family: var(--serif); font-size: 34px; color: #f2eee2; }
.det-info p { margin-top: 6px; }
.seal {
  display: inline-flex; width: 26px; height: 26px; border-radius: 50%;
  align-items: center; justify-content: center;
  font-family: var(--serif); color: #0a0a0e; font-weight: 700;
}
.stat-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.stat-row span { width: 40px; color: #8f8a96; }
.stat-row .bar { flex: 1; height: 9px; background: #0c0c12; border-radius: 5px; overflow: hidden; border: 1px solid #26262f; }
.stat-row .bar i { display: block; height: 100%; }
.stat-row b { width: 30px; text-align: right; }
#det-quote {
  margin-top: 14px; padding: 12px; border-left: 3px solid var(--blood);
  background: rgba(161,35,35,.08); color: #e8dfd0;
  font-family: var(--serif); line-height: 1.6;
}
.det-bio {
  position: relative; margin-top: 10px; padding: 12px 13px 11px 17px;
  color: #cfc8b8; font-size: 12px; line-height: 1.7;
  background:
    linear-gradient(90deg, rgba(154,113,45,.2) 1px, transparent 1px) 0 0 / 9px 100%,
    linear-gradient(180deg, rgba(31,25,18,.92), rgba(12,12,13,.94));
  border: 1px solid rgba(191,151,70,.4); border-left: 3px solid #9f7432;
  box-shadow: inset 0 1px rgba(255,232,174,.06);
}
.det-bio b {
  display: block; margin-bottom: 4px; color: #d9b55d;
  font-family: var(--serif); font-size: 11px; letter-spacing: .24em;
}
.det-bio p { margin: 0 !important; }

.rate-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.rate-table th, .rate-table td { border: 1px solid #26262f; padding: 8px 14px; text-align: left; }
.rate-table th { background: rgba(201,162,39,.1); color: var(--gold-b); }
.rate-notes { margin: 10px 4px 0; padding-left: 18px; color: #a09aa4; font-size: 13px; line-height: 1.9; }

.col-wrap {
  margin: 8px auto; width: min(1120px, 96vw);
  display: flex; flex-direction: column; height: 100%;
}
.col-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-radius: 10px; padding: 10px 14px;
}
.col-head h1 { font-family: var(--serif); color: var(--gold-b); font-size: 24px; letter-spacing: 3px; }
.col-head input, .col-head select {
  background: #0c0c12; color: #ddd8cc;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
.fchips { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.fchip {
  background: rgba(14,14,21,.8); border: 1px solid #2c2c38; color: #9a96a8;
  border-radius: 16px; padding: 5px 14px; font-size: 13px;
}
.fchip.on { background: rgba(161,35,35,.25); border-color: var(--blood-b); color: #f0c0b8; }
.col-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px; padding-bottom: 16px;
}

.settings-panel { width: min(440px, 90vw); }
.settings-panel h3 { font-family: var(--serif); color: var(--gold-b); margin-bottom: 12px; letter-spacing: 2px; }
.rowline { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.credit { line-height: 1.6; margin-top: 8px; border-top: 1px solid #26262f; padding-top: 10px; }

#toast {
  position: absolute; bottom: 72px; left: 50%; transform: translate(-50%, 20px);
  z-index: 90; background: rgba(10,10,16,.96); border: 1px solid var(--gold);
  color: var(--gold-b);
  padding: 10px 22px; border-radius: 22px; font-size: 14px;
  opacity: 0; transition: .3s; pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.7);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 768px) {
  #topbar { padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
  .avatar { width: 36px !important; height: 36px !important; font-size: 16px !important; }
  .pinfo b { font-size: 12px !important; }
  .expbar { width: 90px !important; }
  .res { padding: 4px 8px !important; font-size: 12px !important; }
  .screen { top: 56px !important; bottom: calc(60px + env(safe-area-inset-bottom)) !important; }
  .home-wrap { grid-template-columns: 1fr !important; gap: 16px !important; padding: 12px 0 !important; }
  .banner-card { height: 320px !important; }
  .banner-info h2 { font-size: 28px !important; }
  .summon-panel { padding: 14px !important; }
  .title-main { font-size: 28px !important; letter-spacing: 4px !important; }
  .gacha-btn { min-width: 140px !important; padding: 10px 14px !important; }
  .gacha-btn em { font-size: 16px !important; }
  .gacha-btn.big em { font-size: 18px !important; }
  .col-wrap { width: 96vw !important; }
  .col-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 6px !important; }
  .cell { height: 132px !important; }
  .det-flex { flex-direction: column !important; align-items: center !important; }
  .det-flex img { width: 72vw !important; }
  .result-panel { width: 96vw !important; padding: 14px !important; }
  .detail-panel { width: 96vw !important; }
  .panel { padding: 14px !important; }
  #bottomnav button { padding: 6px 0 !important; }
  #bottomnav button i { font-size: 18px !important; }
  #bottomnav button span { font-size: 10px !important; }
  #narration { font-size: 18px !important; bottom: 14vh !important; }
  .event-strip { font-size: 10px !important; gap: 8px !important; padding: 4px 0 !important; flex-wrap: wrap; }
  input[type="text"], select { font-size: 16px !important; }
}

/* v5 — mobile-first command pavilion */
body {
  background:
    radial-gradient(circle at 50% -20%, rgba(122, 93, 32, .18), transparent 42%),
    linear-gradient(145deg, #06070a, #020306 70%);
}
#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(230, 207, 138, .035) 50%, transparent 50.2%),
    radial-gradient(ellipse at 50% 35%, transparent 30%, rgba(0, 0, 0, .46) 100%);
}
#stage { filter: saturate(.9) contrast(1.04); }

#topbar {
  min-height: 68px;
  padding: 9px clamp(14px, 3vw, 36px);
  background: linear-gradient(180deg, rgba(7, 8, 12, .97), rgba(7, 8, 12, .78));
  border-bottom-color: rgba(230, 207, 138, .28);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px) saturate(1.25);
}
.avatar {
  border-color: var(--gold-soft);
  background: linear-gradient(145deg, #32313a, #101116 62%);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .55));
}
.pinfo b { letter-spacing: .02em; }
.res {
  border-color: rgba(230, 207, 138, .22);
  background: linear-gradient(180deg, rgba(33, 34, 43, .94), rgba(13, 14, 20, .94));
}

.screen { top: 68px; bottom: 72px; }
#scr-home { justify-content: flex-start; }
.event-strip {
  height: 32px;
  background: linear-gradient(90deg, transparent, rgba(92, 17, 18, .7) 18%, rgba(92, 17, 18, .7) 82%, transparent);
  border-bottom: 1px solid rgba(224, 64, 64, .2);
  letter-spacing: .04em;
}
.home-wrap {
  width: min(1180px, calc(100vw - 36px));
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 38px);
  padding: 52px 0 22px;
}
.panel-ornate {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .035), transparent 34%),
    linear-gradient(180deg, rgba(24, 25, 33, .96), rgba(10, 11, 16, .97));
  border-color: rgba(230, 207, 138, .22);
  box-shadow: 0 22px 55px rgba(0, 0, 0, .66), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(16px);
}
.banner-card {
  height: 510px;
  border-radius: 8px;
  border-color: rgba(230, 207, 138, .38);
  outline-color: rgba(115, 25, 24, .72);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .76), 0 0 0 5px rgba(0, 0, 0, .18);
}
.banner-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 3;
  pointer-events: none;
  border: 1px solid rgba(230, 207, 138, .16);
  clip-path: polygon(0 0, 32px 0, 32px 1px, 1px 1px, 1px 32px, 0 32px, 0 100%, 100% 100%, 100% 0);
}
.banner-card img { opacity: .94; filter: saturate(.85) contrast(1.06); }
.banner-tag {
  padding: 8px;
  background: linear-gradient(90deg, #350c0e, #71191a 48%, #350c0e);
  font-weight: 700;
}
.banner-info { padding: 28px 20px 18px; background: linear-gradient(180deg, transparent, rgba(5, 6, 9, .98) 46%); }
.banner-info h2 { font-size: 42px; letter-spacing: .08em; }
.featured-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 14px;
}
.featured-stats span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 6px 3px;
  background: rgba(5, 6, 9, .72);
  border: 1px solid rgba(230, 207, 138, .18);
}
.featured-stats i { font-style: normal; color: #a79b7c; font-family: var(--serif); font-size: 11px; }
.featured-stats b { color: #eee8d8; font-size: 13px; }

.summon-panel { padding: clamp(24px, 4vw, 42px); border-radius: 8px; overflow: hidden; }
.summon-panel::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(230, 207, 138, .07);
  pointer-events: none;
}
.summon-kicker {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: #948a74;
  font-size: 11px;
  letter-spacing: .16em;
}
.summon-kicker span { color: #d7c27e; font-family: var(--serif); }
.summon-kicker b { font-weight: 500; }
.title-main {
  position: relative;
  z-index: 1;
  font-size: clamp(38px, 5vw, 58px);
  color: #ead07c;
  letter-spacing: .16em;
}
.pity-box {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(5, 6, 10, .78), rgba(7, 8, 12, .9));
  border-color: rgba(230, 207, 138, .2);
  border-radius: 6px;
}
.pity-bar { height: 6px; }
.gacha-btn { border-radius: 6px; }

#bottomnav {
  left: 50%;
  right: auto;
  width: min(680px, 100%);
  transform: translateX(-50%);
  border: 1px solid rgba(230, 207, 138, .22);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(0deg, rgba(4, 5, 8, .98), rgba(16, 17, 23, .92));
  box-shadow: 0 -10px 35px rgba(0, 0, 0, .45);
  backdrop-filter: blur(18px);
}
#bottomnav button { min-height: 62px; }
#bottomnav button.on { background: linear-gradient(180deg, rgba(185, 151, 62, .14), transparent); }

.panel {
  border-color: rgba(230, 207, 138, .22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .035), transparent 32%),
    linear-gradient(180deg, #171820, #090a0e);
  backdrop-filter: blur(18px);
}
.det-info { min-width: 0; flex: 1; }
.stat-row .bar i { box-shadow: 0 0 8px currentColor; }
.col-head { position: relative; z-index: 2; }
.col-grid { scrollbar-gutter: stable; }
.cell { aspect-ratio: 2 / 3; height: auto; border-radius: 6px; }
.cell:active { transform: scale(.97); }

@media (max-width: 768px) {
  #topbar {
    min-height: 56px;
    padding: max(6px, env(safe-area-inset-top)) 8px 6px !important;
  }
  .profile { gap: 7px; min-width: 0; }
  .avatar { width: 34px !important; height: 34px !important; flex: 0 0 34px; }
  .pinfo { min-width: 0; }
  .pinfo b { max-width: 104px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pinfo span { font-size: 10px; }
  .expbar { width: 82px !important; height: 3px; }
  .currencies { gap: 4px; }
  .res { gap: 4px; padding: 4px 7px !important; font-size: 11px !important; }
  .res i { width: 11px; height: 11px; }

  .screen { top: 56px !important; bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
  #scr-home { justify-content: flex-start; }
  .event-strip {
    position: relative;
    flex: 0 0 29px;
    height: 29px;
    padding: 5px 10px !important;
    white-space: nowrap;
    overflow: hidden;
  }
  .event-strip span { display: none; }
  .event-strip b { overflow: hidden; text-overflow: ellipsis; }
  .home-wrap {
    width: 100%;
    margin: 0 auto;
    grid-template-columns: 1fr !important;
    gap: 11px !important;
    padding: 9px 9px 18px !important;
  }
  .banner-card { height: clamp(290px, 39vh, 350px) !important; border-radius: 7px; }
  .banner-tag { padding: 6px; font-size: 10px; }
  .banner-info { padding: 26px 14px 12px; }
  .banner-info h2 { font-size: 29px !important; line-height: 1.05; }
  .banner-info p { font-size: 12px; }
  .chip-tier { margin-bottom: 5px; }
  .featured-stats { margin-top: 9px; gap: 3px; }
  .featured-stats span { padding: 4px 2px; gap: 3px; }
  .featured-stats b { font-size: 12px; }

  .summon-panel { padding: 15px 13px !important; }
  .summon-kicker { margin-bottom: 5px; font-size: 9px; }
  .title-main { font-size: 27px !important; letter-spacing: .12em !important; }
  .sub { margin-top: 5px; font-size: 11px; line-height: 1.45; }
  .pity-box { margin: 12px auto; padding: 11px 12px; }
  .pity-head { font-size: 11px; }
  .linklike { min-height: 34px; margin-top: 5px; }
  .summon-panel > .btn-row {
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 10px;
  }
  .summon-panel .gacha-btn {
    flex: 1 1 0;
    min-width: 0 !important;
    min-height: 68px;
    padding: 9px 5px !important;
  }
  .summon-panel .gacha-btn em { font-size: 15px !important; letter-spacing: 1px; white-space: nowrap; }
  .summon-panel .gacha-btn.big em { font-size: 16px !important; }
  .summon-panel .gacha-btn span { font-size: 10px; white-space: nowrap; }
  .summon-panel > .small { display: block; margin-top: 9px; }

  #bottomnav {
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  #bottomnav button { min-height: 60px; padding: 5px 0 !important; }
  #bottomnav button i { font-size: 20px !important; }

  .overlay { align-items: flex-end; }
  .panel {
    width: 100% !important;
    max-width: none;
    max-height: calc(91dvh - env(safe-area-inset-top));
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom)) !important;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .det-flex {
    display: grid !important;
    grid-template-columns: minmax(118px, 38%) minmax(0, 1fr);
    gap: 13px;
    align-items: start !important;
  }
  .det-flex img { width: 100% !important; max-width: 170px; }
  .det-info h2 { font-size: 27px; }
  .det-info p { font-size: 12px; }
  .stat-row { gap: 6px; margin-top: 6px; font-size: 11px; }
  .stat-row span { width: 30px; }
  #det-quote { grid-column: 1 / -1; font-size: 12px; padding: 9px; margin-top: 10px; }
  .res-hero em { font-size: 31px; }
  .res-hero b { font-size: 14px; }
  .res-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .res-grid .cell { min-width: 0; }
  .res-single img { max-height: 58dvh; width: auto; max-width: 74vw; }

  .col-wrap { width: 100% !important; margin: 0; padding: 8px; }
  .col-head { gap: 7px; padding: 9px 10px; border-radius: 7px; }
  .col-head h1 { font-size: 20px; flex: 1; }
  .col-head .dim { font-size: 10px; }
  .col-head input { order: 3; flex: 1 1 60%; min-width: 0; }
  .col-head select { order: 4; flex: 0 0 106px; min-width: 0; }
  .fchips { flex-wrap: nowrap; overflow-x: auto; margin: 7px 0; gap: 6px; padding-bottom: 2px; }
  .fchip { flex: 0 0 auto; min-height: 36px; padding: 5px 14px; }
  .col-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 7px !important; padding-bottom: 20px; }
  .cell { height: auto !important; }
  .cell .cell-name { font-size: 11px; }

  .skipbtn { top: 9px; right: 9px; }
  .exitbtn { top: 9px; right: 105px; }
  #narration { bottom: 24vh !important; font-size: 18px !important; padding-inline: 34px; }
  .omen-ribbon {
    top: 51px; width: calc(100vw - 16px); min-width: 0; padding: 6px 14px 7px;
    grid-template-columns: auto minmax(0, 1fr); column-gap: 8px;
  }
  .omen-ribbon span { min-width: 46px; padding: 4px 6px; font-size: 15px; }
  .omen-ribbon b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .omen-ribbon i { font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chance-meter { left: 5px; gap: 3px; padding: 5px 4px; }
  .chance-meter span { width: 10px; height: 21px; }
  .chance-meter::before { display: none; }
  .slot-alert { top: 28%; min-width: 260px; font-size: 28px; }
  .stop-lamps { bottom: 2vh; gap: 8px; }
  .stop-lamps span { width: 58px; height: 36px; }
  .stop-lamps b { font-size: 14px; }
  .slot-push { width: 96px; height: 96px; bottom: 13vh; border-width: 5px; }
  .slot-push small { margin-top: 8px; font-size: 8px; }
  .slot-push b { font-size: 21px; }
  #toast { bottom: calc(72px + env(safe-area-inset-bottom)); max-width: 88vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 360px) {
  .pinfo b { max-width: 82px; }
  .res { padding-inline: 5px !important; }
  .banner-card { height: 280px !important; }
  .summon-panel .gacha-btn span { font-size: 9px; }
  .det-flex { grid-template-columns: 112px minmax(0, 1fr); }
}

/* Keep the primary summon actions above the fold on short phones. */
@media (max-width: 480px) and (max-height: 650px) {
  .home-wrap {
    gap: 7px !important;
    padding: 7px 8px 9px !important;
  }
  .banner-card { height: 183px !important; }
  .banner-tag { padding: 4px; font-size: 9px; }
  .banner-info { padding: 20px 10px 7px; }
  .banner-info h2 { font-size: 23px !important; }
  .banner-info p { margin-top: 2px; font-size: 10px; }
  .chip-tier { margin-bottom: 2px; padding: 1px 7px; font-size: 10px; }
  .featured-stats { margin-top: 4px; }
  .featured-stats span { padding: 2px 1px; }
  .featured-stats i { font-size: 9px; }
  .featured-stats b { font-size: 10px; }

  .summon-panel { padding: 8px 10px !important; }
  .summon-kicker { margin-bottom: 2px; }
  .title-main { font-size: 22px !important; }
  .summon-panel > .sub { display: none; }
  .pity-box { margin: 5px auto; padding: 5px 8px; }
  .pity-head { margin-bottom: 3px; font-size: 9px; }
  .pity-bar { height: 5px; }
  .linklike { min-height: 26px; margin-top: 1px; font-size: 10px; }
  .summon-panel > .btn-row { gap: 6px; margin-top: 4px; }
  .summon-panel .gacha-btn { min-height: 46px; padding: 4px !important; }
  .summon-panel .gacha-btn em,
  .summon-panel .gacha-btn.big em { font-size: 13px !important; }
  .summon-panel .gacha-btn span { font-size: 8px; }
  .summon-panel > .small { margin-top: 4px; font-size: 8px; }
}

@media (max-height: 600px) and (min-width: 600px) {
  #topbar { min-height: 54px; padding-block: 5px; }
  .screen { top: 54px; bottom: 58px; }
  .home-wrap { grid-template-columns: 290px minmax(0, 1fr); padding-top: 38px; }
  .banner-card { height: 340px; }
  .summon-panel { padding: 20px; }
  .pity-box { margin: 12px auto; }
  #bottomnav button { min-height: 52px; }
}

/* Grid rows need an explicit card height inside the fixed-height collection scroller. */
.cell { aspect-ratio: auto; height: 158px; }
.col-grid { grid-auto-rows: max-content; align-content: start; }

@media (max-width: 768px) {
  .col-grid .cell { height: calc((100vw - 30px) / 3 * 1.5) !important; }
  .res-grid .cell { height: 128px !important; }
}
