* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.12), transparent 28rem),
    linear-gradient(180deg, #fbf7ef 0%, #f3f8ff 100%);
  color: #1f2933;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 680px;
}

.screen.active {
  display: block;
  animation: screenIn 220ms ease-out;
}

.card {
  width: 100%;
  padding: 32px;
  border: 1px solid #ddd6c8;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.12);
  backdrop-filter: blur(10px);
}

.entry-card {
  display: grid;
  gap: 0;
}

.master-login-card,
.master-home-card {
  padding: clamp(28px, 5vw, 46px);
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(2.3rem, 7vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro {
  max-width: 580px;
  margin: 0 0 28px;
  color: #667085;
  font-size: clamp(1.02rem, 2vw, 1.2rem);
  line-height: 1.5;
}

.helper-text {
  margin: -10px 0 18px;
  color: #667085;
  line-height: 1.45;
  font-size: 0.95rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  color: #667085;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid #ddd6c8;
  border-radius: 16px;
  background: #ffffff;
  color: #1f2933;
  font-size: 1.08rem;
  font-weight: 750;
}

#game-code {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 850;
}

input:focus {
  border-color: #2563eb;
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

button {
  width: 100%;
  min-height: 58px;
  padding: 13px 16px;
  border: 0;
  border-radius: 16px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 850;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

button:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.18);
}

button:active {
  transform: translateY(1px);
}

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

.secondary-button {
  border: 1px solid #ddd6c8;
  background: #ffffff;
  color: #1f2933;
}

.back-button {
  width: auto;
  min-height: 0;
  justify-self: start;
  margin-bottom: 22px;
  padding: 8px 12px;
  border: 1px solid #ddd6c8;
  background: #ffffff;
  color: #1f2933;
  font-size: 0.9rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: #667085;
  font-size: 0.9rem;
  font-weight: 700;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #ddd6c8;
}

.master-hub-grid {
  display: grid;
  gap: 14px;
}

.hub-button {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 22px;
  border: 1px solid #ddd6c8;
  border-radius: 18px;
  background: #ffffff;
  color: #1f2933;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.hub-button:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 14px 32px rgba(31, 41, 51, 0.12);
}

.hub-button strong {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.1;
}

.hub-button span {
  color: #667085;
  font-size: 1rem;
  font-weight: 750;
}

.hub-button-primary {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.role-grid,
.player-list {
  display: grid;
  gap: 12px;
}

.role-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #ddd6c8;
  background: #ffffff;
  color: #1f2933;
  text-align: left;
}

.role-button span {
  font-weight: 850;
}

.role-button small {
  color: #667085;
  font-weight: 650;
}

.role-button::after {
  content: "->";
  margin-left: auto;
  font-weight: 900;
}

.player-button {
  border: 1px solid #ddd6c8;
  background: #ffffff;
  color: #1f2933;
  text-align: left;
}

.player-button small {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-weight: 500;
}

.game-code-box,
.status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 15px;
  border: 1px solid #ddd6c8;
  border-radius: 12px;
  background: #ffffff;
}

.game-code-box span,
.status-box span {
  color: #667085;
}

.game-code-box strong,
.status-box strong {
  text-align: right;
}

.error-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: #b91c1c;
  font-weight: 700;
}

.success-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: #15803d;
  font-weight: 700;
}

.legacy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0 auto;
  color: #667085;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.legacy-link-large {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #ddd6c8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.legacy-link:hover {
  color: #1d4ed8;
  border-color: #93c5fd;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #ddd6c8;
  border-radius: 12px;
  background: #ffffff;
  color: #667085;
  text-align: center;
  font-weight: 750;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 520px) {
  .app {
    align-items: flex-start;
    padding: 12px 10px 120px;
  }

  .card {
    padding: 20px;
    border-radius: 18px;
  }

  h1 {
    font-size: 2.2rem;
  }

  button,
  input {
    min-height: 52px;
  }

  .hub-button {
    min-height: 96px;
    padding: 18px;
  }
}
