/* ---------------------------------------------------------------------
   Greenflip design tokens — light theme
   --------------------------------------------------------------------- */
:root {
  --bg: #ffffff;
  --surface: #f7f9f4;
  --surface-raised: #eef3e7;
  --border: #e2e8da;

  --green: #7bc142;
  --green-deep: #57862f;
  --green-dim: #e6f3da;
  --green-text: #3f6b21; /* used where green text sits on a light-green fill */

  --text: #16200f;
  --text-muted: #61705a;
  --text-faint: #97a38e;

  --danger: #c1502f;

  --shadow-sm: 0 1px 2px rgba(20, 30, 10, 0.04), 0 2px 10px rgba(20, 30, 10, 0.05);
  --shadow-md: 0 12px 32px rgba(20, 30, 10, 0.12);

  --font-display: "Manrope", sans-serif;
  --font-body: "Inter", sans-serif;

  --radius: 14px;
  --radius-sm: 8px;

  --sidebar-width: 232px;
  --content-max: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--text);
}

p {
  margin: 0;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
}

input {
  font-family: var(--font-body);
}

.boot-message {
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   Loading screen
   --------------------------------------------------------------------- */

.loading-screen {
  min-height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.loading-mark {
  width: 56px;
  height: 56px;
  animation: loading-pulse 1.4s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.loading-screen p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
   App shell: sidebar + main column
   --------------------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 4px 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
}

.sidebar-brand img {
  width: 26px;
  height: 26px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.nav-item.active {
  background: var(--green-dim);
  color: var(--green-text);
}

.sidebar-discord {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: #5865f2;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  margin-top: auto;
}

.sidebar-discord svg {
  flex-shrink: 0;
}

.sidebar-discord:hover {
  background: rgba(88, 101, 242, 0.1);
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 780px) {
  .sidebar {
    width: 76px;
    padding: 20px 12px;
  }
  .sidebar-brand span,
  .sidebar-discord span {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .sidebar-discord {
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------
   Topbar
   --------------------------------------------------------------------- */

.topbar {
  height: 76px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 40px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 20px;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------------------------------------------------------------------
   Content wrapper
   --------------------------------------------------------------------- */

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  padding: 0 48px;
}

@media (max-width: 640px) {
  .content {
    padding: 0 22px;
  }
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--green);
  color: #0f1a08;
}

.btn-primary:hover {
  background: #6bae35;
}

.btn-secondary {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--text-faint);
  background: var(--surface);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 4px;
}

.btn-ghost:hover {
  color: var(--text);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

/* ---------------------------------------------------------------------
   Profile menu
   --------------------------------------------------------------------- */

.profile {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  color: var(--text);
}

.profile-trigger:hover {
  border-color: var(--text-faint);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-balance {
  font-size: 0.88rem;
  font-weight: 600;
}

.profile-chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.profile.is-open .profile-chevron {
  transform: rotate(180deg);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 30;
}

.profile-menu-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.profile-menu-header .label {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.profile-menu-header .value {
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-all;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  padding: 13px 18px;
  color: var(--text);
  font-size: 0.92rem;
  text-align: left;
}

.profile-menu-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.profile-menu-item:hover {
  background: var(--surface);
}

.profile-menu-item.danger {
  color: var(--danger);
  border-top: 1px solid var(--border);
}

.profile-menu-item.danger svg {
  color: var(--danger);
}

/* ---------------------------------------------------------------------
   Auth modal
   --------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 32, 15, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px;
  position: relative;
}

.auth-card-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  line-height: 0;
}

.auth-card-close:hover {
  color: var(--text);
}

.auth-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 20px 0 6px;
}

.auth-card input,
.card input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.95rem;
}

.auth-card input:focus,
.card input:focus {
  outline: 2px solid var(--green-deep);
  outline-offset: 1px;
  border-color: var(--green);
}

.auth-card .btn {
  margin-top: 24px;
}

.field-error {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--danger);
  min-height: 1.2em;
}

.field-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   Lobby
   --------------------------------------------------------------------- */

.lobby {
  padding: 40px 0 80px;
}

/* Promo banner */

.lobby-banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--green-deep), #1f3a12);
  border-radius: 20px;
  padding: 40px 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.lobby-banner-text h1 {
  color: #fff;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.lobby-banner-text p {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.98rem;
  max-width: 460px;
}

.lobby-banner-mark {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  opacity: 0.9;
}

@media (max-width: 640px) {
  .lobby-banner {
    padding: 28px 24px;
  }
  .lobby-banner-mark {
    display: none;
  }
}

/* Games section header */

.games-section {
  margin-top: 44px;
}

.games-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.games-section-header p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.carousel-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.carousel-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn:hover {
  border-color: var(--text-faint);
}

.carousel-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Search */

.game-search {
  position: relative;
  margin-top: 20px;
  max-width: 360px;
}

.game-search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.game-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 16px 11px 44px;
  color: var(--text);
  font-size: 0.92rem;
}

.game-search input:focus {
  outline: 2px solid var(--green-deep);
  outline-offset: 1px;
  border-color: var(--green);
}

/* Game tile row */

.game-row {
  margin-top: 22px;
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 6px;
}

.game-row::-webkit-scrollbar {
  height: 0;
}

.game-tile {
  flex: 0 0 auto;
  width: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  scroll-snap-align: start;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.game-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--green);
}

.game-tile-art {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.game-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.game-tile-body {
  padding: 14px 16px 18px;
}

.game-tile-body h3 {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
}

.game-tile-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-tile-badge {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--green-text);
  background: var(--green-dim);
  border-radius: 999px;
  padding: 3px 10px;
}

.game-tile-badge.is-live {
  background: var(--green);
  color: #0f1a08;
  font-weight: 600;
}

.deploy-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.deploy-btn:hover {
  border-color: var(--green);
  color: var(--green-text);
}

.deploy-btn svg {
  transition: transform 0.15s ease;
}

.deploy-btn.is-live {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green-text);
}

.deploy-btn.is-live svg {
  transform: rotate(180deg);
}

.game-row-empty {
  margin-top: 22px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

@media (max-width: 480px) {
  .game-tile {
    width: 200px;
  }
}

/* ---------------------------------------------------------------------
   Sub pages (wallet / settings)
   --------------------------------------------------------------------- */

.subpage {
  padding: 48px 0 80px;
}

.subpage-inner {
  max-width: 560px;
}

.subpage-header {
  margin-bottom: 28px;
}

.subpage-header p {
  color: var(--text-muted);
  margin-top: 6px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.address-box {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  word-break: break-all;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-muted);
  margin-top: 12px;
}

.balance-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 16px;
}

.balance-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}

.tx-status {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.tx-status.is-error {
  color: var(--danger);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row .label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.settings-row .value {
  font-size: 0.92rem;
  color: var(--text);
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: auto;
}

.footer .content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-faint);
}
