:root {
  --bg-top: #172330;
  --bg-bottom: #0d141c;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-hover: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #aebdca;
  --green: #79d45e;
  --blue: #58a8ff;
  --orange: #ffad4d;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 20%, rgba(88, 168, 255, 0.12), transparent 32rem),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
}

.welcome {
  width: min(960px, calc(100% - 32px));
  margin: auto;
  padding: 48px 0 32px;
  text-align: center;
}

.brand-mark {
  position: relative;
  width: 96px;
  height: 76px;
  margin: 0 auto 18px;
}

.block {
  position: absolute;
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  transform: rotate(30deg) skewY(-10deg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.block-a {
  left: 6px;
  top: 23px;
  background: var(--green);
}

.block-b {
  left: 31px;
  top: 2px;
  background: var(--blue);
}

.block-c {
  left: 53px;
  top: 28px;
  background: var(--orange);
}

.brand h1 {
  margin: 0;
  font-size: clamp(2.7rem, 9vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0.055em;
  font-weight: 900;
}

.brand p {
  margin: 14px 0 44px;
  color: var(--muted);
  font-size: clamp(1.05rem, 3vw, 1.35rem);
}

.choose-player h2 {
  margin: 0 0 20px;
  font-size: 1.35rem;
  font-weight: 650;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 260px));
  justify-content: center;
  gap: 18px;
}

.player-card {
  min-height: 220px;
  padding: 26px 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.player-card:hover,
.player-card:focus-visible {
  transform: translateY(-4px);
  background: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.3);
  outline: none;
}

.avatar {
  width: 92px;
  height: 92px;
  margin-bottom: 18px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.14);
}

