/* ===== Google Material Design – my-games ===== */

* {
  box-sizing: border-box;
}

:root {
  /* Google 4-color brand palette */
  --g-blue:    #4285F4;
  --g-red:     #EA4335;
  --g-yellow:  #FBBC05;
  --g-green:   #34A853;

  /* Tinted backgrounds */
  --g-blue-bg:   #e8f0fe;
  --g-red-bg:    #fce8e6;
  --g-yellow-bg: #fef7e0;
  --g-green-bg:  #e6f4ea;

  /* Neutral */
  --g-text:    #202124;
  --g-sub:     #5f6368;
  --g-border:  #e8eaed;
  --g-surface: #ffffff;
  --g-bg:      #f8f9fa;

  /* Elevation (Google Cloud Console style) */
  --elev-1: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  --elev-2: 0 1px 3px 0 rgba(60,64,67,.30), 0 4px 8px 3px rgba(60,64,67,.15);
  --elev-3: 0 2px 6px 2px rgba(60,64,67,.15), 0 6px 20px 4px rgba(60,64,67,.10);
}

body {
  margin: 0;
  font-family: "Cairo", sans-serif;
  background: var(--g-bg);
  color: var(--g-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Page container ── */
.my-games-page {
  width: min(1120px, calc(100% - 48px));
  margin: 32px auto;
}

/* ── Hero card ── */
.hero-card {
  background: var(--g-surface);
  border-radius: 8px;
  padding: 28px 32px;
  box-shadow: var(--elev-1);
  border: 1px solid var(--g-border);
  overflow: hidden;
  position: relative;
}

/* 4-color top stripe – Google logo style */
.hero-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--g-blue)   0% 25%,
    var(--g-red)   25% 50%,
    var(--g-yellow) 50% 75%,
    var(--g-green)  75% 100%
  );
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--g-blue);
  text-transform: uppercase;
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--g-text);
  letter-spacing: -.5px;
}

.subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--g-sub);
}

.hero-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Google-style buttons */
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: "Cairo", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0 24px;
  height: 36px;
  cursor: pointer;
  transition: box-shadow .15s, background .15s, border-color .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--g-blue);
  color: #fff;
  border: none;
  box-shadow: 0 1px 2px rgba(66,133,244,.45);
}

.btn-primary:hover {
  background: #1a6ee8;
  box-shadow: 0 2px 6px rgba(66,133,244,.5);
}

.btn-ghost {
  background: transparent;
  color: var(--g-blue);
  border: 1px solid var(--g-border);
}

.btn-ghost:hover {
  background: var(--g-blue-bg);
  border-color: #c5d9f8;
}

/* ── Toolbar ── */
.toolbar {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--g-surface);
  border: 1px solid var(--g-border);
}

/* ============ MEDIA QUERIES ============ */

/* Tablet - 1024px and below */
@media (max-width: 1024px) {
  .my-games-page {
    width: min(95%, 100%);
    margin: 24px auto;
  }

  .hero-card {
    padding: 22px 24px;
  }

  .hero-card h1 {
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  }

  .hero-actions {
    margin-top: 16px;
    gap: 6px;
  }

  .btn-primary,
  .btn-ghost {
    padding: 0 20px;
    height: 34px;
    font-size: 0.85rem;
  }

  .toolbar {
    padding: 10px 12px;
  }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {
  .my-games-page {
    width: min(98%, 100%);
    margin: 16px auto;
  }

  .hero-card {
    padding: 18px 16px;
    border-radius: 12px;
  }

  .hero-card::before {
    height: 4px;
  }

  .eyebrow {
    font-size: 0.75rem;
  }

  .hero-card h1 {
    font-size: clamp(1.2rem, 2.2vw, 1.5rem);
    margin-bottom: 6px;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .hero-actions {
    margin-top: 12px;
    gap: 4px;
    flex-wrap: wrap;
  }

  .btn-primary,
  .btn-ghost {
    padding: 0 16px;
    height: 32px;
    font-size: 0.8rem;
  }

  .toolbar {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
  }
}
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  cursor: pointer;
}

.hamburger-btn span {
  width: 28px;
  height: 3px;
  background: #374151;
  border-radius: 2px;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-weight: 600;
  color: #4b5563;
}

@media (max-width: 768px) {

  .hamburger-btn {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;

    width: 100%;
    background: white;

    flex-direction: column;
    align-items: center;

    gap: 20px;
    padding: 24px 0;

    box-shadow: 0 10px 20px rgba(0,0,0,0.08);

    z-index: 99999;
  }

  .nav-links.active {
    display: flex;
  }
}
/* Small Mobile - 480px and below */
@media (max-width: 480px) {
  .my-games-page {
    width: 100%;
    margin: 12px auto;
  }

  .hero-card {
    padding: 16px 12px;
    border-radius: 12px;
    margin: 0 8px;
  }

  .eyebrow {
    font-size: 0.7rem;
  }

  .hero-card h1 {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .hero-actions {
    margin-top: 10px;
    gap: 6px;
    flex-direction: column;
  }

  .btn-primary,
  .btn-ghost {
    width: 100%;
    padding: 0 12px;
    height: 36px;
    font-size: 0.8rem;
  }

  .toolbar {
    margin-top: 10px;
    padding: 8px;
  

  border-radius: 8px;
  box-shadow: var(--elev-1);
  display: flex;
  align-items: center;
  gap: 12px;
}
}
.toolbar label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--g-sub);
  white-space: nowrap;
}

