:root {
  --bg: #07131a;
  --bg-soft: #10232d;
  --panel: rgba(7, 22, 29, 0.86);
  --panel-solid: #0f2530;
  --line: rgba(126, 245, 196, 0.18);
  --emerald: #63f0b1;
  --emerald-deep: #0f704d;
  --coral: #ff9770;
  --text: #f0fbf7;
  --muted: #94b5ac;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(99, 240, 177, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 151, 112, 0.16), transparent 24%),
    linear-gradient(180deg, #07131a 0%, #0b1b24 45%, #07131a 100%);
  color: var(--text);
  font-family: Georgia, "Trebuchet MS", serif;
}
body { min-height: 100vh; }
button, input { font: inherit; }

.app-shell { min-height: 100vh; }
.screen { min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--emerald);
  margin: 0 0 10px;
}

.screen-welcome,
#dashboard-screen {
  padding: 24px;
}

.hero-card,
.profile-card,
.action-card,
.activity-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -35% auto;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(99, 240, 177, 0.22), transparent 68%);
  pointer-events: none;
}
.hero-card h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2.3rem, 4vw, 4.8rem);
  line-height: 0.95;
}
.hero-copy {
  max-width: 720px;
  font-size: 1.06rem;
  line-height: 1.6;
  color: #d8eee5;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.feature-tile,
.auth-box,
.stat-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
}
.feature-tile { padding: 18px; }
.feature-tile h2,
.overlay-card h3,
.card-head h3,
.invite-panel h4 {
  margin: 0 0 8px;
}
.feature-tile p { margin: 0; color: var(--muted); line-height: 1.5; }

.auth-stack {
  display: grid;
  gap: 14px;
  margin-top: 28px;
  max-width: 720px;
}
.auth-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}
.auth-box p { margin: 4px 0 0; }
.status-line { margin: 18px 0 0; color: var(--muted); min-height: 24px; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--emerald), #9cffd0);
  color: #062514;
  font-weight: 700;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.dashboard-header {
  max-width: 1240px;
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.dashboard-header h2 { margin: 0; font-size: clamp(1.9rem, 3vw, 3.2rem); }
.dashboard-grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  gap: 18px;
}
.profile-card,
.action-card,
.activity-card {
  padding: 22px;
}
.profile-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.avatar,
.avatar-image {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  object-fit: cover;
}
.avatar {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--emerald-deep), var(--emerald));
  color: #041a11;
  font-size: 1.7rem;
  font-weight: 700;
}
.profile-top h3 { margin: 0; }
.profile-top p { margin: 6px 0 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat-card {
  padding: 14px;
  min-height: 92px;
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.stat-card strong { font-size: 1.55rem; }

.card-head p { margin: 0; }
.action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0 0;
}
.action-list.compact { margin-top: 14px; }
.invite-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.invite-link {
  word-break: break-all;
  color: #c8f9e1;
  min-height: 24px;
}

.recent-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}
.recent-list li {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.recent-list strong { display: block; margin-bottom: 6px; }

#game-screen {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #08161c 0%, #061117 100%);
}
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(5, 13, 18, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.hud-side { display: flex; flex-direction: column; min-width: 110px; }
.hud-left .name { color: var(--emerald); }
.hud-right { align-items: flex-end; }
.hud-right .name { color: var(--coral); }
.hud-center { flex: 1; text-align: center; color: var(--muted); }
.score { font-size: 1.65rem; font-weight: 700; }
.hp { display: flex; gap: 4px; margin-top: 4px; }
.hp .pip {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}
.hp .pip.on { background: currentColor; }
.hud-left .hp { color: var(--emerald); }
.hud-right .hp { color: var(--coral); }

#canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: linear-gradient(180deg, #0b1d24 0%, #0d2830 100%);
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(5px);
}
.overlay-card {
  width: min(560px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 24px;
  background: rgba(9, 24, 31, 0.92);
  border: 1px solid rgba(99, 240, 177, 0.2);
  box-shadow: var(--shadow);
}
.overlay-card p { color: var(--muted); }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#touch {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180px;
  pointer-events: none;
}
.stick {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  pointer-events: auto;
}
.stick .knob {
  position: absolute;
  left: 35px;
  top: 35px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--emerald);
}
.fire {
  position: absolute;
  right: 32px;
  bottom: 36px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--coral);
  color: #2b0f09;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  pointer-events: auto;
}

@media (max-width: 980px) {
  .feature-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .auth-box,
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .hero-card,
  .profile-card,
  .action-card,
  .activity-card {
    padding: 18px;
  }
  .hero-card h1 {
    line-height: 1;
  }
  #touch { display: block; }
}

@media (min-width: 900px) {
  #touch { display: none; }
}
