:root {
  color-scheme: dark;
  --ink: #eef4ed;
  --ink-muted: #aab8b4;
  --ink-dark: #13201f;
  --void: #081012;
  --night: #101a1e;
  --panel: rgba(20, 31, 35, 0.94);
  --panel-soft: rgba(28, 43, 46, 0.82);
  --line: rgba(195, 224, 211, 0.15);
  --line-strong: rgba(195, 224, 211, 0.3);
  --mint: #87e4be;
  --mint-bright: #b7f5d7;
  --amber: #f7b955;
  --amber-bright: #ffd58c;
  --coral: #ff7d6e;
  --blue: #78bdf2;
  --purple: #c39af4;
  --green: #80d986;
  --cell: clamp(40px, 5.1vw, 66px);
  --grid-gap: 6px;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--void);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 112, 0.24), transparent 32rem),
    radial-gradient(circle at 88% 18%, rgba(179, 119, 43, 0.15), transparent 28rem),
    linear-gradient(160deg, #0c1518 0%, #081012 72%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
[tabindex]:focus-visible,
a:focus-visible {
  outline: 3px solid var(--amber-bright);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  color: var(--ink-dark);
  background: var(--mint-bright);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

#app {
  min-height: 100vh;
}

.boot-card {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 16px;
  color: var(--ink-muted);
  transform: translate(-50%, -50%);
}

.boot-card__sigil,
.brand__sigil {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #0d2420;
  font-weight: 900;
  letter-spacing: -0.08em;
  background: linear-gradient(145deg, var(--mint-bright), #4fab8e);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 15px 5px 15px 5px;
  box-shadow: 0 8px 30px rgba(111, 224, 182, 0.2);
}

.shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: flex;
  max-width: 1500px;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 18px;
  padding: 10px 14px;
  background: rgba(11, 20, 23, 0.82);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand__sigil {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px 5px 13px 5px;
}

.brand__copy {
  min-width: 0;
}

.brand__name {
  display: block;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand__tagline {
  display: block;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.hud-chip {
  display: grid;
  min-width: 76px;
  padding: 7px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.hud-chip__label {
  color: var(--ink-muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-chip__value {
  color: var(--amber-bright);
  font-size: 0.96rem;
  font-weight: 850;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--line-strong);
}

.screen {
  width: min(1500px, 100%);
  margin: 0 auto;
  animation: screen-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen--menu {
  display: grid;
  min-height: calc(100vh - 125px);
  align-content: center;
  padding: clamp(24px, 5vw, 80px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: clamp(36px, 7vw, 110px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--mint);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(3rem, 8vw, 7.4rem);
  font-weight: 920;
  letter-spacing: -0.075em;
  line-height: 0.83;
}

.hero h1 span {
  display: block;
  color: transparent;
  background: linear-gradient(110deg, var(--amber-bright), var(--amber), #dd745c);
  background-clip: text;
}

.hero__lead {
  max-width: 660px;
  margin: 28px 0;
  color: #c5d3cf;
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  line-height: 1.65;
}

.hero__actions,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  min-height: 46px;
  padding: 10px 17px;
  font-weight: 800;
  border-radius: 13px;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.primary-button {
  color: #10221f;
  background: linear-gradient(135deg, var(--mint-bright), #63cba7);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 8px 24px rgba(103, 218, 176, 0.18);
}

.secondary-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line-strong);
}

.danger-button {
  color: #ffe9e5;
  background: rgba(255, 92, 75, 0.12);
  border: 1px solid rgba(255, 125, 110, 0.34);
}

.text-button {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-2px);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.45;
  transform: none !important;
}

[data-role="seed-input"] {
  width: 100%;
  margin-top: 7px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(3, 10, 12, 0.56);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

[data-role="seed-input"]:focus {
  border-color: var(--mint);
  outline: 3px solid rgba(135, 228, 190, 0.16);
}

.hero__visual {
  position: relative;
  display: grid;
  min-height: 490px;
  place-items: center;
}

.forge-orbit {
  position: absolute;
  width: min(34vw, 430px);
  aspect-ratio: 1;
  border: 1px solid rgba(133, 226, 189, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 100px rgba(102, 207, 168, 0.05), 0 0 100px rgba(102, 207, 168, 0.08);
}

.forge-orbit::before,
.forge-orbit::after {
  position: absolute;
  inset: 14%;
  border: 1px dashed rgba(247, 185, 85, 0.24);
  border-radius: inherit;
  content: "";
  animation: orbit 26s linear infinite;
}

.forge-orbit::after {
  inset: 32%;
  border-style: solid;
  animation-direction: reverse;
  animation-duration: 18s;
}

.mini-pack {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(31vw, 380px);
  aspect-ratio: 0.9;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 8px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(69, 95, 83, 0.92), rgba(26, 39, 40, 0.98));
  border: 2px solid rgba(205, 231, 214, 0.23);
  border-radius: 30% 30% 22% 22%;
  box-shadow: var(--shadow), inset 0 0 40px rgba(255, 255, 255, 0.04);
  transform: rotate(3deg);
}

.mini-pack::before {
  position: absolute;
  top: -34px;
  left: 24%;
  width: 52%;
  height: 46px;
  border: 12px solid #385248;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  content: "";
}

.mini-pack__cell {
  background: rgba(7, 14, 15, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.mini-item {
  z-index: 2;
  display: grid;
  place-items: center;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  background: linear-gradient(145deg, #e8c068, #9c6631);
  border: 2px solid #ffe0a0;
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}

.mini-item--blade {
  grid-area: 1 / 1 / span 3 / span 1;
}

.mini-item--ward {
  grid-area: 3 / 2 / span 2 / span 2;
  background: linear-gradient(145deg, #85dcb8, #307e72);
  border-color: #bdf4dc;
}

.mini-item--fruit {
  grid-area: 1 / 3 / span 1 / span 1;
  background: linear-gradient(145deg, #f28a68, #9f3c43);
  border-color: #ffc2a3;
}

.mini-item--spark {
  grid-area: 2 / 4 / span 2 / span 1;
  background: linear-gradient(145deg, #bfa6f0, #70509d);
  border-color: #e1d2ff;
}

.menu-card {
  padding: 24px;
  background: linear-gradient(145deg, rgba(28, 44, 47, 0.88), rgba(15, 25, 28, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.menu-card h2,
.panel-heading h2,
.panel-heading h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

.menu-card > p {
  margin: 8px 0 20px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.archetype-list {
  display: grid;
  gap: 10px;
}

.archetype-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 15px;
  cursor: pointer;
}

.archetype-card:hover,
.archetype-card[aria-pressed="true"] {
  background: rgba(135, 228, 190, 0.08);
  border-color: rgba(135, 228, 190, 0.46);
}

.archetype-card[aria-pressed="true"]::after {
  width: 9px;
  height: 9px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 16px var(--mint);
  content: "";
}

.archetype-card__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  font-size: 1.55rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 13px;
}

.archetype-card__name {
  display: block;
  font-weight: 850;
}

.archetype-card__desc {
  display: block;
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.workshop {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(530px, 1.55fr) minmax(250px, 0.73fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 16px;
  background: linear-gradient(150deg, var(--panel-soft), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.shop-list {
  display: grid;
  gap: 9px;
}

.item-card {
  --rarity: var(--ink-muted);
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 69px;
  padding: 10px;
  overflow: hidden;
  text-align: left;
  background: rgba(5, 12, 14, 0.4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--rarity);
  border-radius: 13px;
  cursor: grab;
  user-select: none;
}

.item-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--rarity) 10%, transparent), transparent 45%);
  content: "";
}

.item-card:hover,
.item-card.is-selected {
  background: rgba(255, 255, 255, 0.07);
  border-color: color-mix(in srgb, var(--rarity) 60%, var(--line));
}

.item-card.is-reserved::before {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 8px;
  height: 8px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(247, 185, 85, 0.7);
  content: "";
}

.item-card__icon,
.placed-item__icon,
.storage-item__icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  font-size: 1.5rem;
  background: color-mix(in srgb, var(--rarity) 18%, #152023);
  border: 1px solid color-mix(in srgb, var(--rarity) 45%, transparent);
  border-radius: 12px;
}

.item-card__copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.item-card__name {
  display: block;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card__meta {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card__price {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 35px;
  min-height: 35px;
  place-items: center;
  color: #241701;
  font-size: 0.82rem;
  font-weight: 900;
  background: linear-gradient(145deg, var(--amber-bright), #d8942c);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.24);
}

.rarity--common { --rarity: #bac7c3; }
.rarity--uncommon { --rarity: var(--green); }
.rarity--rare { --rarity: var(--blue); }
.rarity--epic { --rarity: var(--purple); }
.rarity--mythic { --rarity: var(--amber); }

.inventory-panel {
  display: grid;
  justify-items: center;
}

.backpack-shell {
  position: relative;
  display: grid;
  justify-items: center;
  width: 100%;
  padding: 30px clamp(10px, 3vw, 34px) 22px;
  background: linear-gradient(145deg, rgba(62, 91, 78, 0.75), rgba(21, 38, 39, 0.9));
  border: 1px solid rgba(176, 214, 191, 0.24);
  border-radius: 80px 80px 30px 30px;
  box-shadow: inset 0 0 55px rgba(0, 0, 0, 0.28);
}

.backpack-shell::before {
  position: absolute;
  top: -18px;
  width: 36%;
  height: 28px;
  border: 8px solid #314e44;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  content: "";
}

.backpack-grid {
  position: relative;
  display: grid;
  width: calc(var(--cell) * 7 + var(--grid-gap) * 6);
  max-width: 100%;
  grid-template-columns: repeat(7, var(--cell));
  grid-template-rows: repeat(5, var(--cell));
  gap: var(--grid-gap);
  touch-action: none;
}

.grid-cell {
  position: relative;
  min-width: 0;
  padding: 0;
  background: rgba(4, 13, 14, 0.48);
  border: 1px solid rgba(222, 244, 232, 0.1);
  border-radius: 9px;
}

.grid-cell::after {
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(255, 255, 255, 0.035);
  border-radius: 5px;
  content: "";
}

.grid-cell:hover,
.grid-cell.is-valid-target {
  background: rgba(110, 225, 181, 0.13);
  border-color: rgba(135, 228, 190, 0.52);
}

.grid-cell.is-invalid-target {
  background: rgba(255, 90, 80, 0.12);
  border-color: rgba(255, 125, 110, 0.5);
}

.placed-item {
  --rarity: var(--ink-muted);
  position: relative;
  z-index: 5;
  display: grid;
  min-width: 0;
  place-items: center;
  gap: var(--grid-gap);
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.placed-item:hover,
.placed-item.is-selected {
  z-index: 15;
  filter: brightness(1.13);
  box-shadow: none;
}

.placed-item__cell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--rarity) 34%, transparent), transparent 58%),
    linear-gradient(145deg, rgba(44, 60, 60, 0.98), rgba(15, 25, 28, 0.98));
  border: 2px solid color-mix(in srgb, var(--rarity) 62%, #d9e8e1);
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.placed-item:hover .placed-item__cell,
.placed-item.is-selected .placed-item__cell {
  box-shadow: 0 10px 26px color-mix(in srgb, var(--rarity) 22%, rgba(0, 0, 0, 0.5));
}

.placed-item__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(46px, 78%);
  height: min(46px, 78%);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.placed-item__name {
  position: absolute;
  right: 5px;
  bottom: 3px;
  left: 5px;
  overflow: hidden;
  font-size: 0.56rem;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

.synergy-dot {
  position: absolute;
  z-index: 20;
  width: 11px;
  height: 11px;
  background: var(--amber-bright);
  border: 2px solid #352208;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 205, 118, 0.8);
}

.storage {
  width: 100%;
  margin-top: 13px;
  padding: 11px;
  background: rgba(5, 13, 15, 0.42);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}

.storage__header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink-muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.storage__items {
  display: flex;
  min-height: 58px;
  flex-wrap: wrap;
  gap: 7px;
}

.storage-item {
  position: relative;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: grab;
}

.storage-item:hover,
.storage-item.is-selected {
  background: rgba(135, 228, 190, 0.1);
  border-color: rgba(135, 228, 190, 0.52);
}

.storage-item__icon {
  width: 43px;
  height: 43px;
}

.detail-card {
  min-height: 215px;
  padding: 15px;
  background: rgba(5, 12, 14, 0.38);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.detail-card__empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--ink-muted);
  font-size: 0.86rem;
  line-height: 1.55;
  text-align: center;
}

.detail-card__hero {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 13px;
}

.detail-card__hero .item-card__icon {
  flex: 0 0 auto;
}

.detail-card h3 {
  margin: 0;
  font-size: 1rem;
}

.detail-card__type {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.detail-card__effect {
  margin: 10px 0;
  color: #d3dedb;
  font-size: 0.82rem;
  line-height: 1.55;
}

.tag-list,
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  color: var(--ink-muted);
  font-size: 0.66rem;
  font-weight: 760;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.recipe-hint {
  margin-top: 14px;
  padding: 11px;
  color: var(--amber-bright);
  font-size: 0.75rem;
  line-height: 1.45;
  background: rgba(247, 185, 85, 0.08);
  border: 1px solid rgba(247, 185, 85, 0.19);
  border-radius: 11px;
}

.turn-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.battle-stage {
  display: grid;
  min-height: calc(100vh - 125px);
  grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.5fr) minmax(260px, 0.75fr);
  align-items: stretch;
  gap: 14px;
}

.fighter {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: hidden;
}

.fighter::before {
  position: absolute;
  top: -90px;
  right: -90px;
  width: 230px;
  height: 230px;
  background: radial-gradient(circle, color-mix(in srgb, var(--fighter-color, var(--mint)) 20%, transparent), transparent 70%);
  content: "";
}

.fighter__portrait {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  font-size: 2.6rem;
  background: color-mix(in srgb, var(--fighter-color, var(--mint)) 13%, var(--night));
  border: 2px solid color-mix(in srgb, var(--fighter-color, var(--mint)) 52%, transparent);
  border-radius: 26px 10px 26px 10px;
}

.fighter h2 {
  margin: 0;
  font-size: 1.3rem;
}

.fighter__subtitle {
  margin: -9px 0 0;
  color: var(--ink-muted);
  font-size: 0.76rem;
}

.bar {
  display: grid;
  gap: 5px;
}

.bar__label {
  display: flex;
  justify-content: space-between;
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 760;
  text-transform: uppercase;
}

.bar__track {
  height: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
}

.bar__fill {
  width: var(--value, 0%);
  height: 100%;
  background: linear-gradient(90deg, var(--bar-color, var(--mint)), color-mix(in srgb, var(--bar-color, var(--mint)) 65%, white));
  border-radius: inherit;
  transition: width 280ms ease;
}

.battle-center {
  display: grid;
  min-width: 0;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.battle-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.battle-clock__time {
  min-width: 70px;
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
}

.battle-field {
  position: relative;
  display: grid;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(135, 228, 190, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(4, 11, 13, 0.28), rgba(4, 11, 13, 0.58));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.battle-field::before,
.battle-field::after {
  position: absolute;
  width: 44%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  content: "";
}

.battle-field::before { transform: rotate(30deg); }
.battle-field::after { transform: rotate(-30deg); }

.versus-mark {
  z-index: 1;
  display: grid;
  width: 110px;
  height: 110px;
  place-items: center;
  color: var(--amber-bright);
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  background: rgba(11, 20, 23, 0.88);
  border: 1px solid rgba(247, 185, 85, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(247, 185, 85, 0.1);
}

.floating-event {
  position: absolute;
  z-index: 3;
  color: var(--coral);
  font-size: 1.1rem;
  font-weight: 950;
  text-shadow: 0 2px 8px #000;
  animation: float-event 900ms ease-out both;
}

.combat-log {
  height: 190px;
  padding: 10px;
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.45;
  background: rgba(2, 7, 8, 0.54);
  border: 1px solid var(--line);
  border-radius: 13px;
  scrollbar-color: var(--line-strong) transparent;
}

.combat-log__entry {
  display: grid;
  grid-template-columns: 45px 1fr;
  gap: 7px;
  padding: 5px 3px;
  color: #c6d1cf;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.combat-log__time {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.result-banner {
  display: grid;
  justify-items: center;
  gap: 11px;
  max-width: 520px;
  padding: 28px;
  text-align: center;
  background: rgba(13, 23, 25, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.result-banner__icon {
  font-size: 3rem;
}

.result-banner h2 {
  margin: 0;
  font-size: 2rem;
}

.result-banner p {
  margin: 0;
  color: var(--ink-muted);
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 7, 8, 0.74);
  backdrop-filter: blur(12px);
}

.modal {
  width: min(680px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  padding: 22px;
  overflow: auto;
  background: #142125;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: modal-in 220ms ease-out both;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal__header h2 {
  margin: 0;
}

.recipe-list {
  display: grid;
  gap: 9px;
}

.recipe-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recipe-row__item {
  font-size: 0.8rem;
  font-weight: 780;
}

.recipe-row__arrow {
  color: var(--amber);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 150;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.45;
  background: rgba(22, 37, 39, 0.98);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--mint);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  animation: toast-in 260ms ease-out both;
}

.toast--warning { border-left-color: var(--amber); }
.toast--error { border-left-color: var(--coral); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes orbit {
  to { transform: rotate(360deg); }
}

@keyframes float-event {
  0% { opacity: 0; transform: translateY(12px) scale(0.85); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-46px) scale(1.05); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1180px) {
  .workshop {
    grid-template-columns: minmax(245px, 0.75fr) minmax(520px, 1.55fr);
  }

  .workshop > .panel:last-child {
    grid-column: 1 / -1;
  }

  .battle-stage {
    grid-template-columns: 1fr 1.4fr;
  }

  .battle-stage > .fighter:last-child {
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr;
  }
}

@media (max-width: 860px) {
  :root {
    --cell: clamp(37px, 10.6vw, 58px);
  }

  .shell { padding: 10px; }
  .topbar { top: 6px; margin-bottom: 10px; }
  .brand__tagline { display: none; }
  .hud-chip { min-width: 58px; padding-inline: 7px; }
  .hud-chip__label { font-size: 0.58rem; }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero__visual {
    display: none;
  }

  .screen--menu {
    min-height: auto;
    padding: 48px 10px;
  }

  .workshop,
  .battle-stage {
    grid-template-columns: 1fr;
  }

  .workshop > .inventory-panel {
    grid-row: 1;
  }

  .workshop > .panel:last-child,
  .battle-stage > .fighter:last-child {
    grid-column: auto;
  }

  .battle-stage > .fighter:last-child {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .battle-center { grid-row: 2; }
  .battle-field { min-height: 260px; }
}

@media (max-width: 560px) {
  :root { --cell: clamp(34px, 10vw, 52px); --grid-gap: 3px; }
  .brand__name { font-size: 0.82rem; }
  .brand__sigil { width: 36px; height: 36px; }
  .hud { gap: 4px; }
  .hud-chip:nth-of-type(n + 3) { display: none; }
  .icon-button { width: 36px; height: 36px; }
  .hero h1 { font-size: clamp(2.8rem, 18vw, 5rem); }
  .menu-card { padding: 17px; }
  .panel { padding: 12px; }
  .backpack-shell { padding-inline: 5px; border-radius: 48px 48px 24px 24px; }
  .backpack-grid { width: calc(var(--cell) * 7 + var(--grid-gap) * 6); }
  .grid-cell { border-radius: 6px; }
  .placed-item { border-radius: 9px; }
  .panel-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .panel-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(255, 255, 255, 0.35);
    --line-strong: rgba(255, 255, 255, 0.62);
    --ink-muted: #d4dfdc;
  }
}
