:root {
  color-scheme: dark;
  font-family: "Pretendard", "Segoe UI", sans-serif;
  --bg: #06070b;
  --text: #f7ebc3;
  --panel: rgba(6, 11, 20, 0.8);
  --border: rgba(247, 235, 195, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  background-image: url('../assets/images/background.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto;
  background-attachment: fixed;
}

.intro-page {
  background-position: var(--scene-left, center) var(--scene-top, top);
  background-size: var(--scene-width, auto) var(--scene-height, auto);
}

.intro-shell {
  width: min(92vw, 420px);
  text-align: center;
  padding: 2rem;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: 2.4rem;
}

.intro-subtitle {
  margin: 0 0 1.25rem;
  opacity: 0.8;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.auth-message {
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
  min-height: 1.2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.auth-form[hidden] {
  display: none;
}

.auth-form > div {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.auth-form label {
  font-size: 0.95rem;
}

.auth-form input {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.auth-form input.is-valid {
  border-color: #58d68d;
  background: rgba(43, 145, 87, 0.14);
  box-shadow: 0 0 0 3px rgba(88, 214, 141, 0.14);
}

.auth-form input.is-invalid {
  border-color: #ff6b6b;
  background: rgba(180, 45, 45, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.14);
}

.auth-field-feedback {
  min-height: 1.15em;
  margin-top: -0.28rem;
  color: rgba(247, 235, 195, 0.72);
  font-size: 0.78rem;
}

.auth-field-feedback.is-valid {
  color: #75e6a6;
}

.auth-field-feedback.is-invalid {
  color: #ff8a8a;
}

.auth-hint,
.auth-verification-copy {
  margin: 0;
  color: rgba(247, 235, 195, 0.72);
  font-size: 0.78rem;
  line-height: 1.5;
}

.auth-verification-copy strong {
  color: #ffd978;
}

.cf-turnstile {
  min-height: 65px;
  margin-top: 0.35rem;
}

.auth-form .auth-secondary-btn {
  border: 1px solid rgba(255, 217, 120, 0.55);
  background: rgba(6, 20, 55, 0.72);
  color: #ffd978;
}

.auth-form .auth-small-btn {
  align-self: center;
  width: auto;
  margin-top: 0.15rem;
  padding: 0.42rem 0.85rem;
  font-size: 0.78rem;
}

.auth-form button {
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 999px;
  background: #ffcf4d;
  color: #121212;
  font-weight: 700;
  cursor: pointer;
}

.auth-links {
  margin-top: 0.8rem;
}

.auth-links a {
  color: #ffd978;
  text-decoration: none;
  font-size: 0.95rem;
}

.auth-pending-verification {
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(112, 223, 255, 0.48);
  background: rgba(7, 37, 82, 0.58);
}

.auth-pending-verification a { color: #9fe8ff; }

.start-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: #ffcf4d;
  color: #121212;
  text-decoration: none;
  font-weight: 700;
}

.intro-page .intro-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 0;
}

.world-story {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(90vw, 780px);
  min-height: 330px;
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255, 230, 139, 0.5);
  border-bottom: 1px solid rgba(255, 230, 139, 0.5);
  background: linear-gradient(90deg, transparent, rgba(2, 13, 42, 0.82) 16%, rgba(2, 13, 42, 0.82) 84%, transparent);
  text-align: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.world-story-lines {
  display: grid;
  gap: 0.38rem;
  width: 100%;
}

.world-story-line {
  margin: 0;
  color: #fff1b2;
  font-family: "Courier New", monospace;
  font-size: clamp(1.05rem, 2.6vw, 1.65rem);
  font-weight: 800;
  line-height: 1.6;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(8px);
  text-shadow: 2px 2px 0 #102657, 0 0 14px rgba(255, 225, 105, 0.42);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.world-story-line.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.world-story-skip {
  position: absolute;
  right: 1.5rem;
  bottom: 0.45rem;
  margin: 0;
  color: rgba(216, 235, 255, 0.58);
  font-size: 0.68rem;
}

.world-story.world-story-complete {
  cursor: default;
}

.world-story.world-story-complete .world-story-skip {
  display: none;
}

.intro-page .start-link {
  position: fixed;
  left: 50%;
  bottom: clamp(1.5rem, 5vh, 3.5rem);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 240px;
  margin: 0;
  padding: 0.95rem 1.4rem;
  border: 3px solid #fff0a6;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 2px, transparent 2px 4px),
    linear-gradient(180deg, #ffd94f, #f5a623);
  color: #33190a;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-shadow: 1px 1px 0 rgba(255,255,255,.45);
  box-shadow:
    0 6px 0 #9b4c15,
    0 10px 0 rgba(5, 18, 55, .78),
    0 16px 30px rgba(2, 13, 43, .4),
    inset 0 0 0 2px rgba(141, 62, 8, .26);
  transform: translateX(-50%);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease, opacity .45s ease;
}

.intro-page .start-link.is-ready {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.intro-page .start-link::before,
.intro-page .start-link::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  background: #4d250c;
}

.intro-page .start-link::before {
  top: 5px;
  left: 5px;
}

.intro-page .start-link::after {
  right: 5px;
  bottom: 5px;
}

.intro-page .start-link:hover {
  filter: brightness(1.12) saturate(1.1);
  transform: translate(-50%, -2px);
  box-shadow:
    0 8px 0 #9b4c15,
    0 12px 0 rgba(5, 18, 55, .78),
    0 20px 34px rgba(2, 13, 43, .45),
    inset 0 0 0 2px rgba(141, 62, 8, .26);
}

.intro-page .start-link:active {
  transform: translate(-50%, 5px);
  box-shadow:
    0 1px 0 #9b4c15,
    0 4px 0 rgba(5, 18, 55, .78),
    inset 0 0 0 2px rgba(141, 62, 8, .26);
}

.start-link-icon {
  color: #b74912;
  font-size: 0.82rem;
  animation: start-arrow-blink 1s steps(2) infinite;
}

@keyframes start-arrow-blink {
  50% { opacity: .28; }
}

@media (max-width: 600px) {
  .intro-page .intro-shell {
    padding: 0;
  }

  .intro-page .start-link {
    min-width: min(240px, 82vw);
  }
}

.login-page .login-card {
  border: 2px solid rgba(255, 224, 101, .68);
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 3px, transparent 3px 5px),
    rgba(6, 20, 55, .82);
  box-shadow:
    0 7px 0 rgba(7, 28, 69, .85),
    0 14px 35px rgba(0, 8, 35, .42),
    inset 0 0 0 2px rgba(255, 240, 166, .08);
}

.login-page .retro-login-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  width: 100%;
  margin-top: .65rem;
  padding: .88rem 1.2rem;
  border: 3px solid #fff0a6;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 2px, transparent 2px 4px),
    linear-gradient(180deg, #ffd94f, #f5a623);
  color: #33190a;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -.04em;
  text-shadow: 1px 1px 0 rgba(255,255,255,.45);
  box-shadow:
    0 5px 0 #9b4c15,
    0 8px 0 rgba(5, 18, 55, .76),
    inset 0 0 0 2px rgba(141, 62, 8, .26);
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}

.login-page .retro-login-btn::before,
.login-page .retro-login-btn::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: #4d250c;
}

.login-page .retro-login-btn::before {
  top: 4px;
  left: 4px;
}

.login-page .retro-login-btn::after {
  right: 4px;
  bottom: 4px;
}

.login-page .retro-login-btn:hover {
  filter: brightness(1.12) saturate(1.1);
  transform: translateY(-2px);
  box-shadow:
    0 7px 0 #9b4c15,
    0 10px 0 rgba(5, 18, 55, .76),
    inset 0 0 0 2px rgba(141, 62, 8, .26);
}

.login-page .retro-login-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #9b4c15,
    0 3px 0 rgba(5, 18, 55, .76),
    inset 0 0 0 2px rgba(141, 62, 8, .26);
}

.login-page .guest-login-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

html:has(body.login-page) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

body.login-page {
  display: block;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: visible;
  touch-action: pan-y;
}

.login-page .intro-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

@media (max-width: 600px) {
  .login-page .intro-shell {
    width: min(calc(100% - 1rem), 420px);
    padding-right: 0;
    padding-left: 0;
  }

  .login-page .login-card { padding: 1rem; }
}

.retro-login-icon {
  color: #b74912;
  font-size: .8rem;
  animation: start-arrow-blink 1s steps(2) infinite;
}

.login-transition {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,.15), rgba(61,145,255,.08) 22%, rgba(2,9,32,.18) 50%, transparent 70%);
}

.light-core,
.light-ring,
.warp-lines {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
}

.light-core {
  width: 8rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 35px 18px #fff,
    0 0 90px 45px rgba(117, 203, 255, .9),
    0 0 180px 85px rgba(255, 224, 109, .55);
}

.light-ring {
  width: 9rem;
  aspect-ratio: 1;
  border: 3px solid rgba(220, 247, 255, .9);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(97, 196, 255, .8), inset 0 0 18px rgba(255,255,255,.75);
}

.warp-lines {
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.88) 0 1deg, transparent 1deg 12deg);
  mask-image: radial-gradient(circle, transparent 0 18%, #000 58%, transparent 76%);
  opacity: .8;
}

