.tactics-hub {
  max-width: 1030px;
  margin: auto;
  padding: 0 clamp(14px, 4vw, 32px) 40px;
}
.hub-nav { position: relative; z-index: 2; display: flex; justify-content: space-between; padding: 19px 0; }
.hub-nav a { color: #ecf8f1; font: 700 1.03rem/1 Arcade, monospace; text-decoration: none; }
.hub-nav a:hover { text-decoration: underline; }
body[data-page] { background: radial-gradient(ellipse at 75% 0%, #253850, #102234 60%); }
body:is([data-page="home"], [data-page="tutorial"]) .tactics-hub { max-width: none; padding: 0; }
body:is([data-page="home"], [data-page="tutorial"]) .hub-nav { position: absolute; inset: 0 0 auto; padding: 20px clamp(18px, 5vw, 80px); }
body[data-page="tutorial"] .hub-nav { pointer-events: none; }
body[data-page="tutorial"] .hub-nav a { pointer-events: auto; color: #20314c; text-shadow: 0 1px #ffedc9; }
.hub-hero {
  isolation: isolate;
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 70px clamp(20px, 9vw, 170px) 65px;
}
.hub-vista { position: absolute; z-index: -1; inset: 0; overflow: hidden; background: #0b2031; }
.hub-vista::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #081322e8, #0a19289c 32%, transparent 63%), linear-gradient(0deg,#09122151,transparent 25%); }
.vista-art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 178svh);
  aspect-ratio: 1672 / 941;
  transform: translate(-50%, -50%);
  background: url("/labs/brawl-tactics/menu-overlook.webp") center / 100% 100% no-repeat;
}
.vista-mortis {
  position: absolute;
  left: 70%;
  bottom: 21%;
  height: 20%;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(-3px 0 #ffc36a80) drop-shadow(8px 6px #251b32ab);
  transform-origin: bottom center;
  animation: mortis-idle 4s steps(2, end) infinite;
}
.vista-cloud, .vista-falls, .vista-ripples, .vista-leaf { position: absolute; pointer-events: none; }
.vista-cloud {
  width: 11%;
  height: 2.7%;
  background: #e68c8770;
  clip-path: polygon(0 60%, 18% 60%, 18% 40%, 34% 40%, 34% 20%, 52% 20%, 52% 0, 68% 0, 68% 20%, 85% 20%, 85% 40%, 100% 40%, 100% 65%, 75% 65%, 75% 85%, 50% 85%, 50% 100%, 18% 100%, 18% 83%, 0 83%);
  animation: vista-cloud-drift 30s linear infinite alternate;
}
.vista-cloud-near { left: 38%; top: 17%; }
.vista-cloud-far { left: 57%; top: 24%; width: 7%; height: 1.45%; opacity: .6; animation-delay: -12s; animation-duration: 36s; }
.vista-falls {
  inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 13px, #c5ffef 13px 16px, transparent 16px 40px);
  opacity: .26;
  animation: vista-fall-flow 1.55s steps(12, end) infinite;
}
.vista-falls-high { clip-path: polygon(88% 12%, 95% 7%, 94% 20%, 88% 26%); }
.vista-falls-mid { clip-path: polygon(84% 35%, 88% 32%, 88% 45%, 84% 50%); animation-delay: -.4s; }
.vista-falls-low { clip-path: polygon(71% 45%, 74% 43%, 74% 53%, 70% 55%); animation-delay: -.8s; }
.vista-ripples {
  left: 51%;
  right: 12%;
  top: 55.5%;
  height: 9%;
  opacity: .43;
  background:
    linear-gradient(90deg, transparent 0 9%, #affff5 9% 38%, transparent 38% 51%, #6ce5dc 51% 85%, transparent 85%) 0 20% / 32% 2px repeat-x,
    linear-gradient(90deg, transparent 0 32%, #38eaca 32% 56%, transparent 56%) 0 63% / 36% 2px repeat-x;
  mask-image: linear-gradient(90deg, transparent, #000 16% 81%, transparent);
  animation: vista-ripple-flow 5s linear infinite;
}
.vista-leaf {
  width: 5px;
  height: 3px;
  background: #ffad5f;
  box-shadow: 2px 1px #b9644e;
  opacity: 0;
  animation: vista-leaf-flight 8s steps(28, end) infinite both;
}
.vista-leaf-first { left: 93%; top: 70%; animation-delay: -1.2s; }
.vista-leaf-second { left: 82%; top: 86%; animation-delay: -4s; }
.vista-leaf-third { left: 61%; top: 79%; animation-delay: -6s; animation-duration: 10s; }
@keyframes mortis-idle {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(.957); }
}
@keyframes vista-cloud-drift { to { transform: translateX(46%); } }
@keyframes vista-fall-flow { to { background-position-y: 40px; } }
@keyframes vista-ripple-flow { to { background-position: 47% 20%, -56.25% 63%; } }
@keyframes vista-leaf-flight {
  0% { transform: translate(0, 8px); opacity: 0; }
  15% { opacity: .75; }
  55% { transform: translate(-54px, -16px) rotate(90deg); opacity: .8; }
  85%, 100% { transform: translate(-105px, 10px) rotate(180deg); opacity: 0; }
}
.hub-menu { width: min(100%, 390px); }
.hub-hero h1 { font: 700 clamp(4rem, 8vw, 8.2rem)/.72 Arcade, monospace; letter-spacing: -.07em; text-shadow: 4px 5px #0d1528; }
.hub-hero h1 span { display: block; color: #ffd276; margin-top: .12em; text-shadow: 4px 5px #613647; }
.hub-modes { display: grid; gap: 7px; margin-top: clamp(24px, 4vh, 45px); }
.hub-button {
  display: inline-block;
  text-decoration: none;
  color: #142333;
  font: 700 1rem/1.15 Arcade, monospace;
  background: #ffcf73;
  border: 0;
  border-bottom: 4px solid #ad793e;
  padding: 9px 12px;
}
.hub-modes a {
  --mode: #ffd276;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 12px;
  width: min(100%, 305px);
  min-height: 49px;
  padding: 8px 12px 8px 14px;
  color: #fff4dd;
  text-decoration: none;
  font: 700 clamp(1.2rem, 2.8vw, 1.65rem)/1.1 Arcade, monospace;
  background: linear-gradient(90deg, #0e1a30f2, #182d43c9 80%, #182d439c);
  border-left: 3px solid var(--mode);
  box-shadow: 0 4px #06111bbb;
}
.hub-modes a:hover, .hub-modes a:focus-visible { background: #263b55; color: var(--mode); }
.hub-modes a::after { content: "▸"; color: var(--mode); }
.hub-modes a span { width: 14px; height: 14px; background: var(--mode); clip-path: polygon(33% 0,66% 0,66% 33%,100% 33%,100% 66%,66% 66%,66% 100%,33% 100%,33% 66%,0 66%,0 33%,33% 33%); }
.hub-modes .mode-duel { --mode: #ff9c8b; }
.hub-modes .mode-weekly { --mode: #c6adff; }
.hub-modes .mode-free { --mode: #98edc9; }
.hub-button:hover:not(:disabled), .hub-modes a:hover { filter: brightness(1.09); }
.hub-button:disabled, span.hub-button { background: #344d60; color: #e0e5e8; border-color: #274155; }
.tutorial-replay { display: inline-block; margin-top: 16px; color: #c8e0d9; font-size: .88rem; text-underline-offset: 3px; }
.tutorial-intro {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding: clamp(60px, 10svh, 95px) clamp(12px, 6vw, 85px) clamp(12px, 4svh, 40px);
  overflow: hidden;
  background: #e7b489;
}
.tutorial-beach { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; object-position: 47% 50%; image-rendering: pixelated; }
.tutorial-caption { justify-self: start; padding: 9px 14px 12px; background: #242b488f; box-shadow: 3px 3px #503a5e80; }
.tutorial-caption h1 { font-size: clamp(1.55rem, 4vw, 3.4rem); }
.tutorial-location { margin-bottom: 4px; color: #ffe19e; font: 700 1rem/1.2 Arcade, monospace; }
.tutorial-portrait {
  position: relative;
  width: clamp(92px, 19svh, 212px);
  align-self: end;
  justify-self: end;
  margin-right: clamp(12%, 23vw, 32%);
  margin-bottom: -7px;
  transform-origin: center bottom;
  animation: tutorial-appear .65s steps(6, end) both, tutorial-idle 4s steps(2, end) .65s infinite;
}
.tutorial-portrait img { display: block; width: 100%; image-rendering: pixelated; filter: drop-shadow(5px 5px #4533487a); }
.tutorial-mouth { position: absolute; left: 61%; top: 56%; width: 9%; height: 4%; background: #5b3150; opacity: 0; }
.is-talking .tutorial-mouth { animation: tutorial-mouth .35s steps(1, end) infinite; }
@keyframes tutorial-appear { from { opacity: 0; translate: 26px 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes tutorial-idle { 50% { transform: scaleY(.98); } }
@keyframes tutorial-mouth { 45% { opacity: 1; } }
.tutorial-dialogue {
  position: relative;
  justify-self: center;
  width: min(100%, 860px);
  padding: clamp(12px, 2.5vw, 22px) clamp(15px, 3vw, 30px);
  background: #172b46f5;
  border: 3px solid #2a2646;
  box-shadow: inset 0 0 0 2px #bfa6ed, 5px 6px #21263f9c;
}
.tutorial-speaker { margin-bottom: 6px; color: #ffe0a3; font: 700 clamp(1.25rem, 2.7vw, 1.62rem)/1 Arcade, monospace; }
#tutorial-line { min-height: 3em; font-size: clamp(1rem, 1.9vw, 1.2rem); line-height: 1.5; color: #fff6dd; }
.tutorial-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 9px; }
.tutorial-skip { padding: 8px 0; background: transparent; border: 0; color: #d8e7e5; text-decoration: underline; text-underline-offset: 3px; }

.mode-page .tactics-hub { max-width: none; padding: 0; }
.mode-page .hub-nav { position: absolute; inset: 0 0 auto; padding: 20px clamp(18px, 5vw, 80px); }
.mode-page .hub-nav a { text-shadow: 1px 2px #142139; }
.mode-hero {
  --mode-accent: #ffda88;
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(64px, 10svh, 105px) clamp(18px, 8vw, 135px) 35px;
  background: #182b44;
}
#duel { --mode-accent: #ffac9b; }
#weekly { --mode-accent: #d8c2ff; }
#freeplay { --mode-accent: #a0f5da; }
.mode-scene { position: absolute; inset: 0; z-index: -1; }
.mode-scene canvas { width: 100%; height: 100%; object-fit: cover; object-position: 63% 50%; image-rendering: pixelated; }
.mode-scene::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, #122638e0, #162b3d8a 36%, transparent 66%), linear-gradient(#101c37a0, transparent 22%);
}
.mode-copy {
  position: relative;
  isolation: isolate;
  width: min(100%, 440px);
  padding: 27px clamp(17px, 4vw, 34px) 28px;
  color: #39263b;
  filter: drop-shadow(5px 7px #242134b3);
}
.mode-copy::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 100% 12px, calc(100% - 8px) 12px, calc(100% - 8px) calc(100% - 12px), 100% calc(100% - 12px), 100% 100%, 0 100%, 0 calc(100% - 12px), 8px calc(100% - 12px), 8px 12px, 0 12px);
  background:
    linear-gradient(90deg, #9f674c 4px, transparent 4px) 8px 0 / calc(100% - 16px) 100% no-repeat,
    linear-gradient(#fff1ba 4px, #bc8458 4px 10px, transparent 10px calc(100% - 10px), #dfab70 calc(100% - 10px) calc(100% - 4px), #855039 calc(100% - 4px)),
    repeating-linear-gradient(90deg, #8e50320d 0 3px, transparent 3px 19px, #fff6d350 19px 22px, transparent 22px 35px),
    #f2d59a;
}
.mode-copy h1 { font-family: Arcade, monospace; font-size: clamp(2rem, 5vw, 3.35rem); line-height: .98; margin-bottom: 9px; text-shadow: 2px 2px #fff1ba; }
.mode-copy p { color: #563a3c; font-size: .96rem; line-height: 1.42; max-width: 37ch; }
.mode-copy .mode-kicker { font: 700 1rem/1.25 Arcade, monospace; color: #754139; margin-bottom: 6px; }
.mode-copy .hub-button { margin-top: 13px; background: var(--mode-accent); color: #302437; border-color: #704a49; }
#duel-status:not(:empty) { margin-top: 10px; }
.mode-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 17px; }
.mode-secondary { color: #633b42; font: 700 1rem/1.25 Arcade, monospace; text-underline-offset: 4px; }
.mode-copy .next-chapter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  margin-top: 14px;
  padding-top: 8px;
  border-top: 2px dashed #a97754;
  color: #633b42;
  font: 700 1.05rem/1.2 Arcade, monospace;
}
.next-chapter span { color: #704d44; font: 700 .94rem/1.2 Arcade, monospace; }
.mode-characters {
  position: absolute;
  z-index: 1;
  isolation: isolate;
  right: clamp(24px, 14vw, 230px);
  bottom: 22%;
  display: flex;
  align-items: end;
  gap: clamp(10px, 3vw, 42px);
  pointer-events: none;
}
.mode-characters::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -18% -10px;
  height: clamp(38px, 8svh, 80px);
  background: repeating-linear-gradient(0deg, #554052 0 4px, #aa7666 4px 13px, #d49a76 13px 15px);
  clip-path: polygon(11% 0, 87% 0, 87% 14%, 92% 14%, 92% 30%, 97% 30%, 97% 51%, 100% 51%, 100% 100%, 0 100%, 0 52%, 4% 52%, 4% 32%, 8% 32%, 8% 15%, 11% 15%);
}
#duel .mode-characters::before { filter: saturate(.7) brightness(.8); }
#weekly .mode-characters::before { filter: hue-rotate(28deg) saturate(.55) brightness(.58); }
.mode-characters img {
  height: clamp(85px, 23svh, 260px);
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(5px 5px #23314983);
  transform-origin: center bottom;
  animation: mode-idle 3.7s steps(3, end) infinite;
}
.mode-characters img + img { height: clamp(72px, 18svh, 210px); margin-bottom: 3vh; animation-delay: -.9s; }
#duel .mode-characters { right: clamp(24px, 14vw, 240px); gap: clamp(26px, 6vw, 110px); bottom: 20%; }
#weekly .mode-characters img { filter: drop-shadow(-3px 0 #c7b7ff8f) drop-shadow(5px 5px #1d294fa3); }
@keyframes mode-idle { 30% { transform: translateY(-3px) scaleY(1.015); } 54% { transform: scaleY(.975); } }
.hub-panel { background: #1e4051; margin-top: 16px; padding: clamp(13px, 3vw, 24px); border-bottom: 5px solid #112b3b; scroll-margin-top: 10px; }
.hub-panel h1, .hub-panel h2, .hub-panel h3, .hub-panel h4 { font-family: Arcade, monospace; }
.hub-panel h1 { font-size: clamp(2rem, 7vw, 3.7rem); line-height: 1; }
.hub-panel h2 { font-size: 1.7rem; }
.hub-panel p { color: #d8e7e5; font-size: .88rem; line-height: 1.4; }
.hub-panel > p { margin: 5px 0 12px; }
.hub-panel > p:empty { display: none; }
.mode-panel { padding: clamp(20px, 5vw, 42px); border-top: 4px solid #7297a0; }
.mode-panel .hub-button { margin-top: 10px; }
.campaign-shop { padding-inline: clamp(14px, 5.5vw, 90px); }
.shop-scene canvas { object-position: 82% 50%; }
.shop-scene::after { background: linear-gradient(90deg, #211927b3, #2f1e3872 42%, transparent 67%), linear-gradient(#201b35a0, transparent 20%); }
.campaign-counter {
  width: min(100%, 650px);
  padding: clamp(14px, 2.3vw, 26px);
  background: #312637ec;
  border-top: 5px solid #d69365;
  box-shadow: 5px 6px #1b1529b5;
}
.shop-heading { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.shop-heading h1 { font-size: clamp(2rem, 4.2vw, 3.55rem); color: #fff0d0; }
#wallet { padding: 4px 8px; background: #513b41; color: #ffe4a6; font-weight: 700; font-size: .86rem; }
.market-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.market-item {
  display: grid;
  grid-template-rows: 44px auto 1fr auto;
  justify-items: start;
  gap: 7px;
  padding: 11px;
  background: #51404a;
  box-shadow: inset 0 -3px #382d3b;
}
.market-item h4 { margin: 0; font: 700 1.2rem/1.05 Arcade, monospace; }
.market-item p { color: #efddcc; font-size: .8rem; line-height: 1.3; }
.market-item .hub-button { min-height: 43px; font: 700 .81rem/1.2 system-ui, sans-serif; }
.market-item .hub-button:disabled { color: #e6d8d1; background: #40323f; border-color: #302731; }
.market-item img, .market-item canvas { height: 42px; max-width: 55px; object-fit: contain; image-rendering: pixelated; }
.hub-panel :is(input, select) { min-height: 40px; background: #132f40; color: #fff4dd; border: 1px solid #6592a0; border-radius: 0; padding: 6px; max-width: 100%; font: inherit; }
.hub-panel label { display: grid; gap: 4px; font-size: .8rem; }
.save-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.save-form label { width: min(100%, 360px); }
@media (max-width: 620px) {
  .mode-hero { align-items: end; padding-bottom: clamp(12px, 4svh, 32px); }
  .mode-characters, #duel .mode-characters { right: 11%; bottom: 40%; }
  .mode-scene::after { background: linear-gradient(#1328419c, transparent 23%, transparent 53%, #142738af 87%); }
  .tutorial-portrait { margin-right: 20%; }
  #tutorial-line { min-height: 6em; }
  .hub-hero { align-items: end; padding: 56px 22px 25px; }
  .vista-art { left: 31%; width: max(100%, 106svh); top: 30%; }
  .hub-vista::after { background: linear-gradient(0deg, #081522 7%, #081522e8 29%, #0815224d 69%, #08152261); }
  .hub-modes { gap: 6px; margin-top: 20px; }
  .hub-modes a { min-height: 44px; }
  .campaign-shop { padding-top: clamp(160px, 29svh, 260px); }
  .shop-scene canvas { max-height: 59svh; object-position: 86% 31%; }
  .shop-scene::after { background: linear-gradient(#1c213e8c, transparent 14%, transparent 29%, #182b44 59svh); }
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
