:root {
  color-scheme: dark;
  --ink: #f7ecd2;
  --muted: #aab1aa;
  --panel: #141819;
  --panel-strong: #1d2424;
  --line: #3f4a48;
  --line-soft: #2a3434;
  --teal: #42d6c5;
  --cyan: #42d6c5;
  --amber: #f0a94b;
  --violet: #9b6cff;
  --moss: #86b86f;
  --danger: #e06758;
  --black: #07090a;
  --shadow: rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, rgba(66, 214, 197, 0.13), transparent 34rem),
    linear-gradient(180deg, #0c1011 0%, #111515 62%, #080a0b 100%);
  font-family: "Courier New", Courier, monospace;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  color: #1c1308;
  background:
    url("./public/assets/ui/generated/button-gold.png") center / 100% 100% no-repeat,
    linear-gradient(180deg, #ffe08c 0%, #e5a441 52%, #9b5a24 100%);
  box-shadow: none;
  cursor: pointer;
  font-weight: 700;
  image-rendering: pixelated;
  padding: 0 18px;
  text-shadow: 0 1px 0 rgba(255, 232, 155, 0.55);
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  filter: brightness(0.92);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  background:
    url("./public/assets/ui/generated/input-dark.png") center / 100% 100% no-repeat,
    linear-gradient(180deg, #111718 0%, #0a0f10 100%);
  box-shadow: none;
  image-rendering: pixelated;
  padding: 0 18px;
  outline: none;
}

input:focus {
  filter: brightness(1.12);
}

.app-shell {
  width: min(1500px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.app-shell:not(.is-unlocked) {
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.app-shell:not(.is-unlocked) .topbar,
.app-shell:not(.is-unlocked) .game-shell {
  display: none;
}

.app-shell.is-unlocked .login-screen {
  display: none;
}

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 26%, rgba(66, 214, 197, 0.16), transparent 24rem),
    linear-gradient(180deg, #091011 0%, #111616 58%, #050707 100%);
}

.login-screen::before {
  position: absolute;
  inset: -18px;
  background:
    linear-gradient(180deg, rgba(5, 8, 9, 0.4), rgba(5, 8, 9, 0.86)),
    url("./public/assets/world/sogent-camp.png") center / cover no-repeat;
  content: "";
  image-rendering: pixelated;
  opacity: 0.42;
}

.login-screen::after {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(66, 214, 197, 0.18), transparent 24rem),
    linear-gradient(90deg, rgba(4, 7, 8, 0.82), rgba(4, 7, 8, 0.18) 50%, rgba(4, 7, 8, 0.82));
  content: "";
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(500px, calc(100vw - 32px));
  justify-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  image-rendering: pixelated;
  text-align: center;
}

.login-logo {
  display: block;
  width: auto;
  max-width: min(430px, 86vw);
  max-height: 220px;
  object-fit: contain;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 16px 24px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 22px rgba(66, 214, 197, 0.16));
}

.login-kicker {
  color: var(--teal);
  font-size: 0.84rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy,
.login-message {
  max-width: 30rem;
  color: #dbe3dc;
  font-size: 0.92rem;
  line-height: 1.45;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.login-message {
  min-height: 2.8rem;
  margin-top: 2px;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 86px;
  margin-bottom: 6px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-logo {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.58)) drop-shadow(0 0 18px rgba(66, 214, 197, 0.12));
}

h2,
h3 {
  color: #f8d790;
  font-size: 1rem;
  line-height: 1;
}

.game-shell {
  display: block;
}

.world-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(20, 24, 25, 0.94);
  box-shadow: 0 16px 38px var(--shadow);
}

.world-panel {
  position: relative;
  width: min(1280px, 100%);
  margin: 0 auto;
  min-height: 620px;
  overflow: hidden;
}

.pixi-stage {
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 620px;
  background: #071013;
}

.pixi-stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: crosshair;
  image-rendering: pixelated;
  touch-action: none;
}

.world-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.location-tag,
.dialogue,
.mobile-controls {
  border: 1px solid rgba(114, 132, 128, 0.55);
  border-radius: 7px;
  background: rgba(10, 14, 15, 0.86);
  backdrop-filter: blur(3px);
}

.location-tag {
  min-width: min(380px, 70vw);
  border: 0;
  border-radius: 0;
  background:
    url("./public/assets/ui/generated/input-dark.png") center / 100% 100% no-repeat,
    rgba(10, 14, 15, 0.86);
  box-shadow: none;
  image-rendering: pixelated;
  padding: 12px 20px;
}

.location-tag span,
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.location-tag strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #fff5cf;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talk-button {
  pointer-events: auto;
  width: 76px;
  min-width: 0;
  min-height: 32px;
  height: 36px;
  padding: 0 9px 1px;
  font-size: 0.82rem;
  line-height: 1;
}