.avatar-one {
  background: linear-gradient(145deg, #4e9fff, #2866c8);
}

.avatar-two {
  background: linear-gradient(145deg, #ffb650, #e87b35);
}

.player-name {
  font-size: 1.2rem;
  font-weight: 750;
}

.player-action {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.adult-entry {
  margin-top: 26px;
  padding: 11px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.adult-entry:hover,
.adult-entry:focus-visible {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
  outline: none;
}

footer {
  padding: 18px;
  text-align: center;
  color: #71808d;
  font-size: 0.78rem;
}

.footer-dot {
  padding: 0 6px;
}

@media (max-width: 620px) {
  .welcome {
    padding-top: 32px;
  }

  .brand p {
    margin-bottom: 30px;
  }

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

  .player-card {
    min-height: 150px;
    flex-direction: row;
    gap: 18px;
    text-align: left;
  }

  .avatar {
    width: 72px;
    height: 72px;
    margin: 0;
    flex: 0 0 auto;
  }

  .player-name,
  .player-action {
    display: block;
  }
}


/* =========================================================
   BuildVille V0.1B — Login flow
   ========================================================= */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 20px;
  background: rgba(5, 10, 16, 0.82);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(390px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: #182431;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.login-panel .avatar {
  margin: 0 auto 15px;
}

.login-panel h2 {
  margin: 0;
  font-size: 1.5rem;
}

.login-help {
  margin: 7px 0 20px;
  color: var(--muted);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 13px;
  margin: 0 0 24px;
}

.pin-dots span {
  width: 17px;
  height: 17px;
  border: 2px solid #758696;
  border-radius: 50%;
  transition: 120ms ease;
}

.pin-dots span.filled {
  border-color: var(--green);
  background: var(--green);
  transform: scale(1.08);
}

.pin-pad {
  width: min(285px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-key {
  min-height: 61px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}

.pin-key:hover,
.pin-key:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.pin-clear,
.pin-back {
  font-size: 0.8rem;
  color: var(--muted);
}

.login-message {
  min-height: 20px;
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 0.83rem;
}

.login-cancel {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.login-cancel:hover {
  color: var(--text);
}

.adult-login-panel {
  text-align: left;
}

.adult-login-panel h2,
.adult-login-panel .login-help,
.adult-login-panel .login-message {
  text-align: center;
}

.login-label {
  display: block;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-label input,
.login-label select {
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}

.login-label input:disabled,
.login-label select:disabled {
  opacity: 0.65;
}

.adult-login-panel .login-cancel {
  display: block;
  margin: 15px auto 0;
}

/* BuildVille V0.1E — Adult Access */
.login-submit {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.login-submit:hover {
  filter: brightness(1.08);
}

.login-submit:disabled {
  opacity: 0.65;
  cursor: default;
}

/* =========================================================
   BuildVille V0.2B — World shell
   Structural prototype. Final art direction remains open.
   ========================================================= */

body.world-open {
  overflow: hidden;
}

body.world-open > .welcome,
body.world-open > footer {
  visibility: hidden;
}

.world-shell {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: #17212b;
  background: #8bc8f2;
}

.world-topbar {
  min-height: 72px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #ffffff;
  background: rgba(20, 31, 42, 0.94);
  box-shadow: 0 3px 18px rgba(0, 0, 0, 0.22);
  z-index: 4;
}

.world-brand {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.world-brand-name {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.world-title {
  overflow: hidden;
  color: #b8c7d4;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.world-player-name {
  font-size: 0.88rem;
  font-weight: 700;
}

.world-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.world-menu-button {
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
}

.world-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      #8bc8f2 0%,
      #bfe6fb 38%,
      #a6d986 38%,
      #78b95f 100%
    );
}

.world-sky {
  position: absolute;
  inset: 0 0 62% 0;
  background:
    radial-gradient(
      circle at 78% 22%,
      rgba(255, 255, 255, 0.9) 0 30px,
      transparent 31px
    );
  pointer-events: none;
}

.city-ground {
  position: absolute;
  left: 50%;
  top: 53%;
  width: min(820px, 82vw);
  height: min(470px, 55vh);
  transform: translate(-50%, -50%) rotateX(55deg) rotateZ(-2deg);
  transform-style: preserve-3d;
  border: 5px solid rgba(59, 106, 47, 0.6);
  border-radius: 28px;
  background:
    linear-gradient(
      rgba(255, 255, 255, 0.12) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.12) 1px,
      transparent 1px
    ),
    #83c868;
  background-size: 42px 42px;
  box-shadow: 0 35px 70px rgba(29, 69, 34, 0.3);
}

.city-road {
  position: absolute;
  background: #626a70;
  box-shadow:
    inset 0 0 0 3px #747d83,
    0 3px 0 rgba(0, 0, 0, 0.12);
}

.city-road::after {
  content: "";
  position: absolute;
  background: repeating-linear-gradient(
    90deg,
    #f6e28d 0 24px,
    transparent 24px 45px
  );
}

.city-road-horizontal {
  left: 0;
  right: 0;
  top: 52%;
  height: 58px;
}

.city-road-horizontal::after {
  left: 0;
  right: 0;
  top: 27px;
  height: 4px;
}

.city-road-vertical {
  top: 0;
  bottom: 0;
  left: 58%;
  width: 58px;
}

.city-road-vertical::after {
  top: 0;
  bottom: 0;
  left: 27px;
  width: 4px;
  background: repeating-linear-gradient(
    180deg,
    #f6e28d 0 24px,
    transparent 24px 45px
  );
}

.build-lot {
  position: absolute;
  left: 10%;
  top: 12%;
  width: 39%;
  height: 31%;
  border: 4px dashed rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.15);
  color: #24452b;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateZ(3px);
}

.build-lot:hover,
.build-lot:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  outline: none;
}

.build-lot-plus {
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.82);
  font-size: 2rem;
  font-weight: 800;
}

.build-lot-title {
  font-weight: 850;
}

.build-lot-help {
  margin-top: 3px;
  font-size: 0.78rem;
}

.world-message {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: calc(100% - 30px);
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(22, 34, 45, 0.82);
  color: #ffffff;
  font-size: 0.82rem;
  text-align: center;
  white-space: nowrap;
}

.build-dock {
  min-height: 82px;
  padding: 9px 14px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  background: rgba(20, 31, 42, 0.97);
  box-shadow: 0 -3px 18px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

.build-tool {
  width: min(125px, 22vw);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #d8e4ec;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 700;
}

.build-tool-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.build-tool:hover,
.build-tool:focus-visible,
.build-tool.active {
  background: rgba(121, 212, 94, 0.18);
  border-color: rgba(121, 212, 94, 0.65);
  color: #ffffff;
  outline: none;
}

@media (max-width: 620px) {
  .world-topbar {
    min-height: 62px;
    padding: 8px 10px;
  }

  .world-title,
  .world-player-name {
    display: none;
  }

  .world-brand-name {
    font-size: 0.95rem;
  }

  .world-avatar {
    width: 38px;
    height: 38px;
  }

  .city-ground {
    width: 92vw;
    height: 48vh;
  }

  .build-lot {
    width: 43%;
    height: 34%;
  }

  .build-lot-help {
    display: none;
  }

  .world-message {
    bottom: 10px;
    font-size: 0.72rem;
  }

  .build-dock {
    min-height: 72px;
    padding: 7px;
  }

  .build-tool {
    width: 23%;
    border-radius: 11px;
    font-size: 0.68rem;
  }
}

/* =========================================================
   BuildVille V0.2C — Building editor foundation
   ========================================================= */

body.builder-open {
  overflow: hidden;
}

.builder-shell {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #dce7ed;
  color: #1c2a34;
}

.builder-topbar {
  min-height: 68px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #192b3a;
  color: #ffffff;
}

.builder-heading {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 13px;
}

.builder-brand {
  font-weight: 900;
  letter-spacing: 0.07em;
}

.builder-location {
  overflow: hidden;
  color: #b9c9d5;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-actions {
  display: flex;
  gap: 7px;
}

.builder-action,
.builder-done {
  padding: 9px 13px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
}

.builder-action {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.builder-action:disabled {
  opacity: 0.4;
  cursor: default;
}

.builder-done {
  border: 0;
  background: #79d45e;
  color: #16301a;
  font-weight: 800;
}

.builder-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 90px;
}

.builder-palette,
.builder-controls {
  padding: 14px 10px;
  background: #233746;
  color: #ffffff;
}

.builder-palette h2 {
  margin: 2px 0 13px;
  text-align: center;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aebfcb;
}

.builder-piece,
.builder-control {
  width: 100%;
  min-height: 72px;
  margin-bottom: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce8ef;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
}

.builder-piece.active,
.builder-piece:hover,
.builder-control:hover {
  border-color: rgba(121, 212, 94, 0.75);
  background: rgba(121, 212, 94, 0.18);
  color: #ffffff;
}

.builder-piece-icon {
  font-size: 1.55rem;
}

.builder-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 55px 45px 75px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, #eef3f6, #d7e2e8);
}

.builder-floor-label {
  position: absolute;
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 800;
  color: #50616d;
}

.builder-grid {
  width: min(900px, 100%);
  aspect-ratio: 12 / 10;
  display: grid;
  grid-template-columns:
    repeat(var(--grid-columns), minmax(0, 1fr));
  grid-template-rows:
    repeat(var(--grid-rows), minmax(0, 1fr));
  border: 3px solid #8ca0ac;
  background: #f8fafb;
  box-shadow: 0 18px 45px rgba(46, 70, 83, 0.16);
}

.builder-cell {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid #c8d3d9;
  border-bottom: 1px solid #c8d3d9;
  background: transparent;
  cursor: crosshair;
}

.builder-cell:hover,
.builder-cell:focus-visible {
  background: rgba(88, 168, 255, 0.2);
  outline: none;
}

.builder-status {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100% - 30px);
  padding: 9px 15px;
  border-radius: 999px;
  background: #263b49;
  color: #ffffff;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
}

.builder-controls {
  display: flex;
  flex-direction: column;
}

.builder-control {
  min-height: 76px;
  font-size: 1.3rem;
}

.builder-control span {
  font-size: 0.7rem;
}

@media (max-width: 700px) {
  .builder-location {
    display: none;
  }

  .builder-workspace {
    grid-template-columns: 78px minmax(0, 1fr) 66px;
  }

  .builder-palette,
  .builder-controls {
    padding: 8px 6px;
  }

  .builder-piece,
  .builder-control {
    min-height: 60px;
    font-size: 0.62rem;
  }

  .builder-piece-icon {
    font-size: 1.25rem;
  }

  .builder-canvas-wrap {
    padding: 45px 15px 65px;
  }

  .builder-status {
    font-size: 0.68rem;
  }
}