.toolbar select {
  min-width: 200px;
  border: 1px solid var(--g-border);
  border-radius: 4px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--g-text);
  background: var(--g-surface);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.toolbar select:focus {
  border-color: var(--g-blue);
  box-shadow: 0 0 0 2px rgba(66,133,244,.2);
}

/* ── Status / count text ── */
.page-message {
  margin: 16px 0 12px;
  font-size: 0.88rem;
  color: var(--g-sub);
}

/* ── Games grid ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Game card base ── */
.game-card {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--elev-1);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  /* colored right-side accent (inline-start in RTL) */
  border-inline-start: 4px solid transparent;
}

.game-card:hover {
  box-shadow: var(--elev-2);
  transform: translateY(-1px);
}

/* ── Per-type color coding ── */
.game-card--letter-cells {
  border-inline-start-color: var(--g-blue);
}
.game-card--letter-cells .badge {
  background: var(--g-blue-bg);
  color: var(--g-blue);
}
.game-card--letter-cells .btn-play {
  background: var(--g-blue);
  box-shadow: 0 1px 2px rgba(66,133,244,.4);
}
.game-card--letter-cells .btn-play:hover {
  background: #1a6ee8;
}

.game-card--image-guessing {
  border-inline-start-color: var(--g-green);
}
.game-card--image-guessing .badge {
  background: var(--g-green-bg);
  color: var(--g-green);
}
.game-card--image-guessing .btn-play {
  background: var(--g-green);
  box-shadow: 0 1px 2px rgba(52,168,83,.4);
}
.game-card--image-guessing .btn-play:hover {
  background: #2d9647;
}

.game-card--survey-game {
  border-inline-start-color: var(--g-red);
}
.game-card--survey-game .badge {
  background: var(--g-red-bg);
  color: var(--g-red);
}
.game-card--survey-game .btn-play {
  background: var(--g-red);
  box-shadow: 0 1px 2px rgba(234,67,53,.4);
}
.game-card--survey-game .btn-play:hover {
  background: #d03b2a;
}

/* ── Card internals ── */
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-type {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--g-sub);
}

/* Google chip / badge */
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--g-blue-bg);
  color: var(--g-blue);
  border-radius: 16px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .2px;
}

.game-title {
  margin: 10px 0 4px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--g-text);
  line-height: 1.4;
}

.game-description {
  margin: 0;
  flex: 1;
  min-height: 36px;
  color: var(--g-sub);
  font-size: 0.88rem;
  line-height: 1.5;
}

.game-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--g-border);
  color: var(--g-sub);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 24px;
  border: 2px dashed var(--g-border);
  border-radius: 8px;
  background: var(--g-surface);
  color: var(--g-sub);
  font-size: 0.95rem;
}

.error-text {
  color: var(--g-red);
}

.game-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--g-border);
  display: flex;
  gap: 8px;
}

/* Contained action button (default blue, overridden per type above) */
.btn-play {
  flex: 1;
  padding: 0 16px;
  height: 34px;
  background: var(--g-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: "Cairo", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(66,133,244,.4);
  transition: background .15s, box-shadow .15s;
}

.btn-play:hover {
  background: #1a6ee8;
  box-shadow: 0 2px 6px rgba(66,133,244,.45);
}

.btn-delete {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: #fff0f0;
  color: #ea4335;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background .15s, border-color .15s;
}

.btn-delete:hover {
  background: #ea4335;
  color: #fff;
  border-color: #ea4335;
}

/* ── Modal ── */
.join-code-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32,33,36,.5);
}

.modal-content {
  position: relative;
  background: var(--g-surface);
  border-radius: 8px;
  box-shadow: var(--elev-3);
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  direction: rtl;
  /* 4-color top stripe on modal too */
  border-top: 4px solid var(--g-blue);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--g-border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--g-text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--g-sub);
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.modal-close:hover {
  background: var(--g-bg);
  color: var(--g-text);
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body p {
  margin: 0 0 16px;
  color: var(--g-sub);
  font-size: 0.92rem;
}

.join-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--g-blue-bg);
  border: 1px solid #c5d9f8;
  border-radius: 8px;
  padding: 14px 16px;
}

.join-code-display code {
  flex: 1;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--g-blue);
  font-family: 'Google Sans Mono', 'Courier New', monospace;
  letter-spacing: 3px;
}

.btn-copy {
  padding: 0 16px;
  height: 32px;
  background: var(--g-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: "Cairo", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.btn-copy:hover {
  background: #1a6ee8;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .my-games-page {
    width: calc(100% - 24px);
    margin: 16px auto;
  }

  .hero-card {
    padding: 20px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar select {
    width: 100%;
  }
}