.minimal-hud {
  position: absolute;
  top: 58px;
  right: 12px;
  z-index: 5;
  display: grid;
  width: min(376px, 42vw);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  pointer-events: auto;
}

.minimal-hud div,
.minimal-hud button {
  min-width: 0;
}

.minimal-hud div {
  border: 0;
  border-radius: 0;
  background:
    url("./public/assets/ui/generated/input-dark.png") center / 100% 100% no-repeat,
    rgba(9, 13, 14, 0.88);
  image-rendering: pixelated;
  padding: 9px 14px;
}

.minimal-hud span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.minimal-hud strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--teal);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minimal-hud button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 34px;
}

.minimal-hud button span {
  display: inline;
  color: var(--amber);
  font-size: inherit;
  text-transform: none;
}

.world-panel:has(.dialogue:not(.is-hidden)) .minimal-hud,
.world-panel:has(.game-screen:not(.is-hidden)) .minimal-hud,
.world-panel:has(.story-modal:not(.is-hidden)) .minimal-hud {
  display: none;
}

.dialogue {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  border: 0;
  border-radius: 0;
  background:
    url("./public/assets/ui/generated/dialogue-panel-wide.png") center / 100% 100% no-repeat,
    rgba(8, 12, 13, 0.95);
  box-shadow: none;
  image-rendering: pixelated;
  min-height: 124px;
  padding: 22px 32px 24px;
}

.dialogue.is-hidden {
  display: none;
}

.dialogue-portrait-frame {
  position: relative;
  align-self: end;
  width: 112px;
  height: 108px;
  margin: 0 0 -4px 2px;
  pointer-events: none;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform-origin: 50% 100%;
  animation: dialogue-portrait-frame-idle 2.2s ease-in-out infinite;
}

.dialogue-portrait-frame::after {
  position: absolute;
  right: 18px;
  bottom: 5px;
  left: 18px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.46);
  content: "";
  filter: blur(2px);
}

.dialogue-portrait {
  position: absolute;
  z-index: 1;
  bottom: 6px;
  left: 50%;
  max-width: 116px;
  max-height: 116px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.24)) drop-shadow(0 0 8px rgba(5, 8, 8, 0.82));
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  animation: dialogue-portrait-breathe 2.4s ease-in-out infinite;
}

.dialogue-body {
  min-width: 0;
  align-self: center;
}

.dialogue-speaker {
  margin-bottom: 6px;
  color: var(--amber);
  font-weight: 700;
}

.dialogue-text {
  color: #dfe7dd;
  line-height: 1.38;
}

.dialogue-text.is-typing::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.16em;
  background: var(--cyan);
  animation: text-caret 0.65s steps(1) infinite;
}

@keyframes text-caret {
  50% {
    opacity: 0;
  }
}

@keyframes dialogue-portrait-breathe {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scaleX(1) scaleY(1);
  }

  50% {
    transform: translateX(-50%) translateY(-3px) scaleX(1.022) scaleY(0.986);
  }
}

@keyframes dialogue-portrait-frame-idle {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(1px);
  }
}

.dialogue-actions {
  display: grid;
  grid-template-columns: minmax(112px, auto);
  gap: 9px;
}

.story-modal {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(3, 7, 8, 0.52);
}

.game-screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(3, 7, 8, 0.5);
}

.game-screen.is-hidden {
  display: none;
}

.game-screen-card {
  position: relative;
  width: min(900px, 100%);
  max-height: min(540px, calc(100% - 24px));
  overflow: auto;
  border: 2px solid rgba(214, 151, 71, 0.92);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(66, 214, 197, 0.08), transparent 24%, transparent 76%, rgba(240, 169, 75, 0.1)),
    linear-gradient(180deg, rgba(18, 22, 23, 0.98), rgba(7, 10, 11, 0.98));
  image-rendering: pixelated;
  padding: 30px 38px 34px;
  box-shadow:
    inset 0 0 0 2px rgba(4, 7, 7, 0.95),
    inset 0 0 0 5px rgba(66, 214, 197, 0.16),
    0 22px 52px rgba(0, 0, 0, 0.62);
}

