/* ==============================================================
   Photographic Memory Battle — Home / Mode Selection Page
   ============================================================== */

:root {
  --pmh-bg: #111111;
  --pmh-card: #1f1f1f;
  --pmh-card-raised: #262626;
  --pmh-highlight: #58dbe8;
  --pmh-text: #f2f2f2;
  --pmh-text-muted: #9a9a9a;
  --pmh-border: #2c2c2c;
  --pmh-easy: #37d67a;
  --pmh-medium: #f5c542;
  --pmh-hard: #ff5c5c;
}

.pmh-root {
  position: relative;
  min-height: 100vh;
  background: var(--pmh-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: hidden;
  font-family: "Segoe UI", Roboto, sans-serif;
  color: var(--pmh-text);
}

/* ---------------- Ambient background cubes ----------------
   A quiet visual echo of the in-game grid — the one
   signature touch on an otherwise disciplined page. */

.pmh-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.pmh-floating-cube {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(88, 219, 232, 0.06);
  border: 1px solid rgba(88, 219, 232, 0.12);
  animation: pmh-float 9s ease-in-out infinite;
}

.c1 { top: 12%; left: 8%;  width: 44px; height: 44px; animation-delay: 0s; }
.c2 { top: 68%; left: 5%;  width: 26px; height: 26px; animation-delay: 1.4s; }
.c3 { top: 22%; left: 88%; width: 30px; height: 30px; animation-delay: 2.6s; }
.c4 { top: 75%; left: 90%; width: 40px; height: 40px; animation-delay: 0.8s; }
.c5 { top: 48%; left: 3%;  width: 18px; height: 18px; animation-delay: 3.4s; }
.c6 { top: 85%; left: 45%; width: 22px; height: 22px; animation-delay: 2s; }

@keyframes pmh-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  50%      { transform: translateY(-18px) rotate(6deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pmh-floating-cube { animation: none; }
}

/* ---------------- Card ---------------- */

.pmh-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--pmh-card);
  border: 1px solid var(--pmh-border);
  border-radius: 22px;
  padding: 40px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.pmh-header {
  text-align: center;
  margin-bottom: 30px;
}

.pmh-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

.pmh-title-icon {
  display: inline-block;
  filter: drop-shadow(0 0 10px rgba(88, 219, 232, 0.5));
}

.pmh-subtitle {
  color: var(--pmh-text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0;
}

/* ---------------- Difficulty selector ---------------- */

.pmh-difficulty-section {
  margin-bottom: 30px;
}

.pmh-section-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pmh-text-muted);
  margin-bottom: 12px;
  text-align: center;
}

.pmh-difficulty-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pmh-diff-btn {
  background: #262626;
  border: 1.5px solid var(--pmh-border);
  border-radius: 14px;
  padding: 12px 8px;
  color: var(--pmh-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.15s ease, background-color 0.18s ease;
}

.pmh-diff-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(88, 219, 232, 0.4);
}

.pmh-diff-btn.active {
  border-color: var(--pmh-highlight);
  background: rgba(88, 219, 232, 0.08);
}

.pmh-diff-name {
  font-weight: 700;
  font-size: 14px;
}

.pmh-diff-btn[data-difficulty="easy"].active .pmh-diff-name { color: var(--pmh-easy); }
.pmh-diff-btn[data-difficulty="medium"].active .pmh-diff-name { color: var(--pmh-medium); }
.pmh-diff-btn[data-difficulty="hard"].active .pmh-diff-name { color: var(--pmh-hard); }

.pmh-diff-meta {
  font-size: 10.5px;
  color: var(--pmh-text-muted);
  text-align: center;
}

/* ---------------- Mode buttons ---------------- */

.pmh-mode-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pmh-mode-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--pmh-card-raised);
  border: 1.5px solid var(--pmh-border);
  border-radius: 16px;
  padding: 14px 18px;
  color: var(--pmh-text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.18s ease, box-shadow 0.2s ease;
}

.pmh-mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.pmh-mode-solo:hover  { border-color: rgba(88, 219, 232, 0.5); }
.pmh-mode-invite:hover { border-color: rgba(55, 214, 122, 0.5); }
.pmh-mode-join:hover  { border-color: rgba(245, 197, 66, 0.5); }

.pmh-mode-icon {
  font-size: 24px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #1c1c1c;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pmh-mode-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.pmh-mode-text strong {
  font-size: 15.5px;
}

.pmh-mode-text small {
  color: var(--pmh-text-muted);
  font-size: 12.5px;
}

.pmh-mode-arrow {
  color: var(--pmh-text-muted);
  font-size: 18px;
  transition: transform 0.15s ease;
}

.pmh-mode-btn:hover .pmh-mode-arrow {
  transform: translateX(4px);
  color: var(--pmh-highlight);
}

/* ---------------- Modals ---------------- */

.pmh-modal-content {
  background: var(--pmh-card);
  border: 1px solid var(--pmh-border);
  border-radius: 18px;
  color: var(--pmh-text);
}

.pmh-modal-header {
  border-bottom: 1px solid var(--pmh-border);
}

.pmh-modal-sub {
  color: var(--pmh-text-muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.pmh-modal-difficulty {
  color: var(--pmh-highlight);
  font-weight: 700;
}

.pmh-modal-text {
  font-size: 14px;
  color: var(--pmh-text-muted);
  margin-bottom: 20px;
}

.pmh-btn-round {
  border-radius: 30px;
  padding: 9px 28px;
  font-weight: 600;
}

.pmh-hidden {
  display: none !important;
}

/* Room code display */

.pmh-room-code {
  display: block;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--pmh-highlight);
  background: #161616;
  border: 1px dashed rgba(88, 219, 232, 0.4);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.pmh-copy-btn {
  margin-bottom: 22px;
}

.pmh-waiting-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--pmh-text-muted);
  font-size: 13.5px;
}

.pmh-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(88, 219, 232, 0.25);
  border-top-color: var(--pmh-highlight);
  border-radius: 50%;
  animation: pmh-spin 0.8s linear infinite;
}

@keyframes pmh-spin {
  to { transform: rotate(360deg); }
}

/* Join code input */

.pmh-code-input {
  width: 100%;
  background: #161616;
  border: 1.5px solid var(--pmh-border);
  border-radius: 12px;
  padding: 14px;
  color: var(--pmh-text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.15s ease;
}

.pmh-code-input:focus {
  border-color: var(--pmh-highlight);
}

.pmh-join-error {
  color: var(--pmh-hard);
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 480px) {
  .pmh-card {
    padding: 30px 20px;
    border-radius: 18px;
  }
  .pmh-title { font-size: 23px; }
  .pmh-diff-name { font-size: 12.5px; }
  .pmh-diff-meta { font-size: 9.5px; }
  .pmh-mode-icon { width: 36px; height: 36px; font-size: 20px; }
  .pmh-mode-text strong { font-size: 14px; }
  .pmh-room-code { font-size: 26px; }
}
