:root {
  --primary-blue: #2563eb;
  --primary-blue-dark: #1d4ed8;
  --primary-blue-light: #3b82f6;
  --card-bg: #ffffff;
  --card-border: rgba(255, 255, 255, 0.9);
  --input-bg: #f8f7fb;
  --input-border: #e2e0eb;
  --text-main: #1e293b;
  --text-muted: #94a3b8;
  --error: #ef4444;
  --success: #10b981;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Inter", "Segoe UI", Roboto, sans-serif;
  background: #0d2859 url('/login-bg.webp') center center / cover no-repeat fixed;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
}

/* Ambient glow overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 25%, rgba(37, 99, 235, 0.28) 0%, rgba(6, 18, 48, 0.82) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}

/* Languages Floating Pill at Top-Right */
.langs {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.lang {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  min-height: auto;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: auto;
}

.lang svg {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.lang[aria-checked="true"] {
  background: #ffffff;
  color: var(--primary-blue-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Main Container */
.app {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 430px;
  padding: 24px 16px 40px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Legacy hero hidden in favor of card-hero */
.hero {
  display: none;
}

/* 3D Neumorphic White Card */
.sheet {
  width: 100%;
  background: var(--card-bg);
  border-radius: 36px;
  box-shadow: 0 35px 85px -15px rgba(5, 18, 50, 0.65),
              0 0 0 1px var(--card-border),
              inset 0 2px 0 rgba(255, 255, 255, 1);
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
}

/* Top Hero Illustration */
.card-hero {
  width: 100%;
  position: relative;
  display: block;
  overflow: hidden;
  background: #fdfdfe;
  border-radius: 36px 36px 0 0;
}

.card-hero img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}

.card-hero-overlay {
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  padding: 0 16px;
}

.card-hero-title {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  color: #1a56db;
  letter-spacing: -0.5px;
  line-height: 1.15;
  text-shadow: 0 2px 6px rgba(26, 86, 219, 0.18);
  font-family: inherit;
  transition: all 0.25s ease;
}

.card-hero-sub {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.25;
  font-family: inherit;
  transition: all 0.25s ease;
}

@media (max-width: 420px) {
  .card-hero-title {
    font-size: 21px;
  }
  .card-hero-sub {
    font-size: 12px;
    margin-top: 3px;
  }
}

/* Form Section */
#entry {
  padding: 18px 26px 28px;
  background: #ffffff;
}

/* Subtle tab switch (kept for functional compatibility) */
.tabs {
  display: none;
}

h2#entry-title {
  display: none;
}

/* Field Pills with 3D Blue Left Badges */
.field-pill {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 999px;
  padding: 5px 16px 5px 6px;
  margin-bottom: 15px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.field-pill:focus-within {
  border-color: var(--primary-blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.field-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue-light) 0%, var(--primary-blue-dark) 100%);
  display: grid;
  place-items: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.32);
}

.field-pill input,
.field-pill select {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  padding: 0 12px;
  font-size: 15.5px;
  font-weight: 550;
  color: var(--text-main);
  min-height: 44px;
  width: 100%;
}

.field-pill input::placeholder {
  color: var(--text-muted);
  font-weight: 450;
}

.pw-toggle {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 6px;
  width: auto;
  min-height: auto;
  border-radius: 50%;
  transition: color 0.15s;
}

.pw-toggle:hover,
.pw-toggle.on {
  color: var(--primary-blue);
}

/* Forgot Password Row */
.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 8px 18px;
}

.forgot-link {
  color: var(--primary-blue);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s;
}

.forgot-link:hover {
  color: var(--primary-blue-dark);
  text-decoration: underline;
}

/* 3D Blue Glossy Action Button */
.btn-primary-3d {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 750;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.55),
              inset 0 2px 2px rgba(255, 255, 255, 0.4),
              inset 0 -2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 12px 24px;
}

.btn-primary-3d:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px -6px rgba(37, 99, 235, 0.65),
              inset 0 2px 2px rgba(255, 255, 255, 0.45),
              inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.btn-primary-3d:active {
  transform: translateY(1px);
  box-shadow: 0 6px 14px -4px rgba(37, 99, 235, 0.5),
              inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-primary-3d:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* 3D Divider */
.divider-3d {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 22px 0 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 550;
}

.divider-3d::before,
.divider-3d::after {
  content: "";
  flex: 1;
  border-bottom: 1.5px solid #e2e8f0;
}

.divider-3d span {
  padding: 0 14px;
}

/* 3D Social Buttons Row */
.social-row-3d {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 22px;
}

.social-btn-3d {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #edf0f5;
  box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.08),
              0 2px 4px rgba(0, 0, 0, 0.04),
              inset 0 2px 0 rgba(255, 255, 255, 1);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

.social-btn-3d:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.12);
}

.social-btn-3d:active {
  transform: translateY(1px) scale(0.98);
}

/* Auth Switcher Footer */
.switch-footer {
  text-align: center;
  font-size: 14px;
  color: #64748b;
  font-weight: 550;
}

.switch-link {
  background: none;
  border: 0;
  color: var(--primary-blue);
  font-weight: 750;
  cursor: pointer;
  padding: 0 0 0 5px;
  font-size: 14px;
  display: inline;
  width: auto;
  min-height: auto;
  text-decoration: none;
}

.switch-link:hover {
  text-decoration: underline;
  color: var(--primary-blue-dark);
}

/* Registration Extra Elements */
.entry-agreement {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 6px 4px 16px;
  font-size: 13px;
  line-height: 1.4;
  color: #64748b;
}

.entry-agreement input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-blue);
  flex-shrink: 0;
  cursor: pointer;
}

.entry-agreement a {
  color: var(--primary-blue);
  font-weight: 700;
  text-decoration: none;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 6px 16px;
  line-height: 1.5;
}

/* Notice / Error Toast */
#notice {
  margin: 0;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 600;
}

#notice:not(:empty) {
  margin-top: 16px;
  padding: 12px 16px;
  background: #eff6ff;
  color: var(--primary-blue-dark);
  border-radius: 12px;
  border: 1px solid #bfdbfe;
}

#notice.error {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

/* Welcome Dialog */
.welcome {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.welcome-card {
  background: #ffffff;
  border-radius: 28px;
  padding: 30px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}

.welcome-card p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 20px;
  line-height: 1.5;
}

.welcome-card button {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
}

/* Signed-in Lobby Styles */
#signed-in {
  padding: 24px;
}

.lb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.lb-brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-blue-dark);
}

.lb-tool {
  background: #f1f5f9;
  border: 0;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  cursor: pointer;
  width: auto;
  min-height: auto;
}

.lb-top {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.lb-user {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: #cbd5e1;
  cursor: pointer;
  flex-shrink: 0;
}

.lb-user img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lb-user .lb-plus {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 20px;
}

.lb-user:hover .lb-plus {
  opacity: 1;
}

.lb-id {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lb-name {
  font-size: 17px;
  font-weight: 750;
  color: var(--text-main);
}

.lb-online {
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lb-online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.lb-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-blue-dark);
}

.lb-exit {
  background: transparent;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  width: auto;
  min-height: auto;
}

.lb-exit:hover {
  color: #ef4444;
}

.lb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.lb-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.lb-games {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.lb-game {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  box-shadow: 0 10px 25px -5px rgba(23, 37, 84, 0.4);
}

.lb-art img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.lb-game-name {
  font-size: 17px;
  font-weight: 750;
}

.lb-legal {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.lb-legal button {
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  width: auto;
  min-height: auto;
}

/* Footer note */
.foot {
  display: none;
}

[hidden] {
  display: none !important;
}