.game-screen-card::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(240, 169, 75, 0.34);
  border-radius: 2px;
  content: "";
  pointer-events: none;
}

.game-screen-card::after {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(240, 169, 75, 0.86);
  background: #071013;
  box-shadow:
    inset 0 0 0 3px rgba(66, 214, 197, 0.72),
    0 0 0 2px rgba(4, 7, 7, 0.9);
  content: "";
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
}

.game-screen-card:has(#screen-guildmaster.is-active) {
  width: min(760px, 100%);
  padding: 28px 36px 32px;
}

.game-screen-card:has(#screen-blacksmith.is-active) {
  width: min(700px, 100%);
  padding: 30px 40px 42px;
}

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

.game-screen-heading span {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.game-screen-page {
  display: none;
}

.game-screen-page.is-active {
  display: block;
}

.screen-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.roster-heading {
  margin-top: 14px;
}

#screen-guildmaster.is-active {
  display: grid;
  gap: 12px;
}

#screen-guildmaster .selected-hero {
  margin-top: 0;
}

#screen-guildmaster .roster-heading {
  margin: 2px 0 0;
}

.chronicle-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
}

.story-modal.is-hidden {
  display: none;
}

.story-card {
  position: relative;
  width: min(680px, 90%);
  min-height: 252px;
  padding: 34px 40px 30px;
  border: 2px solid rgba(240, 169, 75, 0.82);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(66, 214, 197, 0.12), transparent 18%, transparent 82%, rgba(240, 169, 75, 0.14)),
    rgba(8, 12, 13, 0.96);
  box-shadow:
    inset 0 0 0 2px rgba(5, 7, 7, 0.95),
    inset 0 0 0 5px rgba(66, 214, 197, 0.18),
    0 18px 46px rgba(0, 0, 0, 0.62);
  image-rendering: pixelated;
  animation: story-pop 0.26s steps(4) both;
}

.story-card::before,
.story-card::after {
  position: absolute;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(240, 169, 75, 0.9);
  background: #071013;
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.story-card::before {
  top: -10px;
}

.story-card::after {
  bottom: -10px;
}

.story-title {
  margin-bottom: 7px;
  color: #f8d790;
  font-size: 1.24rem;
}

.story-source {
  margin-bottom: 18px;
  color: var(--cyan);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.story-text {
  min-height: 124px;
  color: #f6eed5;
  font-size: 1.02rem;
  line-height: 1.55;
}

.story-text.is-typing::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 1em;
  margin-left: 5px;
  vertical-align: -0.15em;
  background: var(--amber);
  animation: text-caret 0.65s steps(1) infinite;
}

.story-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

@keyframes story-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.quiet-button {
  color: var(--ink);
  background:
    url("./public/assets/ui/generated/input-dark.png") center / 100% 100% no-repeat,
    linear-gradient(180deg, #293232 0%, #171d1d 58%, #101414 100%);
  box-shadow: none;
  text-shadow: 0 1px 0 #050707;
}

.game-screen-heading .quiet-button {
  min-height: 36px;
  border: 1px solid rgba(240, 169, 75, 0.72);
  border-radius: 3px;
  color: #fff4cf;
  background:
    linear-gradient(180deg, rgba(22, 27, 27, 0.98), rgba(8, 12, 13, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(4, 7, 7, 0.92),
    inset 0 0 0 3px rgba(66, 214, 197, 0.12);
  padding: 0 18px;
  text-shadow: none;
}

.game-screen-heading .quiet-button:hover:not(:disabled) {
  border-color: rgba(240, 169, 75, 0.95);
  filter: brightness(1.08);
}

.mobile-controls {
  position: absolute;
  right: 12px;
  bottom: 108px;
  display: none;
  gap: 7px;
  padding: 8px;
  touch-action: none;
}

.mobile-controls > button {
  display: block;
  width: 48px;
}

.mobile-controls div {
  display: flex;
  gap: 7px;
}

.hud {
  display: grid;
  gap: 11px;
}

.panel {
  padding: 12px;
}

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

.panel-heading span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recruit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
}

.selected-hero {
  margin-top: 10px;
}

.selected-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.selected-card img {
  width: 88px;
  height: 88px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
  image-rendering: pixelated;
}

.selected-title {
  overflow: hidden;
  color: #fff4cf;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-subtitle {
  margin: 4px 0 9px;
  color: var(--muted);
  font-size: 0.84rem;
}

.selected-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.selected-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.selected-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.selected-traits span {
  min-width: 70px;
  border: 1px solid rgba(66, 214, 197, 0.22);
  background: rgba(7, 12, 13, 0.62);
  padding: 5px 8px;
  color: #f2c46e;
  font-weight: 700;
}

.selected-traits small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
}

.selected-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.selected-lines p {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(63, 74, 72, 0.74);
  background: rgba(8, 13, 14, 0.72);
  padding: 7px 9px;
  color: #dfe7dd;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-lines span {
  color: var(--amber);
  font-weight: 700;
}

#screen-guildmaster .selected-card {
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  min-height: 112px;
  border: 1px solid rgba(240, 169, 75, 0.34);
  background: rgba(8, 13, 14, 0.58);
  padding: 12px;
}

#screen-guildmaster .selected-card img {
  width: 76px;
  height: 76px;
  border-color: rgba(240, 169, 75, 0.42);
}

