body {
  background: linear-gradient(160deg, #0a2e1a 0%, #0f4025 35%, #0d3520 65%, #071d10 100%);
  overflow: hidden;
}

/* ===== WAITING SCREEN ===== */
.g-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
}

.g-hero-img {
  width: min(260px, 35vw);
  border-radius: 24px;
  animation: g-float 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 30px rgba(255,207,51,0.3));
}

.g-title {
  font-size: clamp(3rem, 8vw, 6rem);
  color: #ffcf33;
  text-shadow: 0 4px 24px rgba(255,207,51,0.35), 0 0 80px rgba(255,207,51,0.1);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.02em;
}

.g-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  color: rgba(255,255,255,0.55);
  margin: 0.5rem 0 0;
  animation: g-pulse 2.5s ease-in-out infinite;
}

@keyframes g-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes g-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}

/* ===== TUTORIAL ===== */
.g-tut-card {
  padding: 2.5rem 2rem;
  border-radius: 28px;
  text-align: center;
  max-width: 480px;
  width: 90vw;
  border: 2px solid rgba(255,255,255,0.1);
}

.tile-bg-regular { background: linear-gradient(180deg, rgba(255,207,51,0.18), rgba(255,157,0,0.12)); }
.tile-bg-trap    { background: linear-gradient(180deg, rgba(239,91,74,0.18), rgba(200,50,40,0.12)); }
.tile-bg-speed   { background: linear-gradient(180deg, rgba(67,165,255,0.18), rgba(24,108,214,0.12)); }
.tile-bg-clover  { background: linear-gradient(180deg, rgba(47,187,87,0.18), rgba(20,133,59,0.12)); }

.g-tut-img {
  width: min(220px, 45vw);
  border-radius: 20px;
  margin: 0 auto 1.2rem;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.25));
}

.g-tut-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: white;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
  margin: 0 0 0.3rem;
}

.g-tut-desc {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: rgba(255,255,255,0.85);
  margin: 0;
}

.g-dots {
  display: flex;
  gap: 10px;
  margin-top: 1.5rem;
}

.g-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: background 0.2s;
}

.g-dot.active {
  background: #ffcf33;
  box-shadow: 0 0 8px rgba(255,207,51,0.5);
}

/* ===== PLAY SCREEN ===== */
.g-play {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  padding: 10px 12px;
  gap: 8px;
}