.login-page.login-transitioning {
  overflow: hidden;
}

.login-page.login-transitioning .login-transition {
  visibility: visible;
  animation: transition-veil 1.08s ease-in forwards;
}

.login-page.login-transitioning .intro-shell {
  animation: login-sucked-in .9s cubic-bezier(.72, .02, .93, .55) forwards;
  transform-origin: center center;
  pointer-events: none;
}

.login-page.login-transitioning .light-core {
  animation: portal-core 1.08s cubic-bezier(.4, 0, .8, 1) forwards;
}

.login-page.login-transitioning .ring-one {
  animation: portal-ring .72s .03s ease-in forwards;
}

.login-page.login-transitioning .ring-two {
  animation: portal-ring .72s .16s ease-in forwards;
}

.login-page.login-transitioning .ring-three {
  animation: portal-ring .72s .29s ease-in forwards;
}

.login-page.login-transitioning .warp-lines {
  animation: warp-spin .88s ease-in forwards;
}

@keyframes login-sucked-in {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0);
    filter: blur(0) brightness(1);
  }
  58% {
    opacity: .92;
    transform: scale(.42) rotate(-4deg);
    filter: blur(1px) brightness(1.35);
  }
  100% {
    opacity: 0;
    transform: scale(.015) rotate(-18deg);
    filter: blur(8px) brightness(4);
  }
}

@keyframes transition-veil {
  0% { opacity: 0; }
  28% { opacity: .35; }
  76% { opacity: .82; }
  100% { opacity: 1; background-color: #fff; }
}

@keyframes portal-core {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.03); }
  38% { opacity: 1; transform: translate(-50%, -50%) scale(.2); }
  72% { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-50%, -50%) scale(13); }
}

@keyframes portal-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.08); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(8); }
}

@keyframes warp-spin {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.1) rotate(0); }
  35% { opacity: .9; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(9) rotate(145deg); }
}

@media (prefers-reduced-motion: reduce) {
  .login-page.login-transitioning .intro-shell {
    animation: login-fade-out .25s ease forwards;
  }

  .login-page.login-transitioning .login-transition {
    animation: transition-veil .25s ease forwards;
  }

  .login-page.login-transitioning .light-core,
  .login-page.login-transitioning .light-ring,
  .login-page.login-transitioning .warp-lines {
    animation: none;
  }
}

@keyframes login-fade-out {
  to { opacity: 0; }
}

.main-shell {
  width: min(96vw, 1100px);
  padding: 2rem;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(6px);
}

.eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.75;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 207, 77, 0.18);
  color: #ffd978;
  font-weight: 700;
}

.logout-btn {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.hub-section {
  margin-bottom: 0.75rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(255, 207, 77, 0.35);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.22), rgba(255, 207, 77, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hub-caption {
  margin: 0 0 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 207, 77, 0.18);
  color: #ffe8a8;
  border: 1px solid rgba(255, 207, 77, 0.28);
}

.hub-menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hub-menu-chip {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(6, 11, 20, 0.55);
  border: 1px solid rgba(255, 207, 77, 0.28);
  color: #fff2c4;
  font-size: 0.9rem;
}

.menu-list {
  display: grid;
  gap: 0.6rem;
}

.menu-card {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(6px);
}

.menu-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.menu-thumb {
  flex: 0 0 90px;
  height: 58px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-size: 300% 200%;
  background-position: top left;
  background-repeat: no-repeat;
  background-color: rgba(255, 255, 255, 0.08);
}

.menu-body {
  flex: 1;
  min-width: 0;
}

.menu-card h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.menu-title-icon {
  font-size: 1rem;
}

.menu-card ul {
  margin: 0;
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  list-style: none;
}

.menu-card li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  opacity: 0.92;
  font-size: 0.9rem;
}

.menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  font-size: 0.95rem;
}

.game-link {
  color: var(--text);
  text-decoration: none;
}

.game-link:hover {
  color: #ffd978;
  text-decoration: underline;
}

.game-info {
  display: flex;
  min-width: 4.5rem;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.15;
}

.game-score {
  display: block;
  margin: 0;
  color: #ffd978;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.menu-thumb {
  width: 100%;
  height: 88px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-size: 300% 200%;
  background-position: top left;
  background-repeat: no-repeat;
  background-color: rgba(255, 255, 255, 0.08);
}

.thumb-castle {
  background-image: linear-gradient(135deg, rgba(255, 207, 77, 0.3), rgba(255, 255, 255, 0.05)), url('../assets/images/castle.png');
}

.thumb-arcade {
  background-image: linear-gradient(135deg, rgba(255, 122, 122, 0.28), rgba(255, 255, 255, 0.05)), url('../assets/images/nostalgic_arcade.png');
}

.thumb-library {
  background-image: linear-gradient(135deg, rgba(122, 169, 255, 0.28), rgba(255, 255, 255, 0.05)), url('../assets/images/forgotten_library.png');
}

.thumb-sky {
  background-image: linear-gradient(135deg, rgba(113, 220, 255, 0.28), rgba(255, 255, 255, 0.05)), url('../assets/images/sky_fortress.png');
}

.thumb-workshop {
  background-image: linear-gradient(135deg, rgba(185, 132, 255, 0.28), rgba(255, 255, 255, 0.05)), url('../assets/images/lost_workshop.png');
}

