:root {
  --font-title: "Baloo 2", "Comic Sans MS", "Trebuchet MS", cursive;
  --font-body: "Nunito", "Verdana", sans-serif;
  --bg: #fff4f8;
  --bg-accent: #ffe2ef;
  --panel: #ffffff;
  --text: #2b2b2b;
  --primary: #ff6aa2;
  --secondary: #ffb347;
  --highlight: #7ed0ff;
  --shadow: rgba(0, 0, 0, 0.08);
}

body[data-theme="bluish"] {
  --bg: #f2fbff;
  --bg-accent: #dff2ff;
  --panel: #ffffff;
  --text: #1b2a3a;
  --primary: #3aa7ff;
  --secondary: #7ee081;
  --highlight: #ffd166;
  --shadow: rgba(15, 50, 90, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-accent), var(--bg));
  min-height: 100vh;
}

body.flash-win {
  animation: win-flash 2s ease-in-out;
}

#logo {
  height: 7rem;
  float: left;
}
@keyframes win-flash {
  0%,
  100% {
    background: radial-gradient(circle at top, var(--bg-accent), var(--bg));
  }
  20%,
  60% {
    background:
      radial-gradient(circle at top, var(--bg-accent), var(--bg)),
      radial-gradient(circle at center, rgba(255, 215, 102, 0.35), rgba(255, 215, 102, 0));
  }
  40%,
  80% {
    background: radial-gradient(circle at top, var(--bg-accent), var(--bg));
  }
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px var(--shadow);
}

.logo {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  background: var(--panel);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 16px var(--shadow);
}

.page {
  padding: 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  align-items: center;
}

.hero-card {
  background: var(--panel);
  padding: 32px;
  border-radius: 24px;
  box-shadow: 0 18px 40px var(--shadow);
}

.hero-card h1 {
  font-family: var(--font-title);
  font-size: 2.4rem;
  margin-top: 0;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-art {
  position: relative;
  min-height: 240px;
}

.star-burst {
  width: 180px;
  height: 180px;
  background: var(--primary);
  border-radius: 30% 70% 65% 35% / 40% 35% 65% 60%;
  position: absolute;
  top: 20px;
  right: 20px;
  opacity: 0.85;
}

.bubble {
  width: 140px;
  height: 140px;
  background: var(--highlight);
  border-radius: 50%;
  position: absolute;
  bottom: 10px;
  left: 40px;
  opacity: 0.8;
}

.bubble.small {
  width: 60px;
  height: 60px;
  bottom: 120px;
  left: 0;
  background: var(--secondary);
}

.feature-grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--panel);
  padding: 18px 20px;
  border-radius: 18px;
  box-shadow: 0 12px 30px var(--shadow);
}

.panel {
  background: var(--panel);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 16px 40px var(--shadow);
  margin-bottom: 24px;
}

.form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input {
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #f8f8ff;
  font-size: 1rem;
}

input:focus {
  border-color: var(--primary);
  outline: none;
}

.primary-btn,
.ghost-btn,
.theme-toggle {
  border: none;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 18px;
  text-decoration: none;
  border-radius: 14px;
  font-family: var(--font-body);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 24px var(--shadow);
}

.primary-btn:hover,
.ghost-btn:hover,
.theme-toggle:hover {
  transform: translateY(-2px);
}

.primary-btn.small,
.ghost-btn.small {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.ghost-btn,
.theme-toggle {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 8px 18px var(--shadow);
}

.hint {
  margin-top: 12px;
  color: rgba(0, 0, 0, 0.55);
}

.dashboard {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.friends-list {
  display: grid;
  gap: 12px;
}

.friend-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fdf7ff;
}

body[data-theme="bluish"] .friend-card {
  background: #f2faff;
}

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

.presence {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.presence.online {
  background: rgba(126, 224, 129, 0.25);
  color: #2f7a39;
}

.presence.offline {
  background: rgba(0, 0, 0, 0.1);
  color: #555;
}

.invite-link {
  margin-top: 12px;
  word-break: break-all;
  background: #f5f5ff;
  padding: 12px;
  border-radius: 12px;
}

.toast {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
}

.toast.show {
  display: flex;
}

.toast-card {
  background: var(--panel);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 20px 40px var(--shadow);
  text-align: center;
}

.toast-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.rps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

#game-area.firework-flash {
  background: var(--panel);
  animation: red-blink 0.8s steps(2, end) infinite;
}

@keyframes red-blink {
  0%,
  100% {
    box-shadow: 0 16px 40px var(--shadow);
    background: var(--panel);
  }
  50% {
    box-shadow: 0 20px 44px rgba(220, 38, 38, 0.45);
    background: rgba(220, 38, 38, 0.18);
  }
}

.rps-actions {
  margin-top: 8px;
}

.move-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.move-choice {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  background: var(--secondary);
  padding: 1px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--shadow);
  transition: transform 0.15s ease;
}

.move-choice:hover,
.move-choice:focus {
  transform: translateY(-5px);
  outline: none;
}

.round-result {
  margin-top: 16px;
  border-radius: 18px;
}

.round-boxes {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.round-box {
  background: var(--panel);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 12px 28px var(--shadow);
  text-align: center;
}

.round-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.round-choice {
  position: relative;
  min-height: 120px;
  display: grid;
  place-items: center;
  background: var(--bg-accent);
  border-radius: 14px;
  padding: 12px;
}

.round-image {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: none;
}

.round-image.is-visible {
  display: block;
}

.round-placeholder {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
}

.round-placeholder.is-hidden {
  display: none;
}

.round-message {
  margin-top: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.scoreboard {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  background: #fef6eb;
  padding: 8px 12px;
  border-radius: 12px;
}

.chat-panel {
  display: grid;
  gap: 12px;
}

.chat-log {
  max-height: 280px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 6px;
}

.chat-item {
  background: #f4f4ff;
  padding: 8px 10px;
  border-radius: 10px;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.flash {
  margin: 16px auto 0;
  max-width: 900px;
  padding: 12px 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 30px var(--shadow);
}

.flash.success {
  border-left: 6px solid #7ee081;
}

.flash.error {
  border-left: 6px solid #ff6a6a;
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    gap: 12px;
  }

  .page {
    padding: 20px;
  }

  .round-boxes {
    gap: 10px;
  }
}
