/* ==========================================================
   TOWN SNAP GAMES - Pure Minimal Design (Above the fold / First View Optimized)
   ========================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  color: #0f172a;
  font-family: 'Outfit', 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ================= Compact Header ================= */
.header {
  width: 100%;
  padding: 12px 24px;
  flex-shrink: 0;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  height: 28px;
  width: auto;
}

.logo-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #0f172a;
}

.logo-sub {
  color: #3b82f6;
  font-size: 13px;
  margin-left: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-gallery {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  transition: color 0.15s ease;
}

.link-gallery:hover {
  color: #0f172a;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  transition: all 0.15s ease;
}

.user-pill:hover {
  background: #e2e8f0;
}

.user-icon {
  font-size: 16px;
  color: #3b82f6;
}

/* ================= Main Container (Fits in 1st View) ================= */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 4px 20px 10px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ================= Compact Record Strip ================= */
.record-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 8px 18px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.record-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.r-label {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
}

.r-val {
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}

.r-val small {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.record-divider {
  width: 1px;
  height: 16px;
  background: #e2e8f0;
}

/* ================= Games Grid (2-Column Side by Side) ================= */
.games-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
}

.game-item {
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

.game-item:hover {
  transform: translateY(-3px);
}

.game-cover-link {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  margin-bottom: 8px;
  display: block;
}

.game-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.game-item:hover .game-thumb {
  transform: scale(1.03);
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.game-title {
  font-size: 16px;
  font-weight: 900;
  color: #0f172a;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 20px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  border-radius: 999px;
  transition: all 0.15s ease;
}

.btn-play:hover {
  background: #3b82f6;
}

.btn-play:active {
  transform: scale(0.96);
}

/* ================= Footer ================= */
.footer {
  padding: 10px 20px 14px;
  text-align: center;
  flex-shrink: 0;
}

.copyright {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

/* ================= Modal ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.15);
  width: 100%;
  max-width: 360px;
  padding: 24px;
  z-index: 2;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 16px;
  font-weight: 900;
  color: #0f172a;
}

.modal-close {
  font-size: 16px;
  color: #94a3b8;
  padding: 4px;
}

.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  padding: 7px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 9px;
  color: #64748b;
  text-align: center;
  transition: all 0.15s ease;
}

.auth-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.input-wrap {
  margin-bottom: 12px;
}

.input-wrap label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 4px;
}

.input-wrap input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  outline: none;
}

.input-wrap input:focus {
  border-color: #3b82f6;
  background: #ffffff;
}

.auth-error-msg {
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 12px;
}

.auth-error-msg.hidden {
  display: none;
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background: #0f172a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  border-radius: 12px;
  margin-top: 6px;
  transition: background 0.15s ease;
}

.btn-submit:hover {
  background: #3b82f6;
}

/* Profile View */
.profile-view.hidden {
  display: none;
}

.profile-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.user-icon-lg {
  font-size: 28px;
  color: #3b82f6;
}

.p-name {
  font-size: 16px;
  font-weight: 900;
}

.p-stats {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 13px;
  font-weight: 800;
  border-radius: 10px;
}

@media (max-width: 580px) {
  .header {
    padding: 10px 16px;
  }
  .container {
    padding: 0 16px;
  }
  .record-strip {
    gap: 12px;
    padding: 6px 12px;
    margin-bottom: 12px;
  }
  .r-label {
    font-size: 11px;
  }
  .r-val {
    font-size: 13px;
  }
  .games-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .game-cover-link {
    margin-bottom: 6px;
  }
  .game-title {
    font-size: 14px;
  }
  .btn-play {
    padding: 5px 16px;
    font-size: 11px;
  }
}