.thumb-forest {
  background-image: linear-gradient(135deg, rgba(85, 205, 120, 0.28), rgba(255, 255, 255, 0.05)), url('../assets/images/memory_forest.png');
}

/* Main hub: bright 90s pixel-adventure theme */
body.main-page {
  --main-ink: #fff6cf;
  --main-gold: #ffd34e;
  --main-blue: #1d65c1;
  --main-deep-blue: rgba(4, 23, 63, 0.7);
  --main-background-image: url('../assets/images/main_background_0.png');
  position: relative;
  display: block;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #143e87;
  background-image:
    linear-gradient(180deg, rgba(4, 20, 64, 0.08) 0%, rgba(4, 20, 64, 0.02) 42%, rgba(1, 16, 37, 0.28) 100%),
    var(--main-background-image);
  background-position: center, var(--scene-left, center) var(--scene-top, top);
  background-repeat: no-repeat;
  background-size: cover, var(--scene-width, auto) var(--scene-height, auto);
  background-attachment: fixed;
}

body.main-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.025) 3px 4px),
    linear-gradient(90deg, rgba(4, 25, 74, 0.12), transparent 18%, transparent 82%, rgba(4, 25, 74, 0.12));
}

.main-page [hidden] {
  display: none !important;
}

.main-page .main-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(96vw, 1120px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(1rem, 2.5vh, 2rem);
  overflow: hidden;
}

.main-job-avatar {
  background-image: url('../assets/images/job.png?v=20260730-2');
  background-repeat: no-repeat;
  background-size: 500% 200%;
  image-rendering: pixelated;
}

.hub-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.hub-summary .hub-caption {
  margin: 0;
}

.main-identity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(255, 223, 96, 0.65);
  background: rgba(4, 34, 85, 0.68);
}

.main-identity > span {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.main-identity > .hub-progress {
  grid-column: 1 / -1;
}

.main-identity small {
  color: #70dfff;
  font-size: 0.52rem;
}

.main-identity strong {
  overflow: hidden;
  max-width: 180px;
  color: #fff0a0;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-progress-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hub-progress-controls button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(142, 215, 255, 0.72);
  border-radius: 2px;
  background: rgba(12, 61, 135, 0.88);
  color: #fff0a0;
  font-weight: 900;
  cursor: pointer;
}

.hub-progress-controls button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.job-sprite-column-0 { background-position-x: 0%; }
.job-sprite-column-1 { background-position-x: 25%; }
.job-sprite-column-2 { background-position-x: 50%; }
.job-sprite-column-3 { background-position-x: 75%; }
.job-sprite-column-4 { background-position-x: 100%; }

.main-job-avatar {
  position: fixed;
  left: var(--scene-anchor-x, 50%);
  top: var(--scene-anchor-y, 560px);
  z-index: 1;
  width: calc(300px * var(--scene-scale, 1));
  height: calc(500px * var(--scene-scale, 1));
  background-position-y: 100%;
  pointer-events: none;
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 18px rgba(2, 13, 38, 0.5));
}

.job-creation {
  min-height: 0;
  overflow-y: auto;
  padding: clamp(0.5rem, 4vh, 2.5rem) 0.5rem 1rem;
}

body.job-page {
  --main-gold: #ffd34e;
  min-height: 100vh;
  overflow: auto;
  background-color: #143e87;
  background-image: url('../assets/images/background.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto;
  background-attachment: fixed;
}

.job-page-shell {
  width: min(96vw, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(1rem, 5vh, 3rem) 0;
}

.job-creation-panel {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 2px solid var(--main-gold);
  border-radius: 4px;
  background: rgba(5, 35, 88, 0.82);
  box-shadow: 0 7px 0 rgba(2, 20, 58, 0.78), 0 18px 38px rgba(1, 12, 38, 0.38);
  text-align: center;
  backdrop-filter: blur(5px);
}

.job-creation-panel h1,
.job-creation-panel h2 {
  margin: 0.25rem 0 0.5rem;
  color: #fff3b2;
  font-family: "Courier New", monospace;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  text-shadow: 3px 3px 0 #132e6f;
}

.job-creation-copy,
.job-creation-message {
  color: #e8f5ff;
}

.job-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.2rem 0;
}

.job-option {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  min-height: 260px;
  padding: 0.55rem 0.45rem 0.8rem;
  border: 2px solid rgba(151, 211, 255, 0.62);
  border-radius: 3px;
  background: rgba(8, 51, 118, 0.76);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.job-option:hover {
  transform: translateY(-3px);
  border-color: #ffe46e;
}

.job-option:has(input:checked) {
  border-color: var(--main-gold);
  background: rgba(28, 91, 176, 0.9);
  box-shadow: inset 0 0 0 2px rgba(255, 239, 145, 0.25);
}

.job-option input {
  position: absolute;
  opacity: 0;
}

.job-character {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 5;
  border: 1px solid rgba(255, 235, 147, 0.45);
  background-image: url('../assets/images/job.png?v=20260730-2');
  background-repeat: no-repeat;
  background-size: 500% 200%;
  background-position-y: 0%;
  image-rendering: pixelated;
}

.job-character-0 { background-position-x: 0%; }
.job-character-1 { background-position-x: 25%; }
.job-character-2 { background-position-x: 50%; }
.job-character-3 { background-position-x: 75%; }
.job-character-4 { background-position-x: 100%; }

.job-option:has(input:checked) .job-character {
  border-color: var(--main-gold);
}

.job-option strong {
  color: #fff2a8;
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
}

.job-option small {
  color: #d7edff;
  line-height: 1.45;
}

.job-details {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 1.15fr);
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(151, 211, 255, 0.55);
  background: rgba(3, 27, 72, 0.78);
  text-align: left;
  opacity: 0.72;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.job-details.is-visible {
  border-color: var(--main-gold);
  opacity: 1;
}

.job-details-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.25rem 0.5rem;
}

.job-details-region {
  color: #7edcff;
  font-size: 0.76rem;
}

.job-details-name {
  margin: 0.35rem 0;
  color: #fff0a0;
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.job-details-description {
  margin: 0;
  color: #e7f4ff;
  font-size: 0.82rem;
  line-height: 1.6;
}

.job-traits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.job-trait-panel {
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(4, 39, 94, 0.6);
}

.job-trait-panel h3 {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
}

.job-advantages h3,
.job-advantages li::marker {
  color: #70efa2;
}

.job-disadvantages h3,
.job-disadvantages li::marker {
  color: #ff8585;
}

.job-trait-panel ul {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.2rem;
}

.job-trait-panel li {
  color: #eaf6ff;
  font-size: 0.74rem;
  line-height: 1.45;
}

.job-creation-message {
  min-height: 1.3em;
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
}

.job-create-btn {
  margin: 0 auto;
}

.job-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.main-page .main-header {
  position: relative;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  width: min(100%, 1024px);
  margin-bottom: 0;
  padding: 0.85rem 1.15rem;
  border: 2px solid var(--main-gold);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(18, 68, 147, 0.82), rgba(8, 39, 98, 0.62)),
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255,255,255,.03) 12px 13px);
  box-shadow:
    0 5px 0 rgba(5, 29, 78, 0.75),
    0 12px 28px rgba(2, 16, 46, 0.3),
    inset 0 0 0 2px rgba(255, 242, 166, 0.15);
  backdrop-filter: blur(3px) saturate(1.2);
}

