:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e2e8f0;
}

.lm-standalone {
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
}

.lm-shell {
  min-height: 0;
  padding: 0;
}

.lm-standalone .lm-shell {
  min-height: 100vh;
  padding: 18px;
}

.lm-app {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 0 28px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background:
    radial-gradient(circle at 17% 16%, rgba(59, 130, 246, 0.2), transparent 34%),
    radial-gradient(circle at 84% 14%, rgba(236, 72, 153, 0.16), transparent 36%),
    linear-gradient(180deg, #0b1225 0%, #172554 100%);
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.55);
}

.lm-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, #0f172a 0%, #101624 100%);
}

.lm-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lm-hud-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.lm-hud-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lm-hud-left span {
  font-size: 12px;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.68);
  padding: 4px 8px;
  border-radius: 999px;
}

.lm-hud-left strong {
  color: #f8fafc;
}

.lm-hud-right {
  display: flex;
  gap: 6px;
}

.lm-btn,
.lm-link-btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.lm-btn:hover,
.lm-link-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.35);
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(96, 165, 250, 0.55);
}

.lm-btn:active,
.lm-link-btn:active {
  transform: translateY(0) scale(0.985);
}

.lm-btn:focus-visible,
.lm-link-btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.lm-btn-soft {
  font-size: 12px;
  padding: 7px 10px;
}

.lm-btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #082f49;
}

.lm-btn-primary:hover {
  background: linear-gradient(135deg, #67e8f9, #60a5fa);
}

.lm-screen,
.lm-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.78);
}

.lm-overlay {
  background: rgba(2, 6, 23, 0.82);
}

.lm-screen-show,
.lm-overlay-show {
  display: flex;
}

#lmStartScreen.lm-screen {
  background: rgba(2, 6, 23, 0.46);
  backdrop-filter: blur(10px) saturate(1.05);
  flex-direction: column;
  gap: 12px;
}

#lmStartScreen {
  backdrop-filter: blur(6px);
}

.lm-card {
  width: min(800px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 18px 34px rgba(2, 6, 23, 0.5);
  padding: 22px;
  text-align: center;
  color: #e2e8f0;
}

.lm-card-small {
  max-width: 560px;
}

.lm-card-hero {
  width: min(800px, 100%);
  min-height: auto;
  padding: 24px 22px 20px;
}

.lm-kicker {
  display: table;
  margin: 0 auto 8px;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  font-size: 13px;
  font-weight: 700;
  color: #e7efff;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.lm-card h1,
.lm-card h2 {
  margin: 8px 0 8px;
}

.lm-card h1 {
  font-size: clamp(34px, 5vw, 48px);
}

.lm-menu-panel {
  width: min(760px, 100%);
  min-height: 300px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.9));
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.5);
  padding: 22px;
  text-align: center;
  color: #e2e8f0;
}

.lm-menu-panel h1 {
  margin: 6px 0 8px;
  font-size: clamp(34px, 5vw, 48px);
  color: #f8fafc;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 20px rgba(56, 189, 248, 0.35);
}

.lm-menu-panel .lm-subtitle {
  display: block;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.lm-subtitle {
  margin: 0;
  color: #cbd5e1;
}

.lm-row {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.lm-row-secondary {
  margin-top: 10px;
}

.lm-card ul {
  margin: 10px auto 0;
  max-width: 460px;
  text-align: left;
  color: #e2e8f0;
  line-height: 1.55;
}

.lm-meta {
  margin: 14px 0 0;
  color: #93c5fd;
  font-size: 13px;
}

.lm-muted {
  margin: 14px 0 0;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
  width: 100%;
}

#lmBestMeta {
  display: block;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center !important;
}

.lm-footer {
  margin: 12px 0 0;
  color: #94a3b8;
  font-size: 13px;
}

.lm-footer-note {
  margin: 10px 0 0;
  color: #94a3b8;
  font-size: 13px;
}

.lm-footer-sub {
  margin: 5px 0 0;
  color: #93c5fd;
  font-size: 12px;
}

.lm-level-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(64px, 1fr));
  gap: 8px;
}

.lm-level-item {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.7);
  padding: 9px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.lm-level-item strong {
  display: block;
  font-size: 14px;
  color: #f8fafc;
}

.lm-level-item[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.lm-stars {
  margin: 10px 0 0;
  font-size: 24px;
  color: #f59e0b;
}

.lm-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 28;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 9px 13px;
  font-size: 13px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lm-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.lm-app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 35%, rgba(59, 130, 246, 0.06) 100%);
}

@media (max-width: 768px) {
  .lm-standalone .lm-shell {
    padding: 10px;
  }

  .lm-hud {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 7px 8px;
  }

  .lm-hud-left span {
    font-size: 11px;
    padding: 3px 7px;
  }

  .lm-btn,
  .lm-link-btn {
    font-size: 13px;
    padding: 8px 12px;
  }

  .lm-btn-cta {
    min-width: 190px;
    min-height: 48px;
    font-size: 20px;
  }

  .lm-level-grid {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
  }
}
