:root {
  color-scheme: light;
  --snap-blue: #315ef4;
  --snap-blue-dark: #2447bc;
  --snap-red: #eb001f;
  --snap-bg: #e8eeff;
  --snap-gray: #f3f4f6;
  --snap-surface: #ffffff;
  --snap-ink: #191b23;
  --snap-muted: #5f6678;
  --snap-line: #d8deea;
  --snap-soft-blue: #dfe7ff;
  --snap-danger: #cf5a35;
  --snap-green: #13a878;
  --shadow: 0 18px 60px rgba(38, 55, 105, 0.14);
  --shadow-strong: 0 24px 70px rgba(34, 53, 105, 0.2);
  --header-height: 82px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--snap-ink);
  background: linear-gradient(180deg, var(--snap-bg) 0%, #f8f9fd 42%, #ffffff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 16%, rgba(255, 255, 255, 0.72), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.55), transparent 28%);
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  color: var(--snap-blue-dark);
  overflow-wrap: anywhere;
}

.site-header,
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-height);
  padding: 18px clamp(18px, 5vw, 64px);
  background: rgba(232, 238, 255, 0.86);
  border-bottom: 1px solid rgba(216, 222, 234, 0.72);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--snap-blue);
  background: var(--snap-gray);
  border: 1px solid rgba(216, 222, 234, 0.86);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 900;
}

.brand-logo {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.brand .muted {
  flex-basis: 100%;
  margin-left: 68px;
  color: var(--snap-muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.auth-shell {
  width: min(1180px, calc(100% - 36px));
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  align-items: center;
  gap: clamp(30px, 6vw, 78px);
  padding: clamp(34px, 7vh, 76px) 0;
}

.auth-shell.auth-only {
  width: min(420px, calc(100% - 64px));
  grid-template-columns: 1fr;
  justify-items: stretch;
}

.auth-copy {
  max-width: 690px;
  min-width: 0;
}

.panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--snap-line);
  border-radius: 12px;
  padding: clamp(18px, 4vw, 32px);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: 100%;
}

.auth-only .auth-panel {
  justify-self: center;
  max-width: 420px;
  min-height: 536px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(2.55rem, 6.2vw, 5.05rem);
  line-height: 1;
  overflow-wrap: break-word;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 3.5vw, 2.75rem);
  line-height: 1.04;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.lead {
  max-width: 650px;
  color: var(--snap-muted);
  font-size: clamp(1.05rem, 2vw, 1.24rem);
  line-height: 1.65;
  overflow-wrap: break-word;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--snap-blue);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  color: var(--snap-muted);
}

.center {
  text-align: center;
}

.hidden {
  display: none !important;
}

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

.quick-strip div,
.result-card,
.winner-strip,
.room-code-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--snap-line);
  border-radius: 8px;
}

.quick-strip strong {
  display: block;
  margin-bottom: 6px;
}

.quick-strip span,
.winner-strip,
.result-card p {
  color: var(--snap-muted);
  line-height: 1.45;
}

.stack,
.controls,
.room-form {
  display: grid;
  gap: 14px;
}

.auth-forms {
  min-height: 258px;
}

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

.split {
  justify-content: space-between;
}

label {
  display: grid;
  gap: 7px;
  color: var(--snap-ink);
  font-weight: 800;
}

.floating-field {
  position: relative;
  display: block;
}

.floating-field input {
  min-height: 56px;
  padding: 18px 14px 6px;
}

.password-field input {
  padding-right: 54px;
}

.floating-field span {
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--snap-muted);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
  transition: top 0.16s ease, color 0.16s ease, font-size 0.16s ease, transform 0.16s ease;
}

