:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

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

.sm-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.24);
  background:
    radial-gradient(circle at 15% 18%, rgba(34, 211, 238, 0.16), transparent 34%),
    radial-gradient(circle at 85% 14%, rgba(251, 146, 60, 0.16), transparent 34%),
    linear-gradient(180deg, #0b1225 0%, #172554 100%);
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.55);
}

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

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

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

.sm-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;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(2, 6, 23, 0.62);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

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

.sm-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;
}

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

#smTimerPill.sm-timer-urgent {
  animation: smPulse 0.65s infinite;
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(254, 242, 242, 0.95);
}

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

.sm-btn,
.sm-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;
}

.sm-btn:hover,
.sm-link-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.35);
  background: rgba(30, 41, 59, 0.95);
}

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

.sm-btn:focus-visible,
.sm-link-btn:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

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

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

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

.sm-screen,
.sm-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);
}

.sm-overlay {
  background: rgba(2, 6, 23, 0.4);
}

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

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

.sm-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;
}

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

.sm-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);
}

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

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

.sm-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;
}

.sm-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);
}

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

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

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

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

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

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

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

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

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

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

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

.sm-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;
}

.sm-level-item strong {
  display: block;
  font-size: 14px;
}

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

.sm-best-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.sm-best-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.7);
  padding: 8px 10px;
  font-size: 13px;
  color: #cbd5e1;
}

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

.sm-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;
  padding: 9px 13px;
  font-size: 13px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

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

@keyframes smPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@media (max-width: 768px) {
  .sm-hud {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 7px 8px;
  }

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

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