#screen-guildmaster .selected-subtitle {
  margin: 0;
}

#screen-blacksmith.is-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#screen-blacksmith .panel-heading {
  margin-bottom: 0;
}

#screen-blacksmith .forge-heading {
  justify-content: flex-end;
  min-height: 16px;
}

.forge-summary,
.forge-order {
  min-width: 0;
}

.stat-grid,
.inventory-grid {
  display: grid;
  gap: 8px;
}

.stat-box,
.inventory-grid div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #0f1415;
}

.inventory-grid div {
  padding: 9px;
}

.stat-value,
.inventory-grid strong {
  display: block;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--teal);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inventory-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.inventory-grid strong {
  color: var(--amber);
}

#screen-blacksmith .inventory-grid {
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
}

#screen-blacksmith .inventory-grid div {
  border-color: rgba(66, 214, 197, 0.18);
  background:
    linear-gradient(180deg, rgba(18, 25, 25, 0.94), rgba(9, 14, 15, 0.96));
  padding: 12px 14px;
}

#screen-blacksmith .inventory-grid strong {
  margin-top: 7px;
  font-size: 0.96rem;
}

.forge-order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: stretch;
  gap: 10px;
  border: 1px solid rgba(240, 169, 75, 0.28);
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(240, 169, 75, 0.08), transparent 34%),
    rgba(8, 13, 14, 0.72);
  padding: 9px;
}

.forge-status {
  margin-top: 0;
  border: 1px solid rgba(63, 74, 72, 0.58);
  border-radius: 5px;
  background: rgba(5, 9, 10, 0.78);
  min-height: 44px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

#screen-blacksmith .forge-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.forge-status.is-working {
  border-color: rgba(66, 214, 197, 0.52);
  background:
    radial-gradient(circle at 20% 100%, rgba(240, 169, 75, 0.18), transparent 42%),
    linear-gradient(90deg, rgba(66, 214, 197, 0.13), rgba(5, 9, 10, 0.82));
  color: var(--teal);
  overflow: hidden;
}

.forge-status.is-ready {
  border-color: rgba(240, 169, 75, 0.68);
  background: rgba(240, 169, 75, 0.08);
  color: var(--amber);
}

.forge-work-icon {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(240, 169, 75, 0.32));
  transform-origin: 50% 72%;
  animation: forge-icon-hit 1.05s ease-in-out infinite;
}