.main-heading {
  min-width: 0;
}

.main-heading-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.main-heading-bar .sound-toggle-btn {
  flex: 0 0 auto;
}

.main-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
  white-space: nowrap;
}

.main-title-divider {
  color: var(--main-gold);
  font: 900 1.15rem "Courier New", monospace;
  text-shadow: 2px 2px 0 #16336c;
}

.main-page .main-header::before,
.main-page .main-header::after {
  content: "◆";
  position: absolute;
  top: 50%;
  color: var(--main-gold);
  font-size: 0.55rem;
  transform: translateY(-50%);
}

.main-page .main-header::before { left: -5px; }
.main-page .main-header::after { right: -5px; }

.main-page .eyebrow {
  margin: 0;
  color: var(--main-gold);
  font-family: "Courier New", monospace;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  opacity: 1;
  text-shadow: 2px 2px 0 #16336c;
}

.main-page .main-header h1 {
  margin: 0;
  color: #fff7ce;
  font-family: "Courier New", monospace;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  text-shadow: 3px 3px 0 #102968, 0 0 14px rgba(255, 220, 89, 0.28);
}

.main-tagline {
  margin: 0.16rem 0 0;
  color: #acd9ff;
  font: 700 0.48rem "Courier New", monospace;
  letter-spacing: 0.16em;
}

.main-page .user-area {
  width: 100%;
  justify-content: space-between;
  gap: 0.55rem;
}

.main-page .main-identity {
  flex: 1 1 auto;
  min-width: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.main-page .main-identity > .hub-progress { grid-column: auto; }

.main-page .user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.main-page .sound-toggle-btn[aria-pressed="false"] {
  opacity: 0.72;
}

.inquiry-header-btn { position: relative; display: inline-flex; align-items: center; gap: 0.3rem; }
.inquiry-unread-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #ffcf4f;
  color: #4a2400;
  font-size: 0.65rem;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(4, 34, 85, 0.85);
}
.inquiry-unread-badge[hidden] { display: none; }

.inquiry-modal {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(1, 10, 32, 0.78);
}

.inquiry-modal[hidden] { display: none; }

.game-unresponsive-notice {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 1.5rem;
  display: grid;
  gap: 0.55rem;
  width: min(92%, 520px);
  padding: 0.9rem;
  border: 2px solid #ffcf64;
  background: rgba(48, 13, 30, 0.96);
  color: #fff;
  transform: translateX(-50%);
}
.game-unresponsive-notice[hidden] { display: none; }
.game-unresponsive-notice div { display: flex; gap: 0.5rem; }
.game-unresponsive-notice button { padding: 0.5rem 0.7rem; }

.inquiry-panel {
  width: min(720px, 100%);
  max-height: min(820px, calc(100dvh - 2rem));
  overflow-y: auto;
  padding: 1rem;
  border: 2px solid var(--main-gold);
  background: rgba(5, 32, 82, 0.97);
  box-shadow: 0 8px 0 rgba(2, 18, 52, 0.8);
}