.floating-field input:focus + span,
.floating-field input:not(:placeholder-shown) + span {
  top: 9px;
  color: var(--snap-blue);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: translateY(0);
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  color: var(--snap-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  transform: translateY(-50%);
}

.password-toggle::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 23px;
  background: currentColor;
  border-radius: 999px;
  opacity: 0;
  transform: rotate(45deg) scaleY(0.7);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.password-toggle:hover,
.password-toggle.active {
  color: var(--snap-blue);
  background: var(--snap-soft-blue);
}

.password-toggle.active::after {
  opacity: 1;
  transform: rotate(45deg) scaleY(1);
}

.password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--snap-line);
  border-radius: 8px;
  background: var(--snap-surface);
  color: var(--snap-ink);
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--snap-blue);
  box-shadow: 0 0 0 4px rgba(49, 94, 244, 0.12);
}

button,
.ghost-link {
  max-width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary {
  color: #ffffff;
  background: var(--snap-blue);
  box-shadow: 0 14px 30px rgba(49, 94, 244, 0.18);
}

.primary:hover {
  background: var(--snap-blue-dark);
}

.ghost,
.tab,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--snap-blue-dark);
  background: var(--snap-surface);
  border-color: var(--snap-line);
}

.warning {
  color: #704c00;
  background: #fff2c9;
}

.danger {
  color: #ffffff;
  background: var(--snap-danger);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 100%;
  gap: 8px;
  margin: 22px 0;
  padding: 4px;
  background: var(--snap-gray);
  border: 1px solid var(--snap-line);
  border-radius: 10px;
}

.tab {
  min-height: 42px;
  background: transparent;
  color: var(--snap-muted);
  border-color: transparent;
}

.tab.active {
  color: var(--snap-blue-dark);
  background: var(--snap-surface);
  border-color: var(--snap-line);
  box-shadow: 0 10px 26px rgba(38, 55, 105, 0.08);
}

.message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--snap-danger);
  line-height: 1.45;
}

.message.good {
  color: var(--snap-green);
}

.app-grid,
.admin-layout {
  display: grid;
  gap: 18px;
  width: min(1180px, calc(100% - 36px));
  margin: 24px auto 44px;
}

.admin-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.room-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.room-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--snap-soft-blue);
  color: var(--snap-blue-dark);
  font-weight: 900;
}

.game-panel {
  display: grid;
  gap: 18px;
}

.countdown {
  display: grid;
  place-items: center;
  min-height: 132px;
  border-radius: 12px;
  background: var(--snap-soft-blue);
  color: var(--snap-blue);
  font-size: clamp(4rem, 18vw, 10rem);
  font-weight: 1000;
  line-height: 1;
}

.countdown.small {
  min-height: 84px;
  font-size: clamp(2.5rem, 8vw, 5rem);
}

.click-button {
  min-height: clamp(96px, 18vw, 180px);
  border-radius: 14px;
  background: var(--snap-blue);
  color: white;
  font-size: clamp(2.5rem, 10vw, 7rem);
  box-shadow: 0 20px 60px rgba(49, 94, 244, 0.2);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.click-button:not(:disabled):active {
  transform: scale(0.97);
  filter: brightness(1.08);
}

.winner-strip {
  color: var(--snap-blue-dark);
  font-weight: 800;
}

.room-code-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.room-code-card strong {
  font-size: 1.6rem;
  letter-spacing: 0.12em;
}

.uid-line {
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--snap-line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--snap-muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .quick-strip,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  :root {
    --header-height: 70px;
  }

  .site-header,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding: 14px 12px;
  }

  .brand {
    font-size: 1.35rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand .muted {
    margin-left: 56px;
  }

  .auth-shell,
  .app-grid,
  .admin-layout {
    width: min(100% - 24px, 1180px);
  }

  .auth-shell.auth-only {
    width: 100%;
    padding-inline: 24px;
  }

  .auth-only .auth-panel {
    max-width: 280px;
    min-height: 538px;
  }

  .room-form,
  .room-code-card {
    grid-template-columns: 1fr;
  }

  .row.split {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(1.9rem, 8vw, 2.3rem);
    line-height: 1.08;
  }

  .lead {
    max-width: 31ch;
    font-size: 1rem;
  }

  h2 {
    font-size: clamp(1.65rem, 8vw, 2.2rem);
  }

  .auth-panel h2 {
    font-size: 1.75rem;
  }
}