.forge-status-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.forge-status-copy strong {
  overflow: hidden;
  color: #f7d17a;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forge-status-copy span {
  overflow: hidden;
  color: var(--teal);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes forge-icon-hit {
  0%,
  100% {
    filter: drop-shadow(0 0 7px rgba(240, 169, 75, 0.28));
    transform: translateY(0) rotate(-1deg) scale(1);
  }

  38% {
    filter: drop-shadow(0 0 13px rgba(240, 169, 75, 0.7));
    transform: translateY(2px) rotate(2deg) scale(0.96);
  }

  48% {
    transform: translateY(-1px) rotate(0deg) scale(1.02);
  }
}

.forge-action {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(240, 169, 75, 0.78);
  border-radius: 3px;
  color: #1b1208;
  background:
    linear-gradient(180deg, #ffd681 0%, #e4a144 54%, #8e4d1f 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 238, 162, 0.42),
    inset 0 -3px 0 rgba(73, 35, 13, 0.35);
  font-size: 0.9rem;
  margin-top: 0;
  padding: 0 14px;
  text-shadow: 0 1px 0 rgba(255, 232, 155, 0.5);
  white-space: nowrap;
}

.forge-action:hover:not(:disabled) {
  filter: brightness(1.07);
}

.weapon-list {
  display: grid;
  gap: 6px;
  min-height: 66px;
  max-height: 140px;
  margin-top: 0;
  overflow: auto;
}

#screen-blacksmith .weapon-list:has(.weapon-empty) {
  display: none;
}

.weapon-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #0b0f10;
  padding: 7px 8px;
  color: #dfe7dd;
  font-weight: 700;
  text-align: left;
  text-shadow: none;
}

.weapon-item strong,
.weapon-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weapon-item strong {
  color: #fff4cf;
}

.weapon-item span {
  color: var(--teal);
  font-size: 0.74rem;
}

.weapon-item.is-selected {
  border-color: rgba(240, 169, 75, 0.82);
  background: rgba(240, 169, 75, 0.08);
}

.weapon-item.is-equipped strong::after {
  color: var(--teal);
  content: " equipped";
  font-size: 0.72rem;
  font-weight: 400;
}

.weapon-empty {
  border: 1px dashed rgba(66, 214, 197, 0.18);
  border-radius: 5px;
  min-height: 66px;
  display: grid;
  place-items: center;
  padding: 10px 8px;
  background: rgba(5, 9, 10, 0.48);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

#screen-blacksmith .weapon-list:has(.weapon-empty) + .weapon-actions {
  display: none;
}

.weapon-actions {
  display: grid;
  grid-template-columns: 82px 82px minmax(0, 1fr);
  gap: 8px;
  margin-top: 0;
}

.weapon-actions button,
.weapon-actions input {
  min-width: 0;
  min-height: 38px;
}

.weapon-actions button {
  padding: 0 12px;
}

.weapon-actions button:disabled {
  color: var(--muted);
  background:
    url("./public/assets/ui/generated/input-dark.png") center / 100% 100% no-repeat,
    linear-gradient(180deg, #232b2b 0%, #141919 58%, #0c1010 100%);
  text-shadow: 0 1px 0 #050707;
}

.weapon-actions input:disabled {
  opacity: 0.45;
}

.arena-choice,
.arena-mode-panel {
  display: grid;
  gap: 8px;
}

.arena-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.arena-mode-panel {
  grid-template-columns: minmax(0, 1fr) 190px 92px;
}

.arena-choice button,
.arena-mode-panel button {
  width: 100%;
}

.arena-choice button {
  min-height: 48px;
}

.arena-mode-panel[hidden],
.arena-choice[hidden] {
  display: none;
}

.arena-message {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.pending-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pending-list li {
  display: grid;
  gap: 2px;
  border-left: 3px solid var(--amber);
  padding: 5px 7px;
  color: #dce3dc;
  background: #0b0f10;
  font-size: 0.78rem;
  line-height: 1.3;
}

.pending-list li.empty {
  border-left-color: var(--line);
  color: var(--muted);
}

.pending-list span {
  color: var(--muted);
}

.stat-grid {
  grid-template-columns: repeat(3, 1fr);
}

.stat-box {
  padding: 6px;
}

.stat-value {
  color: #f2c46e;
}

.run-status {
  display: grid;
  gap: 3px;
  margin-top: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #0f1415;
  padding: 8px;
}

.run-status-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.run-status strong {
  color: var(--teal);
  font-size: 0.92rem;
}

.run-status-detail {
  overflow: hidden;
  color: #c8d1c8;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-status.is-active {
  border-color: rgba(66, 214, 197, 0.62);
}

.run-status.is-returned {
  border-color: rgba(240, 169, 75, 0.62);
}

.run-status.is-danger {
  border-color: rgba(224, 103, 88, 0.7);
}

.run-status.is-returned strong {
  color: var(--amber);
}

.run-status.is-danger strong {
  color: var(--danger);
}

.hero-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

#screen-guildmaster .hero-list {
  max-height: 184px;
  gap: 6px;
  padding-right: 0;
  scrollbar-width: thin;
}

.hero-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  min-height: 82px;
  border: 1px solid #314042;
  border-radius: 6px;
  color: var(--ink);
  background: #101617;
  padding: 8px;
  text-align: left;
  box-shadow: none;
}