.inquiry-header,
.inquiry-toolbar,
.admin-inquiry-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.inquiry-header h2 { margin: 0.2rem 0; color: #fff5bf; }
.inquiry-toolbar { justify-content: flex-start; margin: 0.75rem 0; }
.inquiry-detail-actions { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.inquiry-detail-actions button { padding: 0.45rem 0.6rem; border: 1px solid #70dfff; background: #123b7a; color: #fff; }
.inquiry-detail-actions .danger { border-color: #ff8d8d; background: #6c2440; }
.inquiry-toolbar button,
.inquiry-form button,
.admin-inquiry-actions button {
  padding: 0.55rem 0.75rem;
  border: 1px solid #ffe46e;
  background: #1260ad;
  color: #fff;
  cursor: pointer;
}

.inquiry-status { min-height: 1.4em; color: #acd9ff; }
.inquiry-status.is-error { color: #ff9e9e; }
.inquiry-list { display: grid; gap: 0.5rem; }
.inquiry-list-item {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(142, 215, 255, 0.65);
  background: rgba(2, 22, 60, 0.72);
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.inquiry-list-item span,
.inquiry-detail-meta { color: #acd9ff; font-size: 0.78rem; }
.inquiry-new { color: #ffe46e; font-style: normal; }
.inquiry-detail h3 { color: #fff5bf; }
.inquiry-thread { display: grid; gap: 0.65rem; margin: 1rem 0; }
.inquiry-message {
  width: min(88%, 560px);
  padding: 0.75rem;
  border-left: 3px solid #70dfff;
  background: rgba(2, 22, 60, 0.78);
}
.inquiry-message.is-admin { justify-self: end; border-color: #ffe46e; background: rgba(49, 52, 91, 0.85); }
.inquiry-message p { margin: 0.45rem 0; color: #eef8ff; white-space: pre-wrap; overflow-wrap: anywhere; }
.inquiry-message time { color: #9fc6eb; font-size: 0.7rem; }
.inquiry-form { display: grid; gap: 0.75rem; }
.inquiry-form label { display: grid; gap: 0.35rem; color: #d9ecff; }
.inquiry-form input,
.inquiry-form select,
.inquiry-form textarea,
.admin-inquiry-actions select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid rgba(142, 215, 255, 0.7);
  background: #071f4b;
  color: #fff;
  font: inherit;
}
.inquiry-form textarea { resize: vertical; }
.inquiry-diagnostics-choice,
.inquiry-diagnostics-summary {
  padding: 0.7rem;
  border: 1px solid rgba(112, 223, 255, 0.65);
  background: rgba(2, 22, 60, 0.62);
  color: #d9ecff;
}
.inquiry-diagnostics-choice p { margin: 0.4rem 0; color: #acd9ff; }
.inquiry-diagnostics-choice label { display: flex; grid-template-columns: none; align-items: center; }
.inquiry-diagnostics-choice input { width: auto; }

.main-page .user-badge,
.main-page .logout-btn {
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-weight: 900;
}

.main-page .user-badge {
  border: 1px solid rgba(255, 227, 105, 0.75);
  background: rgba(255, 205, 49, 0.18);
  color: #fff0a5;
  box-shadow: inset 0 -2px 0 rgba(128, 78, 5, 0.32);
}

.main-page .logout-btn {
  border: 1px solid rgba(184, 221, 255, 0.72);
  background: rgba(12, 53, 119, 0.65);
  color: #e8f6ff;
  box-shadow: 0 3px 0 rgba(2, 21, 61, 0.75);
  transition: transform 0.15s ease, background 0.15s ease;
}

.main-page .logout-btn:hover {
  background: rgba(29, 101, 193, 0.9);
  transform: translateY(-1px);
}

.main-page .hub-section {
  margin-bottom: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 2px solid rgba(255, 219, 82, 0.9);
  border-radius: 4px;
  background: rgba(20, 73, 142, 0.58);
  box-shadow: 0 4px 0 rgba(3, 28, 72, 0.6), inset 0 0 18px rgba(110, 192, 255, 0.12);
  backdrop-filter: blur(2px) saturate(1.2);
}

.main-page .hub-caption {
  margin-bottom: 0.45rem;
  padding: 0.43rem 0.65rem;
  border: 1px dashed rgba(255, 231, 139, 0.85);
  border-radius: 2px;
  background: rgba(255, 193, 38, 0.19);
  color: #fff6cb;
  font-weight: 700;
  text-shadow: 1px 1px 0 #173871;
}

.main-page .hub-menu-chip {
  cursor: pointer;
  padding: 0.3rem 0.58rem;
  border: 1px solid rgba(143, 211, 255, 0.72);
  border-radius: 3px;
  background: rgba(10, 47, 110, 0.62);
  color: #effaff;
  box-shadow: inset 0 -2px 0 rgba(4, 22, 63, 0.42);
  font-size: 0.82rem;
}

.main-page .hub-menu-chip.is-disabled {
  border-color: #4b5059;
  background: #292d33;
  color: #858b94;
  box-shadow: inset 0 -2px 0 #181a1e;
  cursor: default;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(1, 8, 28, 0.78);
  backdrop-filter: blur(5px);
}

.settings-panel {
  width: min(92vw, 720px);
  max-height: min(88vh, 780px);
  overflow-y: auto;
  padding: 1.25rem;
  border: 2px solid var(--main-gold);
  background: rgba(4, 30, 78, 0.96);
  box-shadow: 0 8px 0 rgba(1, 15, 48, 0.88), 0 20px 45px rgba(0, 0, 0, 0.5);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 225, 101, 0.5);
}

.settings-header h2 {
  margin: 0;
  color: #fff0a0;
}

.settings-close-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #8ed7ff;
  background: rgba(12, 61, 135, 0.8);
  color: #fff;
  cursor: pointer;
}

.settings-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.settings-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(151, 211, 255, 0.45);
  background: rgba(8, 49, 112, 0.62);
}

.settings-item h3 {
  margin: 0 0 0.3rem;
  color: #fff0a0;
  font-size: 0.92rem;
}

.settings-item p {
  margin: 0;
  color: #d9edff;
  font-size: 0.7rem;
}

.settings-action {
  padding: 0.65rem 0.8rem;
  border: 1px solid #8ed7ff;
  background: #164f9d;
  color: #fff;
  cursor: pointer;
}

.settings-action:disabled {
  border-color: rgba(142, 215, 255, 0.35);
  background: rgba(60, 83, 120, 0.7);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}

.settings-action.danger {
  border-color: #ff9a9a;
  background: #92334a;
}

.password-settings {
  grid-template-columns: 1fr;
}

.password-change-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.5rem;
}

.password-change-form input {
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(151, 211, 255, 0.55);
  background: rgba(2, 22, 61, 0.85);
  color: #fff;
}

.settings-message {
  min-height: 1.3em;
  margin: 0.9rem 0 0;
  color: #7cf2a6;
  text-align: center;
  font-size: 0.74rem;
}

.settings-message.is-error {
  color: #ff9494;
}

.achievements-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1rem; background: rgba(1,8,28,.78); backdrop-filter: blur(5px); }
.achievements-panel { width: min(92vw,760px); max-height: min(88vh,780px); overflow: hidden; padding: 1.25rem; border: 2px solid var(--main-gold); background: rgba(4,30,78,.96); box-shadow: 0 8px 0 rgba(1,15,48,.88),0 20px 45px rgba(0,0,0,.5); }
.achievements-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: .8rem; border-bottom: 1px solid rgba(255,225,101,.5); }
.achievements-header h2 { margin: 0; color: #fff0a0; }
.achievements-close-btn { width: 40px; height: 40px; border: 1px solid #8ed7ff; background: rgba(12,61,135,.8); color: #fff; cursor: pointer; }
.achievements-table-wrap { max-height: min(65vh,590px); margin-top: 1rem; overflow: auto; }
.achievements-table { width: 100%; border-collapse: collapse; color: #effaff; font-size: .78rem; }
.achievements-table th,.achievements-table td { padding: .72rem .65rem; border-bottom: 1px solid rgba(151,211,255,.35); text-align: right; white-space: nowrap; }
.achievements-table th { position: sticky; top: 0; background: #082e70; color: #fff0a0; }
.achievements-table th:first-child,.achievements-table td:first-child { width: 42%; text-align: left; }
.achievements-table tbody tr { background: rgba(8,49,112,.48); }
.achievements-table tbody tr:nth-child(even) { background: rgba(12,61,135,.48); }
.achievements-game-name { color: #fff0a0; font-weight: 800; }
.achievements-game-version { margin-left: .35rem; color: #9fc7dc; font-size: .72em; }
.achievements-empty { margin: 2rem 0; color: #d9edff; text-align: center; }
.ranking-panel { overflow-y: auto; }
.ranking-controls { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem; margin-top: 1rem; }
.ranking-controls select { min-width: 11rem; padding: .58rem .72rem; border: 1px solid #8ed7ff; background: rgba(8,49,112,.82); color: #effaff; font: 700 .72rem "Courier New",monospace; }
.ranking-controls label { display: grid; gap: .28rem; color: #9fc7dc; font-size: .68rem; }
.ranking-list-title { margin: 1rem 0 0; color: #fff0a0; font-size: .9rem; }
.ranking-table th:first-child,.ranking-table td:first-child { width: auto; text-align: center; }
.ranking-table th:nth-child(2),.ranking-table td:nth-child(2) { text-align: left; }
.ranking-table tbody tr:first-child td { color: #ffe46e; font-weight: 900; }
.adventure-panel { overflow-y: auto; }
.adventure-status { margin: 1.4rem 0; color: #d9edff; text-align: center; }
.adventure-status.is-error { color: #ff9494; }
.adventure-profile { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin: 1rem 0 0; }
.adventure-profile-row { min-width: 0; padding: .75rem; border: 1px solid rgba(151,211,255,.35); background: rgba(8,49,112,.52); }
.adventure-profile dt { margin-bottom: .28rem; color: #9fc7dc; font-size: .66rem; }
.adventure-profile dd { margin: 0; overflow-wrap: anywhere; color: #fff0a0; font-size: .82rem; font-weight: 800; }
@media (max-width:600px) { .achievements-panel { padding: .85rem; } .achievements-table { font-size: .65rem; } .achievements-table th,.achievements-table td { padding: .62rem .35rem; } }
@media (max-width:600px) { .ranking-controls { display: grid; } .ranking-controls select { width: 100%; } }
@media (max-width:600px) { .adventure-profile { grid-template-columns: 1fr; } }

.main-page .menu-list {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 0.52rem;
  min-height: 0;
  padding: 0.1rem 0.55rem 0.55rem 0;
  overflow-x: auto;
  overflow-x: auto;
  overflow-y: auto;
  align-content: start;
  overscroll-behavior: contain;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--main-gold) rgba(6, 33, 82, .62);
  scrollbar-width: thin;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.main-page .menu-list::-webkit-scrollbar {
  width: 10px;
}

.main-page .menu-list::-webkit-scrollbar-track {
  border: 1px solid rgba(147, 207, 255, .3);
  background: rgba(6, 33, 82, .62);
}

.main-page .menu-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(6, 33, 82, .75);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.24) 0 2px, transparent 2px 4px),
    var(--main-gold);
}

.main-page .menu-list::-webkit-scrollbar-thumb:hover {
  background-color: #ffe884;
}

.main-page .menu-card {
  --card-accent: #ffcb48;
  position: relative;
  padding: 0.55rem 0.68rem;
  border: 1px solid rgba(216, 237, 255, 0.72);
  border-left: 5px solid var(--card-accent);
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(8, 38, 93, 0.78), rgba(12, 56, 119, 0.6)),
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(255,255,255,.025) 15px 16px);
  box-shadow: 0 4px 0 rgba(2, 24, 65, 0.62), 0 7px 20px rgba(1, 18, 51, 0.16);
  backdrop-filter: blur(2px) saturate(1.15);
  transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

.main-page .menu-card:hover {
  z-index: 2;
  transform: translateX(4px);
  border-color: #fff0a4;
  filter: brightness(1.1);
}

.main-page .card-arcade { --card-accent: #ff6f73; }
.main-page .card-library { --card-accent: #82b8ff; }
.main-page .card-sky { --card-accent: #5ce4ff; }
.main-page .card-workshop { --card-accent: #ce8cff; }
.main-page .card-forest { --card-accent: #69e587; }

.main-page .menu-row {
  display: block;
}

.main-page .menu-thumb {
  flex: 0 0 94px;
  width: 94px;
  height: 60px;
  border: 2px solid rgba(255, 241, 176, 0.78);
  border-radius: 2px;
  background-position: center;
  background-size: cover;
  image-rendering: pixelated;
  box-shadow: 3px 3px 0 rgba(1, 21, 57, 0.7);
}

.main-page .menu-card h2 {
  margin-bottom: 0.27rem;
  color: #fff5bf;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 2px 2px 0 #10285d;
}

.main-page .menu-title-icon {
  filter: drop-shadow(2px 2px 0 #10285d);
}

.main-page .menu-card ul {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.26rem 0.48rem;
}

.main-page .menu-card li {
  width: 100%;
  padding: 0.13rem 0.25rem;
  border-left: 1px solid rgba(188, 225, 255, 0.3);
  background: rgba(4, 34, 85, 0.22);
  color: #eff8ff;
  opacity: 1;
}

.main-page .menu-item-icon {
  filter: drop-shadow(1px 1px 0 #071b4b);
}

.main-page .game-link {
  color: #fff6c8;
  font-weight: 800;
}

.main-page .game-link:hover {
  color: #fff17a;
  text-decoration: none;
  text-shadow: 0 0 8px rgba(255, 231, 92, 0.75);
}

.main-page .game-score {
  color: var(--card-accent);
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  text-shadow: 1px 1px 0 #081c49;
}

@media (max-width: 700px) {
  body.main-page {
    background-position: center, var(--scene-left, center) var(--scene-top, top);
    background-size: cover, var(--scene-width, auto) var(--scene-height, auto);
  }

  .main-page .main-shell {
    width: min(100% - 16px, 600px);
    height: 100vh;
    height: 100dvh;
    padding: 0.75rem 0 0.6rem;
  }

  .main-page .menu-list {
    grid-template-columns: repeat(5, minmax(78vw, 1fr));
    grid-auto-flow: column;
    grid-auto-columns: minmax(78vw, 1fr);
    gap: 0.65rem;
    padding-right: 11vw;
    overflow-x: scroll;
    overflow-y: auto;
    scroll-padding-inline: 0.55rem;
    scroll-snap-type: x mandatory;
    touch-action: pan-x pan-y;
  }

  .main-page .menu-card {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .hub-summary {
    grid-template-columns: 1fr;
  }

  .main-identity {
    justify-content: space-between;
  }

  .job-options {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .job-option {
    min-height: 240px;
  }

  .job-details {
    grid-template-columns: 1fr;
  }

  .job-traits {
    grid-template-columns: 1fr;
  }

  .main-page .main-header {
    gap: 0.45rem;
    padding: 0.58rem 0.68rem;
  }

  .main-tagline {
    display: none;
  }

  .main-page .user-area {
    align-items: center;
    gap: 0.35rem;
  }

  .main-page .user-actions {
    flex-direction: row;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.28rem;
  }

  .main-page .main-heading-bar { gap: 0.4rem; }
  .main-page .main-heading-bar .sound-toggle-btn { padding-inline: 0.5rem; }

  .main-page .main-title-row {
    gap: 0.32rem;
  }

  .main-page .eyebrow {
    font-size: 0.56rem;
    letter-spacing: 0.1em;
  }

  .main-page .main-title-divider {
    font-size: 0.8rem;
  }

  .main-page .main-header h1 {
    font-size: 1rem;
    letter-spacing: -0.05em;
    text-shadow: 2px 2px 0 #102968;
  }

  .main-page .main-identity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.28rem 0.4rem;
    padding: 0.34rem 0.45rem;
  }

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

  .main-page .main-identity > span {
    min-width: 0;
  }

  .main-page .main-identity small {
    font-size: 0.42rem;
  }

  .main-page .main-identity strong {
    max-width: 100%;
    font-size: 0.56rem;
  }

  .main-page .main-identity .hub-progress {
    grid-column: 1 / -1;
  }

  .main-page .hub-progress-controls {
    gap: 0.2rem;
  }

  .main-page .hub-progress-controls button {
    width: 19px;
    height: 19px;
    font-size: 0.7rem;
  }

  .main-page .user-badge,
  .main-page .logout-btn {
    padding: 0.38rem 0.46rem;
    font-size: 0.64rem;
  }

  .main-page .hub-menu-row {
    gap: 0.3rem;
  }

  .main-page .menu-thumb {
    flex-basis: 72px;
    width: 72px;
    height: 62px;
  }

  .main-page .menu-card ul {
    gap: 0.25rem 0.35rem;
  }

  .main-page .menu-card li {
    font-size: 0.78rem;
  }

  .main-page .game-info {
    min-width: 3.7rem;
  }

  .settings-item {
    grid-template-columns: 1fr;
  }

  .password-change-form {
    grid-template-columns: 1fr;
  }
}

/* Layered kingdom scene: background, sky, weather, time tint, then UI. */
body.main-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background-image: none;
}

#kingdomScene {
  position: relative;
  flex: 0 0 auto;
  width: min(100vw, 100dvh, 1024px);
  max-width: 1024px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #143e87;
}

#kingdomBackground,
#kingdomAreaLayer,
#weatherCanvas,
#skyLayer,
#timeOverlay,
#gameUi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#kingdomBackground {
  z-index: 10;
  object-fit: cover;
  object-position: center;
}

#kingdomAreaLayer {
  z-index: 15;
  pointer-events: none;
}

#kingdomAreaLayer .kingdom-area-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

#skyLayer { z-index: 20; }
#weatherCanvas { z-index: 30; }

#timeOverlay {
  z-index: 40;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.025) 3px 4px),
    linear-gradient(90deg, rgba(4, 25, 74, 0.12), transparent 18%, transparent 82%, rgba(4, 25, 74, 0.12));
}

#nightOverlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #001030;
  opacity: 0;
  pointer-events: none;
  transition: none;
  will-change: opacity;
}

#nightOverlay.is-time-ready {
  transition: opacity 30s linear;
}

#weatherCanvas,
#skyLayer,
#timeOverlay {
  pointer-events: none;
}

#gameUi { z-index: 50; }

.main-page #gameUi .main-shell {
  width: min(96%, 1024px);
  height: 100%;
}

/* Keep the job sprite anchored to the kingdom artwork, not the browser viewport. */
.main-page #gameUi .main-job-avatar {
  position: absolute;
  left: 51%;
  top: 61%;
  width: 15%;
  height: 20%;
  transform: translateX(-50%);
}

.site-footer {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem 1.15rem;
  width: min(100%, 1024px);
  padding: 1.5rem 1rem 1.75rem;
  border-top: 1px solid rgba(255, 211, 78, 0.42);
  background: #030b20;
  color: #b9cde7;
  font-family: "Courier New", monospace;
  text-align: center;
}

.site-footer strong {
  display: inline;
  margin: 0;
  color: #fff0a0;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.site-footer p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.5;
}

.site-footer-version {
  margin: 0 !important;
  color: #70dfff;
}


/* Restored area buttons and game panel. */
#kingdomAreaButtons { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.kingdom-area-hotspot { position: absolute; z-index: 1; width: clamp(130px,22%,240px); height: clamp(100px,19%,200px); transform: translate(-50%,-50%); pointer-events: auto; }
.kingdom-palace-hotspot { z-index: 2; width: clamp(180px,31%,340px); height: clamp(150px,27%,290px); }
.kingdom-area-button { position: absolute; left: 50%; top: 50%; z-index: 1; display: grid; justify-items: stretch; gap: .22rem; width: clamp(112px,15vw,168px); padding: .45rem .7rem .55rem; border: 2px solid #ffe46e; border-radius: 3px; background: rgba(5,35,88,.9); color: #fff5bf; font: 900 clamp(.58rem,1.4vw,.82rem) "Courier New", monospace; text-align: center; text-shadow: 2px 2px 0 #10285d; box-shadow: 0 4px 0 rgba(2,20,58,.82), 0 0 14px rgba(255,222,89,.35); opacity: 0; visibility: hidden; transform: translate(-50%,-50%) scale(.96); cursor: pointer; pointer-events: none; transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s; }
.kingdom-area-hotspot:hover .kingdom-area-button,.kingdom-area-hotspot:focus-within .kingdom-area-button,#kingdomAreaButtons.show-all-area-buttons .kingdom-area-button { opacity: 1; visibility: visible; transform: translate(-50%,-50%) scale(1); pointer-events: auto; transition-delay: 0s; }
@media (hover: none), (pointer: coarse) { .kingdom-area-button { opacity: 1; visibility: visible; transform: translate(-50%,-50%) scale(1); pointer-events: auto; } }
.kingdom-palace-button { z-index: 2; }
.kingdom-area-button:disabled { border-color: #78849d; color: #b3bac8; background: rgba(26,37,62,.9); box-shadow: 0 4px 0 rgba(10,17,34,.82); cursor: not-allowed; filter: grayscale(.55); }
.kingdom-area-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kingdom-area-progress-text { display: block; color: #9fe8ff; font-size: .78em; line-height: 1.15; text-shadow: 1px 1px 0 #10285d; }
.kingdom-area-progress { display: block; height: clamp(5px,.7vw,8px); overflow: hidden; border: 1px solid rgba(255,244,179,.75); border-radius: 999px; background: rgba(1,14,43,.9); box-shadow: inset 0 1px 2px rgba(0,0,0,.65); }
.kingdom-area-progress-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#45c9ff,#ffe46e); box-shadow: 0 0 7px rgba(112,223,255,.75); transition: width .45s ease; }
.kingdom-area-button:disabled .kingdom-area-progress-fill { background: #68738a; box-shadow: none; }
.kingdom-area-button.has-weekend-bonus { border-color: #70ffbb; background: rgba(5,68,82,.94); box-shadow: 0 4px 0 rgba(2,38,48,.88),0 0 20px rgba(65,255,172,.7); animation: restoration-bonus-glow 1.8s ease-in-out infinite; }
.kingdom-area-bonus-badge { display: block; padding: .12rem .28rem; border: 1px solid rgba(187,255,220,.85); border-radius: 999px; background: rgba(13,112,88,.88); color: #e6fff2; font-size: .68em; line-height: 1.2; text-shadow: 1px 1px 0 #064b3b; }
.area-game-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; overflow: auto; padding: 1rem; background: rgba(1,8,28,.84); backdrop-filter: blur(5px); }
.area-game-panel { position: relative; flex: 0 0 auto; width: min(calc(100vw - 2rem),var(--area-panel-height-limited-width,calc(100dvh - 2rem)),1024px); max-width: 1024px; aspect-ratio: var(--area-panel-ratio,1); overflow: hidden; border: 3px solid #ffd34e; background-color: #071d4b; background-image: var(--area-panel-background); background-position: center; background-repeat: no-repeat; background-size: contain; box-shadow: 0 12px 0 rgba(2,20,58,.88), 0 24px 55px rgba(0,0,0,.58); }
.area-game-panel > .royal-hub { position: absolute; left: 50%; top: 50%; width: min(76%,680px); margin: 0; transform: translate(-50%,-50%); }
.area-game-content { position: absolute; left: 50%; top: 69%; width: min(76%,680px); max-height: 43%; overflow-y: auto; padding: 1.2rem; border: 2px solid rgba(255,227,105,.72); background: rgba(4,30,78,.62); transform: translate(-50%,-50%); backdrop-filter: blur(2px); }
.area-game-content h2 { display: grid; grid-template-columns: minmax(0,auto) minmax(180px,1fr); align-items: center; gap: .7rem; margin: .2rem 0 .85rem; color: #fff0a0; }
.area-npc-dialogue { position: absolute; left: 50%; top: 27%; display: grid; grid-template-columns: minmax(90px,32%) minmax(0,1fr); align-items: center; gap: clamp(.55rem,2vw,1rem); width: min(76%,680px); padding: .7rem; border: 2px solid rgba(255,227,105,.72); background: rgba(4,30,78,.62); transform: translate(-50%,-50%); backdrop-filter: blur(2px); }
.area-npc-dialogue[hidden] { display: none; }
.area-npc-portrait { width: 100%; aspect-ratio: 3 / 2; background-image: var(--area-npc-image); background-position: center var(--area-npc-position,0%); background-repeat: no-repeat; background-size: 100% 500%; filter: drop-shadow(0 4px 3px rgba(0,0,0,.55)); }
.area-npc-speech { position: relative; align-self: stretch; min-height: clamp(72px,10vw,112px); border: 4px solid #17234f; border-radius: 0; background: #fff6cf; box-shadow: 0 0 0 3px #ffe477,0 0 0 6px #17234f,6px 8px 0 rgba(1,8,28,.72),inset 0 0 0 3px #d59b45; color: #17234f; image-rendering: pixelated; }
.area-npc-speech[hidden] { visibility: hidden; display: block; }
.area-npc-speech:not([hidden]) { display: flex; align-items: center; padding: clamp(.7rem,2vw,1.1rem); font: 900 clamp(.62rem,1.5vw,.88rem)/1.65 "Courier New",monospace; letter-spacing: .01em; text-shadow: 1px 1px 0 rgba(213,155,69,.3); animation: npc-speech-in .18s steps(3,end); }
.area-npc-speech::before { content: ""; position: absolute; left: -18px; top: 50%; width: 14px; height: 20px; border: 0; background: linear-gradient(to right,#17234f 0 4px,#ffe477 4px 7px,#fff6cf 7px 100%); box-shadow: -3px 0 0 #17234f,0 -4px 0 #17234f,0 4px 0 #17234f; transform: translateY(-50%); }
.area-npc-speech::after { content: "▼"; position: absolute; right: .55rem; bottom: .28rem; color: #b45f38; font: 900 .62rem/1 "Courier New",monospace; animation: npc-dialogue-cursor .8s steps(2,end) infinite; }
@keyframes npc-speech-in { from { opacity: 0; transform: translateX(-8px); } }
@keyframes npc-dialogue-cursor { 50% { transform: translateY(3px); } }
.area-game-title-text { white-space: nowrap; }
.area-panel-progress,.game-contribution { display: grid; grid-template-columns: auto minmax(80px,1fr); align-items: center; gap: .45rem; min-width: 0; }
.area-panel-progress-text,.game-contribution-text { color: #bfeeff; font: 700 clamp(.52rem,1.15vw,.72rem) "Courier New",monospace; white-space: nowrap; }
.area-panel-progress-track,.game-contribution-track { display: block; height: .62rem; overflow: hidden; border: 1px solid rgba(190,235,255,.8); border-radius: 999px; background: rgba(1,14,43,.9); box-shadow: inset 0 1px 2px rgba(0,0,0,.65); }
.area-panel-progress-fill,.game-contribution-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#41cfff,#ffe46e); box-shadow: 0 0 7px rgba(112,223,255,.75); }
.area-game-list { display: grid; grid-template-columns: 1fr; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.area-game-list li { display: flex; align-items: center; gap: .45rem; min-width: 0; padding: .55rem; border: 1px solid rgba(151,211,255,.5); background: rgba(4,34,85,.58); }
.area-game-list li.is-playable { cursor: pointer; transition: border-color .16s ease,background-color .16s ease,box-shadow .16s ease,transform .16s ease; }
.area-game-list li.is-playable:hover { border-color: #ffe36e; background: rgba(8,54,114,.82); box-shadow: inset 0 0 0 1px rgba(255,227,110,.2),0 0 13px rgba(93,194,255,.28); transform: translateY(-1px); }
.area-game-list li.is-playable:hover .game-link { color: #fff17a; text-shadow: 0 0 8px rgba(255,231,92,.75); }
.area-game-list li.is-playable:focus-visible { border-color: #fff4a8; outline: 3px solid #fff4a8; outline-offset: 2px; background: rgba(8,54,114,.9); }
.area-game-list li.is-disabled { border-color: #454a52; background: rgba(35,38,43,.94); color: #7f858e; }
.area-game-list li.has-restoration-bonus { border-color: #70ffbb; background: rgba(8,74,86,.84); box-shadow: inset 0 0 0 1px rgba(112,255,187,.22),0 0 12px rgba(65,255,172,.28); }
.restoration-bonus-badge { justify-self: start; padding: .13rem .42rem; border: 1px solid rgba(187,255,220,.85); border-radius: 999px; background: rgba(13,112,88,.9); color: #e6fff2; font: 900 clamp(.48rem,1vw,.62rem) "Courier New",monospace; line-height: 1.2; white-space: nowrap; }
@keyframes restoration-bonus-glow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
.area-game-list li.is-disabled .menu-item-icon,
.area-game-list li.is-disabled .game-info > span:first-child,
.area-game-list li.is-disabled .game-stats { color: #747a83; filter: grayscale(1); }
.area-game-list .game-info { display: grid; grid-template-columns: minmax(0,1fr); gap: .28rem; width: 100%; min-width: 0; }
.game-title-row { display: grid; grid-template-columns: minmax(90px,auto) auto minmax(180px,1fr); align-items: center; gap: .45rem; }
.game-title-row > .game-link,.game-title-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-stats { display: grid; grid-template-columns: 1fr; align-items: center; gap: .12rem; }
.game-stat { color: #b9d9ff; font: 700 clamp(.52rem,1.2vw,.72rem) "Courier New", monospace; }
.game-stat.game-score { color: var(--card-accent,#ffd978); }
.area-game-close { position: absolute; top: var(--area-close-top,92px); right: var(--area-close-right,46px); z-index: 2; width: var(--area-close-size,64px); height: var(--area-close-size,64px); padding: 0; border: 0; background: transparent; color: transparent; cursor: pointer; }
.area-game-close:focus-visible { outline: 3px solid #fff4a8; outline-offset: 2px; }
.game-launch-modal { position: fixed; inset: 0; z-index: 100; background: #030812; }
.game-launch-frame { display: block; width: 100%; height: 100%; border: 0; background: #030812; }
.game-launch-close { position: fixed; top: max(.55rem,env(safe-area-inset-top)); right: max(.55rem,env(safe-area-inset-right)); z-index: 2; display: grid; place-items: center; width: 2.35rem; height: 2.35rem; padding: 0; border: 1px solid rgba(255,238,174,.55); border-radius: 50%; background: rgba(3,8,18,.82); color: #fff2c9; font: 700 1.45rem/1 sans-serif; cursor: pointer; backdrop-filter: blur(4px); }
.game-launch-close:hover,.game-launch-close:focus-visible { border-color: #ffe05d; color: #ffe05d; outline: none; }
.game-launch-loading { position: fixed; left: 50%; top: 50%; z-index: 1; margin: 0; color: #fff2c9; font: 700 .8rem "Press Start 2P",monospace; transform: translate(-50%,-50%); }
.game-launch-modal.is-loaded .game-launch-loading { display: none; }
.game-launch-modal.is-loaded .game-launch-close { display: none; }
.visually-hidden { position: absolute!important; width: 1px!important; height: 1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; }
@media (max-width:700px) {
  .area-game-content { top: 69%; width: 90%; max-height: 43%; padding: .55rem; }
  .area-game-content .eyebrow { margin-bottom: .12rem; font-size: .48rem; letter-spacing: .1em; }
  .area-game-content h2 { grid-template-columns: 1fr; gap: .28rem; margin: .1rem 0 .5rem; font-size: .9rem; }
  .area-npc-dialogue { top: 27%; grid-template-columns: minmax(72px,34%) minmax(0,1fr); gap: .45rem; width: 90%; padding: .4rem; }
  .area-npc-speech { min-height: 56px; }
  .area-npc-speech::before { left: -13px; width: 9px; height: 14px; box-shadow: -2px 0 0 #17234f,0 -3px 0 #17234f,0 3px 0 #17234f; }
  .area-game-list { gap: .38rem; }
  .area-game-list li { gap: .32rem; padding: .4rem; }
  .area-game-list .menu-item-icon { flex: 0 0 auto; font-size: .85rem; }
  .area-game-list .game-info { grid-template-columns: minmax(0,1fr); gap: .24rem; }
  .game-title-row { grid-template-columns: minmax(80px,auto) auto; gap: .25rem; }
  .game-title-row .game-contribution { grid-column: 1 / -1; }
  .game-title-row > .game-link,.game-title-row > span:first-child { font-size: .72rem; line-height: 1.2; }
  .game-stats { gap: .12rem; white-space: normal; }
  .game-stat { overflow: hidden; font-size: .5rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
}
