*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: #050816;
  color: white;
}

.hidden {
  display: none !important;
}

/* HEADER ------------------------------------------------------ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 16px 8px;
}

.logo-text {
  text-align: left;
}

.logo-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #4d8fff, #ffcc4d, #4d8fff);
  background-size: 200%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
  from { background-position: 0%; }
  to { background-position: 200%; }
}

.logo-subtitle {
  font-size: 0.95rem;
  color: #a9b8ff;
  margin-top: 4px;
}

.version-tag {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  margin-top: 4px;
  color: #6078c2;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.room-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(10, 15, 40, 0.9);
  border: 1px solid #28345f;
  color: #b5c5ff;
}

.user-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: #121937;
  border: 1px solid #33407d;
  color: #cfd7ff;
}

/* SIGNUP GATE ------------------------------------------------- */
.signup-gate {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.signup-card {
  margin-top: 8px;
  background: radial-gradient(circle at top, #151e48, #050816 70%);
  border-radius: 18px;
  padding: 24px 20px 20px;
  width: 380px;
  border: 1px solid #272f5a;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.signup-title {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.signup-subtitle {
  font-size: 0.9rem;
  color: #a9b8ff;
  margin-bottom: 18px;
}

.signup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.signup-note {
  font-size: 0.78rem;
  color: #8493d3;
}

/* MODALS ------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  margin: 80px auto 0;
  background: #0b1024;
  border-radius: 16px;
  border: 1px solid #2b3771;
  width: min(420px, calc(100% - 32px));
  padding: 22px 20px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: #96a4e0;
  cursor: pointer;
  font-size: 1.1rem;
}

.modal-content h2 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.modal-subtext {
  font-size: 0.85rem;
  color: #95a5ff;
  margin-bottom: 16px;
}

.modal-form label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  color: #aab7ff;
  margin-bottom: 10px;
}

.modal-form input {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #2e3d6c;
  background: #050816;
  color: #f2f4ff;
}

.modal-hint {
  font-size: 0.75rem;
  color: #7f8ed6;
  margin-top: 8px;
}

/* APP SHELL --------------------------------------------------- */
.app-shell {
  padding: 8px 16px 24px;
}

.top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-bottom: 18px;
}

/* LOBBY ------------------------------------------------------- */
.lobby-inner {
  background: #0d1430;
  padding: 16px 20px 20px;
  border-radius: 15px;
  width: 360px;
  border: 1px solid #1e2b4d;
  box-shadow: 0 0 12px #0007;
}

.lobby-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.lobby-row {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

.lobby-row input {
  flex: 1;
  background: #050816;
  border: 1px solid #2d3e6f;
  border-radius: 6px;
  padding: 10px;
  color: #d4dcff;
}

.room-code-display {
  background: #121a37;
  padding: 8px 14px;
  border-radius: 8px;
  color: #ffdc7a;
}

.lobby-status {
  font-size: 0.8rem;
  color: #8ea2d8;
  margin-top: 6px;
}

/* FRIENDS PANEL ----------------------------------------------- */
.panel {
  background: #0a0f24;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid #1c244b;
  box-shadow: 0 0 18px #0007;
}

.friends {
  width: 320px;
}

.panel-title {
  font-size: 1.1rem;
  margin-bottom: 10px;
  text-align: center;
}

.friend-section {
  margin-bottom: 10px;
}

.friend-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9db5ff;
  margin-bottom: 4px;
}

.friend-code-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #101735;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.friend-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.friend-add-row input {
  flex: 1;
  background: #050816;
  border: 1px solid #2d3e6f;
  border-radius: 6px;
  padding: 6px 8px;
  color: #d4dcff;
  font-size: 0.85rem;
}

.friend-error {
  font-size: 0.75rem;
  color: #ff7070;
  min-height: 16px;
  margin-top: 2px;
}

.friend-list {
  list-style: none;
  padding-left: 0;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.82rem;
}

.friend-list.empty {
  opacity: 0.8;
}

.friend-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.friend-name {
  color: #d6dfff;
}

.friend-buttons {
  display: flex;
  gap: 4px;
}

.empty-text {
  color: #7e8ac0;
}

/* MAIN GAME --------------------------------------------------- */
.main {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
  padding-top: 4px;
}

#drawPanel,
#guessPanel {
  width: 330px;
}

.prompt-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.prompt-label {
  font-size: 0.9rem;
  color: #9db5ff;
}

.prompt-word {
  color: #ffcc4d;
  font-weight: 600;
}

/* Canvas */
#pixelCanvas,
#guessCanvas {
  display: block;
  margin: 16px auto 12px;
  background: #050816;
  border-radius: 10px;
  border: 2px solid #2c3d76;
}

/* Palette */
.palette {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 6px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
}

.color-swatch.active {
  border-color: #ffffff;
}

.helper-text {
  font-size: 0.8rem;
  color: #9db5ff;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  border: none;
  font-size: 0.88rem;
}

.btn.primary {
  background: #4d6fff;
  color: white;
}

.btn.secondary {
  background: #1e2b4d;
  color: #9db5ff;
}

.btn.ghost {
  background: transparent;
  border: 1px solid #4d6fff;
  color: #9db5ff;
}

.btn.small {
  padding: 6px 10px;
  font-size: 0.78rem;
}

.full-width {
  width: 100%;
}

/* Guessing */
.guess-form {
  display: flex;
  gap: 8px;
}

.guess-form input {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  background: #050816;
  border: 1px solid #2e3d6c;
  color: white;
}

.feedback {
  min-height: 22px;
  margin: 10px 0;
}

.feedback.correct {
  color: #4ade80;
}

.feedback.wrong {
  color: #ff7070;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-pill {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #101735;
  border: 1px solid #29356b;
  color: #c0ceff;
}

.link-button {
  background: none;
  border: none;
  color: #8fb1ff;
  cursor: pointer;
  font-size: 0.8rem;
}

/* History */
.history-title {
  margin-top: 10px;
  font-size: 0.9rem;
}

.history-list {
  list-style: none;
  padding-left: 0;
  font-size: 0.8rem;
}

.history-list li {
  padding: 2px 0;
  color: #cbd5ff;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 18px;
  margin-bottom: 30px;
}
