:root {
  --wallet-bg: #0f1419;
  --wallet-surface: #1a2332;
  --wallet-surface-2: #243044;
  --wallet-border: #334155;
  --wallet-text: #e2e8f0;
  --wallet-muted: #94a3b8;
  --wallet-accent: #3b82f6;
  --wallet-accent-hover: #2563eb;
  --wallet-success: #22c55e;
  --wallet-danger: #ef4444;
  --wallet-radius: 12px;
  --wallet-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body.wallet-app {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1e293b 0%, var(--wallet-bg) 55%);
  color: var(--wallet-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.wallet-header {
  background: rgba(15, 20, 25, 0.92);
  border-bottom: 1px solid var(--wallet-border);
  backdrop-filter: blur(8px);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.wallet-brand {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.wallet-brand span {
  color: var(--wallet-muted);
  font-weight: 500;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.wallet-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.wallet-toolbar .btn {
  border-radius: 8px;
  font-size: 0.875rem;
  white-space: nowrap;
}

.wallet-toolbar .btn-outline-light {
  border-color: var(--wallet-border);
  color: var(--wallet-text);
}

.wallet-toolbar .btn-outline-light:hover {
  background: var(--wallet-surface-2);
  border-color: var(--wallet-muted);
  color: #fff;
}

.wallet-user-bar {
  max-width: 1100px;
  margin: 1.25rem auto 0;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.wallet-stat {
  background: var(--wallet-surface);
  border: 1px solid var(--wallet-border);
  border-radius: var(--wallet-radius);
  padding: 0.65rem 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  box-shadow: var(--wallet-shadow);
}

.wallet-stat strong {
  color: #fff;
  font-weight: 600;
}

.wallet-stat--balance strong {
  color: #86efac;
}

.wallet-main {
  max-width: 1100px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.game-card {
  background: var(--wallet-surface);
  border: 1px solid var(--wallet-border);
  border-radius: var(--wallet-radius);
  overflow: hidden;
  box-shadow: var(--wallet-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: #64748b;
}

.game-card__title {
  margin: 0;
  padding: 0.85rem 1rem 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

.game-card__thumb {
  position: relative;
  height: 150px;
  margin: 0 1rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.game-card__thumb img.is-broken {
  display: none;
}

.game-card__placeholder {
  color: var(--wallet-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.75rem;
  line-height: 1.3;
}

.game-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 1rem;
}

.game-card__actions .btn {
  border-radius: 8px;
  font-weight: 600;
}

.game-card__actions .btn-play {
  background: var(--wallet-accent);
  border: none;
}

.game-card__actions .btn-play:hover {
  background: var(--wallet-accent-hover);
}

.game-card__actions .btn-url {
  background: transparent;
  border: 1px solid var(--wallet-border);
  color: var(--wallet-text);
}

.game-card__actions .btn-url:hover {
  background: var(--wallet-surface-2);
  border-color: var(--wallet-muted);
  color: #fff;
}

/* Full-screen overlays: play iframe + URL modal */
#iframe,
.url-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(4px);
}

.overlay-toolbar {
  width: min(960px, 100%);
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

#iframe iframe {
  width: min(960px, 100%);
  height: min(545px, 70vh);
  border: 1px solid var(--wallet-border);
  border-radius: var(--wallet-radius);
  background: #000;
}

.url-panel {
  width: min(720px, 100%);
  background: var(--wallet-surface);
  border: 1px solid var(--wallet-border);
  border-radius: var(--wallet-radius);
  box-shadow: var(--wallet-shadow);
  padding: 1.25rem;
}

.url-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.url-panel__hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--wallet-muted);
  line-height: 1.45;
}

#game-url-input {
  width: 100%;
  min-height: 120px;
  max-height: 220px;
  resize: vertical;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--wallet-border);
  background: #0b1220;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-all;
}

#game-url-input:focus {
  outline: none;
  border-color: var(--wallet-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.url-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.url-panel__actions .btn {
  border-radius: 8px;
  font-weight: 600;
}

.url-panel__status {
  margin-top: 0.75rem;
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--wallet-success);
}
