/* ==========================================================================
   Hangman v2 — Daniel.tf
   Dark glass theme that matches the main site.
   ========================================================================== */

:root {
  --bg: #05060c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4fb;
  --text-soft: rgba(238, 238, 255, 0.72);
  --text-muted: rgba(226, 226, 245, 0.52);
  --violet: #9f91ff;
  --teal: #5eead4;
  --rose: #fb7185;
  --radius-lg: 22px;
  --radius-md: 13px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: 0 1.5rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--violet);
  text-decoration: none;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

a:hover {
  color: #fff;
  text-decoration: underline;
}

::selection {
  background: rgba(159, 145, 255, 0.35);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: #0b0c16;
  font-size: 0.85rem;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* Ambient backdrop */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  will-change: transform;
}

.orb-one {
  top: -30rem;
  left: 50%;
  width: 48rem;
  height: 48rem;
  margin-left: -30rem;
  background: radial-gradient(circle, rgba(116, 96, 245, 0.55), transparent 68%);
  animation: drift 22s ease-in-out infinite;
}

.orb-two {
  right: -16rem;
  bottom: -20rem;
  width: 38rem;
  height: 38rem;
  background: radial-gradient(circle, rgba(0, 190, 150, 0.28), transparent 68%);
  animation: drift 28s ease-in-out infinite reverse;
}

.orb-three {
  bottom: 8%;
  left: -16rem;
  width: 30rem;
  height: 30rem;
  background: radial-gradient(circle, rgba(56, 132, 255, 0.24), transparent 68%);
  animation: drift 34s ease-in-out infinite;
  animation-delay: -8s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 75% 60% at 50% 25%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(
    ellipse 75% 60% at 50% 25%,
    #000 0%,
    transparent 78%
  );
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2.5rem, 1.75rem, 0) scale(1.08);
  }
}

/* Top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(5, 6, 12, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--violet) 0%, #5b8def 60%, var(--teal) 130%);
  color: #0a0918;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 18px -6px rgba(124, 108, 240, 0.8);
}

.brand-name {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand-dot {
  color: var(--violet);
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 550;
  text-decoration: none;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.topbar-link svg {
  width: 0.85rem;
  height: 0.85rem;
}

.topbar-link:hover {
  transform: translateX(-2px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  text-decoration: none;
}

/* Layout */
.v2-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding-top: clamp(7rem, 14vh, 9rem);
  animation: rise 0.8s var(--ease) backwards;
}

.page-head {
  margin-bottom: 2rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(159, 145, 255, 0.26);
  border-radius: var(--radius-pill);
  background: rgba(159, 145, 255, 0.08);
  color: #cec7ff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.eyebrow .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--violet);
}

h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  text-wrap: balance;
  background: linear-gradient(180deg, #ffffff 10%, #ded9ff 52%, #a99cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.page-head h1 {
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  line-height: 1;
}

h2 {
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 650;
}

p {
  margin-bottom: 1rem;
  color: var(--text-soft);
  font-size: 0.98rem;
}

.page-sub {
  max-width: 30rem;
  margin: 0.9rem auto 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.6;
}

ul {
  padding-left: 0;
  margin-bottom: 1.25rem;
  list-style: none;
}

li {
  margin-bottom: 0.5rem;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

strong {
  color: var(--text);
}

/* Forms become glass cards */
form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.5rem;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 150% at 50% 0%, rgba(159, 145, 255, 0.1), transparent 55%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
    rgba(10, 12, 23, 0.58);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 80px -40px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

label {
  display: block;
  margin-bottom: -0.35rem;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  transition:
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(159, 145, 255, 0.6);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 4px rgba(159, 145, 255, 0.12);
}

/* Buttons */
button,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  align-self: flex-start;
  width: auto;
  padding: 0.8rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #8b7cff 0%, #6d5ce8 55%, #5b7cf0 100%);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.24) inset,
    0 14px 34px -14px rgba(124, 108, 240, 0.9);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease),
    background-color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    color 0.25s var(--ease);
}

button:hover,
input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 20px 42px -14px rgba(124, 108, 240, 1);
}

button:active,
input[type="submit"]:active {
  transform: translateY(0) scale(0.99);
}

/* Secondary buttons inside the player list */
#player-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
  min-height: 0.5rem;
}

#player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 0.9rem;
}

#player-list li button {
  align-self: auto;
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
  font-size: 0.76rem;
  box-shadow: none;
}

#player-list li button:hover {
  transform: none;
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.18);
  box-shadow: none;
}

/* Shared room link */
.v2-shell a {
  word-break: break-word;
}

/* Messages */
.v2-shell > p {
  text-align: center;
}

/* Footer */
.credits {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.credits p {
  margin: 0;
  color: var(--text-muted);
  font-size: inherit;
}

.credits a {
  color: var(--violet);
  font-weight: 550;
  text-decoration: none;
}

.credits a:hover {
  color: #fff;
  text-decoration: underline;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 560px) {
  body.page {
    padding-right: 1.1rem;
    padding-left: 1.1rem;
  }

  .topbar {
    padding: 0.8rem 1.1rem;
  }

  .topbar-link span {
    display: none;
  }

  .v2-shell {
    padding-top: 6.5rem;
  }

  button,
  input[type="submit"] {
    width: 100%;
    align-self: stretch;
  }

  #player-list li button {
    width: auto;
    align-self: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
