* {
  box-sizing: border-box;
}

:root {
  --bg-abyss: #070c14;
  --bg-night: #0f1a2b;
  --ink: #10161f;
  --stone: #546172;
  --stone-dark: #303a49;
  --gold: #dcb86a;
  --gold-dark: #8a6832;
  --parchment: #f4e8ca;
  --mist: rgba(173, 218, 255, 0.13);
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "VT323", "Courier New", monospace;
  color: var(--parchment);
  background:
    radial-gradient(1200px 520px at 50% -10%, rgba(77, 121, 184, 0.24), transparent 58%),
    radial-gradient(900px 500px at 15% 12%, rgba(78, 128, 95, 0.14), transparent 62%),
    linear-gradient(180deg, #121d2f 0%, #0c1625 44%, #080d15 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.025) 0 1px,
      transparent 1px 3px
    );
  mix-blend-mode: soft-light;
  opacity: 0.45;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  padding: 0.95rem 1.1rem;
  border-bottom: 3px solid rgba(220, 184, 106, 0.52);
  background:
    linear-gradient(180deg, rgba(19, 29, 45, 0.94), rgba(11, 17, 28, 0.94)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 3px, transparent 3px 8px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.44);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  min-width: 140px;
}

.header-right {
  justify-content: flex-end;
}

.site-header h1 {
  margin: 0;
  font-family: "Almendra SC", "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.2vw, 2.2rem);
  letter-spacing: 0.04em;
  color: #ffdf97;
  text-shadow: 0 2px 0 rgba(46, 28, 2, 0.9);
}