#screen-guildmaster .hero-card {
  grid-template-columns: 48px minmax(0, 1fr);
  min-height: 60px;
  border-color: rgba(63, 74, 72, 0.72);
  background: rgba(8, 13, 14, 0.66);
  padding: 6px;
}

.hero-card:hover,
.hero-card.is-selected {
  border-color: var(--teal);
  background: #142122;
}

.hero-card:active {
  transform: none;
}

.hero-card img {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
  image-rendering: pixelated;
}

#screen-guildmaster .hero-card img {
  width: 48px;
  height: 48px;
}

.hero-name-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.hero-name,
.rarity {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-name {
  color: #fff3c7;
  font-weight: 700;
}

.rarity {
  flex: 0 0 auto;
  font-size: 0.72rem;
}

.hero-class {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-run-badge {
  display: inline-block;
  max-width: 100%;
  margin-top: 7px;
  border: 1px solid rgba(66, 214, 197, 0.45);
  border-radius: 4px;
  padding: 3px 6px;
  overflow: hidden;
  color: var(--teal);
  background: rgba(66, 214, 197, 0.08);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-run-badge.is-returned {
  border-color: rgba(240, 169, 75, 0.48);
  color: var(--amber);
  background: rgba(240, 169, 75, 0.08);
}

.hero-run-badge.is-danger {
  border-color: rgba(224, 103, 88, 0.55);
  color: var(--danger);
  background: rgba(224, 103, 88, 0.08);
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 286px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

.event-log li {
  border-left: 3px solid var(--teal);
  padding: 7px 8px;
  color: #dde4dc;
  background: #0f1415;
  font-size: 0.86rem;
  line-height: 1.36;
}

.event-log li.danger {
  border-left-color: var(--danger);
}

.event-log li.reward {
  border-left-color: var(--amber);
}

.event-time {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.empty-state {
  min-height: 72px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

@media (max-width: 1180px) {
  .app-shell {
    width: min(1280px, calc(100vw - 20px));
  }

  .minimal-hud {
    width: min(336px, 48vw);
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 720px);
    padding-top: 12px;
  }

  .app-shell:not(.is-unlocked) {
    width: 100%;
    padding: 0;
  }

  .login-screen {
    padding: 16px;
  }

  .topbar {
    min-height: 72px;
  }

  .brand-lockup {
    justify-content: center;
  }

  .game-logo {
    width: auto;
    max-width: 100%;
    max-height: 140px;
    object-position: center;
  }

  .world-panel,
  .pixi-stage {
    min-height: 480px;
  }

  .minimal-hud {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
  }

  .game-screen {
    padding: 12px;
  }

  .game-screen-card {
    max-height: calc(100% - 12px);
    padding: 24px 26px 28px;
  }

  .game-screen-card:has(#screen-blacksmith.is-active) {
    padding: 24px 26px 36px;
  }

  .game-screen-heading {
    align-items: flex-start;
  }

  .chronicle-grid,
  .inventory-grid,
  .arena-choice,
  .arena-mode-panel,
  .recruit-form,
  .weapon-actions {
    grid-template-columns: 1fr;
  }

  #screen-blacksmith.is-active,
  #screen-blacksmith .weapon-actions {
    grid-template-columns: 1fr;
  }

  #screen-blacksmith .inventory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #screen-blacksmith .weapon-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #screen-blacksmith .weapon-actions input {
    grid-column: 1 / -1;
  }

  #screen-blacksmith .forge-status,
  #screen-blacksmith .forge-action {
    grid-column: 1;
  }

  #screen-blacksmith .weapon-list {
    max-height: 132px;
  }

  .dialogue {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px 12px;
    align-items: end;
    min-height: 108px;
    padding: 18px 24px 20px;
  }

  .dialogue-portrait-frame {
    width: 78px;
    height: 78px;
    margin: 0 0 -2px 0;
  }

  .dialogue-portrait {
    max-width: 82px;
    max-height: 82px;
  }

  .dialogue-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-controls {
    display: grid;
  }

  .dialogue:not(.is-hidden) ~ .mobile-controls {
    display: none;
  }
}
