:root {
  --yellow: #ffe566;
  --yellow-deep: #f5d03a;
  --blue: #3a6ea5;
  --blue-dark: #1e3a5c;
  --purple: #7b4fb8;
  --panel: rgba(30, 40, 55, 0.82);
  --panel-border: rgba(255, 255, 255, 0.2);
  --text: #fff8e8;
  --text-dim: rgba(255, 248, 232, 0.75);
  --font-round: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--blue-dark);
}

#app {
  position: fixed;
  inset: 0;
}

#viewport {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #7ec8e3 0%, #b8e0f5 45%, #e8f6ff 100%);
}

#viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  pointer-events: none;
  z-index: 5;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.2s;
}

#crosshair.is-active {
  opacity: 1;
}

.npc-hint {
  position: absolute;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  background: rgba(20, 30, 45, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: var(--font-round);
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.npc-hint kbd {
  font-family: var(--font-body);
  font-size: 0.68rem;
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: rgba(255, 213, 79, 0.25);
  border: 1px solid rgba(255, 213, 79, 0.45);
  margin-right: 0.25rem;
}

.npc-hint strong {
  color: #ffe082;
  font-weight: 700;
  margin-left: 0.2rem;
}

.eat-hint {
  position: absolute;
  left: 50%;
  bottom: 152px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  background: rgba(40, 55, 30, 0.9);
  border: 1px solid rgba(165, 214, 106, 0.45);
  font-family: var(--font-round);
  font-size: 0.72rem;
  color: #e8f5c8;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.eat-hint kbd {
  font-family: var(--font-body);
  font-size: 0.65rem;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(139, 195, 74, 0.35);
  border: 1px solid rgba(165, 214, 106, 0.5);
  margin-right: 0.35rem;
}

.hud-panel {
  position: absolute;
  z-index: 4;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

#hud-top {
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hud-top__mid {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.simoleons {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 1rem;
  color: #7fffab;
  text-shadow: 0 0 12px rgba(80, 255, 150, 0.35);
  white-space: nowrap;
}

.sim-time {
  font-family: var(--font-round);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.btn--mode {
  padding: 0.35rem 0.65rem;
  font-family: var(--font-round);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 8px;
  background: linear-gradient(180deg, #5ad18a 0%, #2fa060 100%);
  color: #0a1f12;
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.btn--mode:hover {
  filter: brightness(1.06);
}

.btn--mode.is-build {
  background: linear-gradient(180deg, #8ab4ff 0%, #4a7fd4 100%);
  color: #0f1a30;
}

.btn--catalog {
  padding: 0.35rem 0.65rem;
  font-family: var(--font-round);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd54f 0%, #f9a825 100%);
  color: #3e2723;
  border: 1px solid rgba(255, 255, 255, 0.45);
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.btn--catalog:hover {
  filter: brightness(1.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-round);
}

.logo__icon {
  font-size: 1.5rem;
  color: var(--yellow);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.logo strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.logo__tag {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}

#hud-left {
  top: 88px;
  left: 12px;
  max-width: 260px;
}

.sim-dock {
  top: 88px;
  right: 12px;
  width: min(288px, 46vw);
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.sim-dock__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0.5rem 0.5rem 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
}

.sim-tab {
  flex: 1;
  min-width: 56px;
  padding: 0.35rem 0.25rem;
  font-family: var(--font-round);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: pointer;
}

.sim-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.sim-tab.is-active {
  background: rgba(129, 199, 132, 0.35);
  border-color: rgba(129, 199, 132, 0.55);
  color: #e8ffee;
}

.sim-dock__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.55rem 0.65rem 0.5rem;
}

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

.sim-tab-panel.is-active {
  display: block;
}

.sim-tab-panel--buy .sim-dock__section-title:first-child {
  margin-top: 0;
}

.sim-dock__section-title {
  margin: 0.5rem 0 0.35rem;
  font-family: var(--font-round);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 248, 232, 0.55);
}

.sim-dock__mood {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-style: italic;
}

.sim-dock__hint {
  margin: 0.65rem 0 0;
  font-size: 0.58rem;
  line-height: 1.45;
  color: rgba(255, 248, 232, 0.5);
}

.sim-dock__foot {
  padding: 0.45rem 0.55rem 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
}

.btn--resume {
  width: 100%;
  padding: 0.45rem;
  font-family: var(--font-round);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(100, 181, 246, 0.35);
  color: #fff;
  cursor: pointer;
}

.btn--resume:hover {
  filter: brightness(1.08);
}

.buy-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 0.35rem;
}

.buy-cat {
  padding: 0.28rem 0.45rem;
  font-family: var(--font-body);
  font-size: 0.58rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-dim);
  cursor: pointer;
}

.buy-cat.is-active {
  background: rgba(255, 213, 79, 0.35);
  border-color: rgba(255, 213, 79, 0.65);
  color: #fffde7;
}

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

.catalog-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px 6px 5px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}

.catalog-item:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

.catalog-item.is-selected {
  border-color: #ffe082;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 12px rgba(255, 224, 130, 0.35);
}

.catalog-item__swatch {
  width: 100%;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.catalog-item__name {
  font-family: var(--font-round);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
}

.catalog-item__price {
  font-size: 0.55rem;
  color: #a5d6a7;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.friend-row {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.friend-row__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.friend-row__name {
  font-family: var(--font-round);
  font-size: 0.72rem;
  font-weight: 600;
}

.friend-row__rel {
  font-size: 0.58rem;
  color: #f48fb1;
  font-weight: 700;
}

.friend-row__bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.friend-row__fill {
  height: 100%;
  background: linear-gradient(90deg, #ec407a, #f48fb1);
  border-radius: 3px;
  transition: width 0.15s ease-out;
}

.friends-actions {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.friends-actions__label {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 248, 232, 0.55);
  margin-bottom: 0.25rem;
}

.friends-select {
  width: 100%;
  margin-bottom: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.75rem;
}

.friends-select--wide {
  margin-bottom: 0.5rem;
}

.btn--action {
  width: 100%;
  padding: 0.42rem;
  font-family: var(--font-round);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(180deg, #ba68c8 0%, #8e24aa 100%);
  color: #fff;
  cursor: pointer;
}

.btn--action:hover {
  filter: brightness(1.06);
}

.btn--action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.career-summary {
  margin: 0.5rem 0 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.career-summary strong {
  color: #fff9c4;
  font-weight: 700;
}

.need {
  margin-bottom: 0.35rem;
}

.need__label {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 248, 232, 0.65);
  margin-bottom: 0.12rem;
}

.need__bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.need__fill {
  height: 100%;
  width: 50%;
  border-radius: 3px;
  background: linear-gradient(90deg, #2e7d32, #8bc34a);
  box-shadow: 0 0 8px rgba(139, 195, 74, 0.35);
  transition: width 0.15s ease-out, filter 0.2s;
}

.need__fill.is-low {
  background: linear-gradient(90deg, #c62828, #ff8a65);
  box-shadow: 0 0 8px rgba(255, 112, 67, 0.35);
}

.need__fill.is-mid {
  background: linear-gradient(90deg, #f9a825, #ffee58);
  box-shadow: 0 0 8px rgba(255, 238, 88, 0.25);
}

.hud-panel--stack {
  padding-bottom: 0.75rem;
}

.hud-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-round);
  font-size: 0.85rem;
  color: var(--yellow);
}

.hud-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.hud-list kbd {
  font-family: var(--font-body);
  font-size: 0.68rem;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#hud-bottom {
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.slot-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.block-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: min(92vw, 720px);
}

.block-slot {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition:
    transform 0.12s,
    border-color 0.12s,
    box-shadow 0.12s;
}

.block-slot:hover {
  transform: scale(1.06);
}

.block-slot.is-selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 14px rgba(255, 229, 102, 0.55);
}

.btn {
  font-family: var(--font-round);
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition:
    transform 0.12s,
    box-shadow 0.12s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--small {
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn--small:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn--go {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow-deep) 100%);
  color: #3d3200;
  box-shadow: 0 4px 0 #c9a820, 0 6px 16px rgba(0, 0, 0, 0.25);
}

.btn--go:hover {
  filter: brightness(1.05);
}

.splash {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(30, 58, 92, 0.92), rgba(55, 40, 90, 0.88));
  padding: 1rem;
}

.splash[hidden] {
  display: none;
}

.splash__card {
  max-width: 400px;
  text-align: center;
  padding: 1.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.splash__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-round);
  font-size: 2rem;
  color: var(--yellow);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.splash__text {
  margin: 0 0 1.25rem;
  line-height: 1.55;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.splash__hint {
  margin: 0.85rem 0 0;
  font-size: 0.72rem;
  color: rgba(255, 248, 232, 0.55);
}

@media (max-width: 640px) {
  #hud-left {
    display: none;
  }

  .sim-dock {
    display: none;
  }

  .hud-top__mid {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .block-slot {
    width: 38px;
    height: 38px;
  }
}