.header-btn {
  text-decoration: none;
  color: #fff5dc;
  font-size: 1.08rem;
  line-height: 1;
  padding: 0.45rem 0.75rem;
  border: 2px solid var(--gold-dark);
  background:
    linear-gradient(180deg, rgba(74, 54, 23, 0.95), rgba(46, 31, 14, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1px rgba(249, 216, 147, 0.34);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.header-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.home-screen {
  width: min(1400px, 100%);
  margin: 0 auto;
  min-height: calc(100vh - 86px);
  display: grid;
  align-items: stretch;
  padding: 1rem;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(5, 8, 14, 0.56);
}

.auth-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  height: 100vh;
  width: min(34vw, 520px);
  min-width: 320px;
  border-left: 3px solid rgba(220, 184, 106, 0.52);
  background:
    linear-gradient(180deg, rgba(18, 28, 43, 0.97), rgba(10, 16, 27, 0.98)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0 3px, transparent 3px 8px);
  box-shadow: -14px 0 26px rgba(0, 0, 0, 0.45);
  padding: 0.85rem;
  transform: translateX(100%);
  transition: transform 0.23s ease;
  display: grid;
  grid-auto-rows: min-content;
  gap: 0.65rem;
  overflow: auto;
}

.auth-panel.open {
  transform: translateX(0);
}

.auth-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.auth-panel-top h2 {
  margin: 0;
  font-family: "MedievalSharp", serif;
  color: #f7d594;
}

.panel-close,
.panel-section button,
.tab-btn {
  border: 2px solid #8a6832;
  background: #2f1f12;
  color: #ffe8bb;
  font-family: "VT323", monospace;
  font-size: 1rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}

.panel-tabs {
  display: flex;
  gap: 0.4rem;
}

.tab-btn {
  flex: 1;
  border-color: #546275;
  background: #172132;
}

.tab-btn.active {
  border-color: #c89345;
  background: #3a2612;
}

.panel-section {
  border: 2px solid #4d5a71;
  background: #111a29;
  padding: 0.65rem;
  display: grid;
  gap: 0.35rem;
}

.panel-section[hidden] {
  display: none !important;
}

.panel-section form {
  display: grid;
  gap: 0.35rem;
}

.panel-section label {
  color: #e6d8bd;
}

.panel-section input {
  border: 2px solid #7d6339;
  background: #150f09;
  color: #fff0d0;
  font-family: "VT323", monospace;
  font-size: 1.02rem;
  padding: 0.33rem 0.4rem;
}

.panel-user {
  margin: 0;
  color: #ffdc98;
}

.profile-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.55rem;
  align-items: center;
  border: 2px solid rgba(154, 169, 191, 0.28);
  background: rgba(9, 14, 24, 0.58);
  padding: 0.7rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.profile-card--default {
  border-color: rgba(95, 119, 156, 0.5);
  background: rgba(9, 14, 24, 0.58);
}

.profile-card--ember {
  border-color: rgba(210, 111, 42, 0.8);
  background: linear-gradient(180deg, rgba(210, 111, 42, 0.22), rgba(9, 14, 24, 0.72));
  box-shadow: inset 0 0 0 1px rgba(210, 111, 42, 0.25);
}

.profile-card--cobalt {
  border-color: rgba(79, 137, 223, 0.8);
  background: linear-gradient(180deg, rgba(79, 137, 223, 0.2), rgba(9, 14, 24, 0.72));
  box-shadow: inset 0 0 0 1px rgba(79, 137, 223, 0.25);
}

.profile-card--emerald {
  border-color: rgba(99, 181, 118, 0.8);
  background: linear-gradient(180deg, rgba(99, 181, 118, 0.2), rgba(9, 14, 24, 0.72));
  box-shadow: inset 0 0 0 1px rgba(99, 181, 118, 0.25);
}

.profile-card--violet {
  border-color: rgba(143, 90, 212, 0.8);
  background: linear-gradient(180deg, rgba(143, 90, 212, 0.24), rgba(9, 14, 24, 0.72));
  box-shadow: inset 0 0 0 1px rgba(143, 90, 212, 0.28);
}

.profile-card--dawn {
  border-color: rgba(224, 166, 90, 0.8);
  background: linear-gradient(180deg, rgba(224, 166, 90, 0.23), rgba(9, 14, 24, 0.72));
  box-shadow: inset 0 0 0 1px rgba(224, 166, 90, 0.25);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px solid #7e6236;
  background: #101216;
}

.profile-meta {
  display: grid;
  gap: 0.35rem;
}

.profile-name {
  margin: 0;
  color: #ffe3a8;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.profile-sub {
  margin: 0;
  color: #c5cfdf;
  font-size: 0.95rem;
}

.profile-title-chip {
  border: 1px solid #7d6339;
  background: #2b1d10;
  color: #ffe2a6;
  padding: 0.05rem 0.35rem;
  font-size: 0.86rem;
}

.profile-cosmetic-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.profile-cosmetic {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  border: 1px solid #4c5f7d;
  background: #0b121d;
  color: #d7e4fb;
  padding: 0.1rem 0.25rem;
  font-size: 0.85rem;
}

.profile-cosmetic img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid #7d6339;
  background: #101216;
}

.disclaimer-wrap {
  margin-top: 1rem;
  border: 3px solid rgba(122, 144, 176, 0.62);
  background:
    linear-gradient(180deg, rgba(11, 17, 29, 0.95), rgba(7, 12, 20, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 6px);
  box-shadow: inset 0 0 0 2px rgba(220, 184, 106, 0.16);
  padding: 1rem;
  display: grid;
  gap: 0.65rem;
}

.disclaimer-wrap h2 {
  margin: 0;
  font-family: "Almendra SC", serif;
  color: #ffdf97;
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
}

.disclaimer-wrap h3 {
  margin: 0.3rem 0 0;
  font-family: "MedievalSharp", serif;
  color: #f2cf8d;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
}

.disclaimer-wrap p {
  margin: 0;
  color: #d9e2f3;
  font-size: 1.18rem;
  line-height: 1.6;
}

.disclaimer-intro {
  color: #ffeec8;
}

.profile-banner {
  display: block;
  width: 100%;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-banner--default {
  background: linear-gradient(90deg, #29415f, #3f5f87);
}

.profile-banner--dye {
  background: linear-gradient(90deg, #c24d2e, #e29433);
}

.profile-banner--oak {
  background: linear-gradient(90deg, #3f5b35, #729d56);
}

.profile-banner--royal {
  background: linear-gradient(90deg, #3a245f, #7a4dbc);
}
.profile-banner--ember { background: linear-gradient(90deg, #7d2e22, #d26f2a); }
.profile-banner--cobalt { background: linear-gradient(90deg, #173d7a, #4f89df); }
.profile-banner--emerald { background: linear-gradient(90deg, #295a36, #63b576); }
.profile-banner--violet { background: linear-gradient(90deg, #45256d, #8f5ad4); }
.profile-banner--dawn { background: linear-gradient(90deg, #a34b39, #e0a65a); }

.profile-actions {
  display: flex;
  justify-content: flex-start;
}

.profile-jump-btn {
  display: inline-block;
  border: 2px solid #8a6832;
  background: #2f1f12;
  color: #ffe8bb;
  text-decoration: none;
  font-family: "VT323", monospace;
  font-size: 1rem;
  padding: 0.25rem 0.55rem;
}

.profile-jump-btn:hover {
  filter: brightness(1.1);
}

.xp-wrap {
  display: grid;
  gap: 0.2rem;
}

.xp-top {
  display: flex;
  justify-content: space-between;
  color: #c9d3e5;
  font-size: 0.92rem;
}

.xp-track {
  height: 14px;
  border: 2px solid #4a5770;
  background: #0b121d;
}

.xp-fill {
  display: block;
  width: 0%;
  height: 100%;
  background:
    linear-gradient(180deg, #8ee6a2 0%, #3d9d65 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 4px);
}

.coin-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  width: fit-content;
  border: 2px solid #8b6b34;
  background: linear-gradient(180deg, rgba(59, 43, 18, 0.9), rgba(35, 25, 12, 0.92));
  color: #ffe7b5;
  padding: 0.22rem 0.48rem;
}

.coin-icon {
  width: 12px;
  height: 12px;
  border: 2px solid #ffdd8e;
  background: radial-gradient(circle at 34% 30%, #fff4c8 0%, #f0bf52 46%, #b1761f 100%);
  box-shadow: 0 0 8px rgba(255, 210, 110, 0.35);
}

.coin-label {
  color: #f7d694;
}

.coin-value {
  color: #fff2cc;
}

.quick-customize {
  border: 1px solid #425270;
  background: #0a121f;
  padding: 0.3rem;
  display: grid;
  gap: 0.3rem;
}

.quick-customize-title {
  margin: 0;
  color: #ffe4a2;
  font-size: 0.98rem;
}

.quick-customize-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.quick-customize-row > span {
  color: #cfd8ea;
  min-width: 38px;
}

.quick-customize-row .profile-equip-form button {
  width: auto;
  font-size: 0.92rem;
  padding: 0.2rem 0.38rem;
}

.panel-note {
  margin: 0;
  color: #c6ccda;
}

.wallet-panel {
  border: 2px solid #4d5a71;
  background: #0f1929;
  padding: 0.6rem;
  display: grid;
  gap: 0.3rem;
}

.wallet-panel h3 {
  margin: 0;
  color: #f4d393;
  font-family: "MedievalSharp", serif;
}

.wallet-panel h4 {
  margin: 0;
  color: #dbe8ff;
  font-size: 1rem;
}

.wallet-rate,
.wallet-note,
.wallet-status {
  margin: 0;
  color: #ced6e4;
}

.wallet-address-row {
  border: 2px solid #5e6f8a;
  background: #0b111a;
  padding: 0.32rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wallet-address-row code {
  color: #d7ecff;
  overflow-wrap: anywhere;
  flex: 1;
}

.wallet-address-row button {
  border: 2px solid #8a6832;
  background: #2f1f12;
  color: #ffe8bb;
  font-family: "VT323", monospace;
  font-size: 0.95rem;
  padding: 0.22rem 0.42rem;
  cursor: pointer;
}

.customization-grid {
  display: grid;
  gap: 0.5rem;
}

.customization-card {
  border: 1px solid #475a78;
  background: #0b121d;
  padding: 0.38rem;
  display: grid;
  gap: 0.28rem;
}

.profile-equip-form button {
  width: 100%;
  text-align: left;
  border: 2px solid #7a6037;
  background: #24170c;
  color: #fff0cf;
  font-family: "VT323", monospace;
  font-size: 1rem;
  padding: 0.3rem 0.42rem;
  cursor: pointer;
}

.profile-equip-form button:hover {
  filter: brightness(1.12);
}

.profile-equip-form button:disabled {
  border-color: #4f607d;
  background: #1a2739;
  color: #b5c4dd;
  cursor: default;
}

.cosmetic-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cosmetic-choice img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid #4f607d;
  background: #0f1726;
}

.banner-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid #4f607d;
  vertical-align: middle;
  margin-right: 0.3rem;
}

.banner-swatch--default { background: linear-gradient(90deg, #29415f, #3f5f87); }
.banner-swatch--ember { background: linear-gradient(90deg, #7d2e22, #d26f2a); }
.banner-swatch--cobalt { background: linear-gradient(90deg, #173d7a, #4f89df); }
.banner-swatch--emerald { background: linear-gradient(90deg, #295a36, #63b576); }
.banner-swatch--violet { background: linear-gradient(90deg, #45256d, #8f5ad4); }
.banner-swatch--dawn { background: linear-gradient(90deg, #a34b39, #e0a65a); }

.powerup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.55rem;
}

.powerup-grid p {
  margin: 0;
  color: #d7ecff;
}

.chest-grid {
  display: grid;
  gap: 0.45rem;
}

.chest-item {
  border: 2px solid #5e6f8a;
  background: #0b111a;
  padding: 0.38rem;
  display: grid;
  gap: 0.25rem;
  justify-items: start;
}

.chest-item img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.chest-item p {
  margin: 0;
  color: #d7ecff;
}

.wallet-error {
  margin: 0;
  color: #ffd4d4;
  border: 2px solid rgba(231, 130, 130, 0.65);
  background: rgba(83, 28, 28, 0.5);
  padding: 0.32rem 0.4rem;
}
.wallet-log {
  border: 2px solid #5e6f8a;
  background: #0b111a;
  padding: 0.35rem;
  display: grid;
  gap: 0.28rem;
  max-height: 190px;
  overflow: auto;
}
.wallet-log-entry {
  border: 1px solid #3d4d67;
  background: #111a29;
  padding: 0.28rem;
  display: grid;
  gap: 0.18rem;
}
.wallet-log-entry p {
  margin: 0;
  color: #d7ecff;
  font-size: 0.92rem;
  line-height: 1.2;
}

.auth-message {
  border: 2px solid;
  padding: 0.34rem 0.46rem;
}

.auth-message.error {
  border-color: rgba(231, 130, 130, 0.65);
  color: #ffd4d4;
  background: rgba(83, 28, 28, 0.5);
}

.auth-message.success {
  border-color: rgba(143, 213, 143, 0.65);
  color: #d8f5d8;
  background: rgba(31, 70, 31, 0.5);
}

.hint {
  margin: 0;
  color: #bdb5a4;
  font-size: 0.95rem;
}

.password-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.password-input-wrap input {
  flex: 1 1 auto;
}

.password-toggle {
  min-width: 64px;
  padding: 0.34rem 0.5rem;
  line-height: 1;
}

.strength {
  display: grid;
  gap: 0.25rem;
}

.strength-bar {
  height: 14px;
  border: 2px solid #47566f;
  background: #0d131d;
}

#strength-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #b94c4c;
  transition: width 0.2s ease, background 0.2s ease;
}

#strength-text {
  margin: 0;
  color: #c8d1e0;
}

.scene-box {
  position: relative;
  width: 100%;
  min-height: min(82vh, 860px);
  border: 4px solid #6e7784;
  box-shadow:
    inset 0 0 0 4px #283444,
    inset 0 0 0 7px rgba(220, 184, 106, 0.26),
    0 18px 42px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13, 19, 31, 0.33), rgba(11, 16, 26, 0.58)),
    url("/static/Images/background%201.jpg") center center / cover no-repeat;
}

.scene-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(560px 300px at 68% 20%, rgba(187, 217, 255, 0.22), transparent 60%),
    radial-gradient(700px 260px at 34% 78%, rgba(52, 94, 61, 0.22), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.22));
}

.scene-box::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(56, 74, 48, 0.3) 0 5px,
      rgba(45, 62, 38, 0.3) 5px 10px
    ),
    linear-gradient(180deg, transparent 0%, rgba(26, 34, 22, 0.82) 80%);
}

.scene-sky,
.scene-mountains,
.scene-forest,
.scene-ground,
.scene-path {
  display: none;
}

.frontguy,
.castle {
  position: absolute;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  z-index: 2;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.48));
}

.frontguy {
  right: 10%;
  bottom: 9.4%;
  width: clamp(140px, 15vw, 285px);
  animation: knight-idle 1.6s steps(2) infinite;
}

.castle {
  left: 6%;
  bottom: 6.2%;
  width: clamp(260px, 27vw, 540px);
}

.start-cta-wrap {
  position: absolute;
  left: 50%;
  bottom: 23%;
  transform: translateX(-50%);
  z-index: 4;
}

.start-cta {
  display: inline-block;
  text-decoration: none;
  color: #fff5d7;
  font-family: "MedievalSharp", serif;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  letter-spacing: 0.02em;
  padding: 0.5rem 1.1rem;
  border: 3px solid #8a6832;
  background:
    linear-gradient(180deg, rgba(95, 58, 23, 0.95), rgba(55, 32, 14, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 5px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 216, 140, 0.42),
    0 8px 20px rgba(0, 0, 0, 0.42);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.start-cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

@keyframes knight-idle {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
  100% {
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .home-screen {
    padding: 0.75rem;
  }

  .scene-box {
    min-height: min(76vh, 620px);
  }

  .frontguy {
    right: 6%;
    width: clamp(120px, 24vw, 220px);
    bottom: 10%;
  }

  .castle {
    left: 3%;
    width: clamp(220px, 42vw, 360px);
    bottom: 6.5%;
  }

  .start-cta-wrap {
    bottom: 22%;
  }
}

@media (max-width: 760px) {
  .site-header h1 {
    font-size: 1.55rem;
  }

  .header-left,
  .header-right {
    min-width: 110px;
  }

  .auth-panel {
    width: min(100vw, 430px);
    min-width: 0;
  }

  .scene-box {
    min-height: min(72vh, 560px);
  }

  .frontguy {
    width: clamp(110px, 26vw, 170px);
    right: 4%;
    bottom: 10%;
  }

  .castle {
    width: clamp(180px, 46vw, 290px);
    left: 2%;
    bottom: 7%;
  }

  .start-cta-wrap {
    bottom: 24%;
  }
}
