:root {
  color-scheme: dark;
  --panel: rgba(8, 13, 20, 0.86);
  --line: rgba(205, 237, 238, 0.18);
  --text: #eef7f4;
  --muted: #9fb5b8;
  --teal: #31dbc5;
  --gold: #f1be5d;
  --coral: #ef6f6c;
  --green: #84cc68;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111d;
  color: var(--text);
}

button,
input,
a {
  font: inherit;
}

button,
.login-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
.login-button:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 219, 197, 0.7);
  background: rgba(49, 219, 197, 0.12);
}

button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.58;
}

.landing {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 32%, rgba(49, 219, 197, 0.18), transparent 30%),
    linear-gradient(145deg, #07111d, #12172a 48%, #14251b);
}

.login-panel {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.brand-mark {
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  border: 10px solid var(--gold);
  border-radius: 50%;
  box-shadow: inset 0 0 0 8px rgba(49, 219, 197, 0.6), 0 0 42px rgba(49, 219, 197, 0.45);
}

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

h1 {
  margin-bottom: 8px;
  text-align: center;
  font-size: 40px;
  letter-spacing: 0;
}

.tagline {
  margin-bottom: 22px;
  color: var(--muted);
  text-align: center;
}

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

.google {
  border-color: rgba(66, 133, 244, 0.55);
}

.apple {
  border-color: rgba(255, 255, 255, 0.55);
}

.meta {
  border-color: rgba(8, 102, 255, 0.7);
}

.x {
  border-color: rgba(239, 111, 108, 0.6);
}

.game-shell,
#stars {
  position: fixed;
  inset: 0;
}

#stars {
  width: 100vw;
  height: 100vh;
}

.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 9, 13, 0.64);
  backdrop-filter: blur(10px);
}

.hud-player {
  min-width: 0;
}

.hud-name {
  display: block;
  font-weight: 700;
}

.portal-state {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.resource-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.resource-bar strong {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  white-space: nowrap;
}

.tutorial {
  position: fixed;
  left: 18px;
  bottom: 22px;
  z-index: 4;
  display: grid;
  grid-template-columns: 74px minmax(220px, 370px);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(49, 219, 197, 0.34);
  border-radius: 8px;
  background: rgba(5, 9, 13, 0.78);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
}

.tutorial h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.tutorial p {
  margin-bottom: 10px;
  color: #d8e6e3;
  font-size: 14px;
  line-height: 1.35;
}

.starterman {
  position: relative;
  width: 58px;
  height: 104px;
  margin: auto;
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(180deg, #17151d, #07070a);
  box-shadow: 0 0 26px rgba(120, 74, 255, 0.42);
}

.starterman::before,
.starterman::after {
  content: "";
  position: absolute;
  bottom: -28px;
  width: 12px;
  height: 38px;
  border-radius: 999px;
  background: #08080c;
}

.starterman::before {
  left: 12px;
}

.starterman::after {
  right: 12px;
}

.starterman-eye {
  position: absolute;
  top: 24px;
  width: 14px;
  height: 6px;
  border-radius: 999px;
  background: #c978ff;
  box-shadow: 0 0 10px #c978ff;
}

.starterman-eye.left {
  left: 12px;
}

.starterman-eye.right {
  right: 12px;
}

.shop-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  padding: 0;
  background: rgba(241, 190, 93, 0.16);
  border-color: rgba(241, 190, 93, 0.7);
}

.shop-button svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal {
  position: fixed;
  z-index: 10;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(14px);
}

.compact {
  left: 50%;
  top: 50%;
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  transform: translate(-50%, -50%);
}

.compact h2 {
  font-size: 24px;
  letter-spacing: 0;
}

form {
  display: flex;
  gap: 10px;
}

input {
  min-width: 0;
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--coral);
}

.shop {
  right: 22px;
  bottom: 92px;
  display: grid;
  grid-template-columns: 132px minmax(380px, 580px);
  width: min(760px, calc(100vw - 32px));
  min-height: 390px;
}

.icon-button {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 24px;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
}

.tabs button {
  justify-content: flex-start;
}

.tabs .active {
  border-color: rgba(49, 219, 197, 0.8);
  background: rgba(49, 219, 197, 0.14);
}

.shop-content {
  padding: 24px;
}

.shop-content h2 {
  margin-bottom: 16px;
  font-size: 22px;
}

.shop-card {
  display: grid;
  grid-template-columns: 92px 1fr 150px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(44, 174, 211, 0.36), rgba(10, 25, 36, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.shop-card h3 {
  margin-bottom: 4px;
}

.shop-card p,
.empty {
  color: var(--muted);
}

.item-art {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  font-size: 42px;
  font-weight: 900;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.24), transparent 35%),
    linear-gradient(145deg, rgba(132, 204, 104, 0.55), rgba(31, 86, 63, 0.88));
}

.build-art {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.28), transparent 35%),
    linear-gradient(145deg, rgba(241, 190, 93, 0.74), rgba(73, 52, 24, 0.9));
}

.terminal-art {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.32), transparent 35%),
    linear-gradient(145deg, rgba(139, 92, 246, 0.72), rgba(16, 36, 74, 0.92));
}

.item-body {
  min-width: 0;
}

.item-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.item-stats div {
  padding: 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.item-stats dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.item-stats dd {
  margin: 0;
  font-weight: 800;
}

.item-actions {
  display: grid;
  gap: 8px;
}

progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.08);
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

#researchStatus {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

#buildStatus,
#terminalStatus {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.secondary {
  margin-top: 18px;
  border-color: rgba(132, 204, 104, 0.7);
  background: rgba(132, 204, 104, 0.12);
}

[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  body {
    overflow: auto;
  }

  .hud {
    align-items: flex-start;
    flex-direction: column;
  }

  .resource-bar {
    justify-content: flex-start;
  }

  .tutorial {
    left: 16px;
    right: 88px;
    bottom: 16px;
    grid-template-columns: 52px 1fr;
  }

  .starterman {
    width: 44px;
    height: 76px;
  }

  .shop {
    left: 16px;
    right: 16px;
    bottom: 88px;
    grid-template-columns: 1fr;
    width: auto;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tabs button {
    justify-content: center;
    padding: 0 8px;
  }

  .shop-card,
  form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .item-art {
    width: 64px;
    height: 64px;
    font-size: 34px;
  }
}