.g-scores {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.g-team {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 6px 14px;
  text-align: center;
  color: white;
  min-width: 72px;
  transition: all 0.25s ease;
}

.g-team.active {
  background: rgba(255,207,51,0.2);
  border-color: #ffcf33;
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(255,207,51,0.2);
}

.g-team-name {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.g-team-score {
  display: block;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-weight: 900;
  line-height: 1.1;
}

.g-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: clamp(4px, 0.6vw, 8px);
  padding: 4px;
  min-height: 0;
}

.g-tile {
  border-radius: clamp(10px, 1.5vw, 18px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: clamp(0.9rem, 1.8vw, 1.6rem);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.g-tile-closed {
  background: linear-gradient(180deg, #ffe88a, #ffb52d);
  color: #7a5700;
  border: 2px solid rgba(255,200,0,0.3);
  box-shadow: 0 3px 12px rgba(255,181,45,0.25), inset 0 1px 0 rgba(255,255,255,0.5);
}

.g-tile-closed::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  border: 1px dashed rgba(255,185,0,0.35);
  pointer-events: none;
}

.g-tile-regular.resolved { background: linear-gradient(180deg, #ffd96e, #ffb52d); }
.g-tile-trap.resolved    { background: linear-gradient(180deg, #ff9474, #ef5b4a); }
.g-tile-speed.resolved   { background: linear-gradient(180deg, #63b8ff, #2167f3); }
.g-tile-clover.resolved  { background: linear-gradient(180deg, #49d173, #158d47); }

.g-tile.resolved {
  opacity: 0.25;
  border: none;
  box-shadow: none;
}

.g-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: rgba(255,255,255,0.06);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.g-turn {
  color: #ffcf33;
  font-size: clamp(1rem, 2.2vw, 1.6rem);
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(255,207,51,0.2);
}

.g-tiles-left {
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  font-weight: 700;
}

.g-timer {
  background: linear-gradient(180deg, #2fd667, #139442);
  color: white;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 900;
  padding: 6px 22px;
  border-radius: 14px;
  min-width: 70px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(47,214,103,0.3);
}

.g-timer.warning {
  background: linear-gradient(180deg, #ff7869, #d44033);
  box-shadow: 0 4px 16px rgba(255,120,105,0.4);
  animation: g-timer-pulse 0.5s ease-in-out infinite;
}

@keyframes g-timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ===== EVENT MODAL ===== */
.g-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 100;
  animation: g-fade-in 0.25s ease;
  padding: 16px;
}

@keyframes g-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.g-modal {
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(240,255,243,0.96));
  border-radius: 28px;
  padding: clamp(16px, 2.5vw, 28px);
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.3);
  animation: g-modal-in 0.3s ease;
  display: grid;
  gap: 14px;
}

@keyframes g-modal-in {
  from { transform: scale(0.92) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.g-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.g-modal-type {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  color: white;
  font-weight: 900;
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.g-type-regular { background: linear-gradient(180deg, #ffcf33, #ff9d00); }
.g-type-trap    { background: linear-gradient(180deg, #ff826c, #e14638); }
.g-type-speed   { background: linear-gradient(180deg, #56b2ff, #1b6fe2); }
.g-type-clover  { background: linear-gradient(180deg, #3dc96b, #14853b); }

.g-modal-team {
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  font-weight: 800;
  color: #14853b;
}

.g-modal-timer-badge {
  background: linear-gradient(180deg, #2fd667, #139442);
  color: white;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 900;
  padding: 8px 28px;
  border-radius: 18px;
  min-width: 80px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(47,214,103,0.35);
}

.g-modal-timer-badge.warning {
  background: linear-gradient(180deg, #ff7869, #d44033);
  box-shadow: 0 4px 18px rgba(255,100,80,0.4);
  animation: g-timer-pulse 0.5s ease-in-out infinite;
}

.g-modal-body {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(12px, 2vw, 20px);
  align-items: center;
  min-height: 0;
}

.g-modal-img {
  width: 100%;
  border-radius: 20px;
  aspect-ratio: 1;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.g-modal-question {
  font-size: clamp(1.3rem, 2.8vw, 2.2rem);
  font-weight: 900;
  color: #173124;
  margin: 0;
  line-height: 1.3;
}

.g-modal-action-label {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  color: #38614d;
  margin: 0.5rem 0 0;
  font-weight: 600;
}

/* ===== END SCREEN ===== */
.g-end .g-hero-img {
  width: min(220px, 30vw);
}

.g-end .g-title {
  font-size: clamp(2.5rem, 7vw, 5rem);
}

.g-winner-score {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: #ffcf33;
  margin: 0;
  text-shadow: 0 2px 10px rgba(255,207,51,0.3);
}

.g-final {
  display: grid;
  gap: 6px;
  width: min(400px, 85vw);
  margin-top: 1rem;
}

.g-final-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  font-weight: 700;
}

.g-final-row.winner {
  background: rgba(255,207,51,0.2);
  border: 2px solid rgba(255,207,51,0.4);
  color: #ffcf33;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .g-modal-body {
    grid-template-columns: 1fr;
  }
  .g-modal-img {
    max-height: 180px;
    aspect-ratio: 16/9;
  }
}

@media (max-height: 600px) {
  .g-play { padding: 6px 8px; gap: 4px; }
  .g-team { padding: 4px 10px; }
  .g-bottom { padding: 4px 12px; }
  .g-tut-img { width: min(150px, 30vw); }
}
