.im-app {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 0 28px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(45, 212, 191, 0.16), transparent 32%),
    radial-gradient(circle at 84% 14%, rgba(192, 132, 252, 0.16), transparent 34%),
    linear-gradient(180deg, #0b1225 0%, #172554 100%);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.55);
  user-select: none;
}

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

.im-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 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;
}

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

.im-hud-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.im-hud-stats span {
  font-size: 12px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 999px;
  padding: 4px 8px;
}

.im-hud-stats strong {
  color: #f8fafc;
}

.im-hud-actions {
  display: flex;
  gap: 6px;
}

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

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

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

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

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

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

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

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

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

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

#imStartScreen.im-screen {
  background: rgba(2, 6, 23, 0.46);
  backdrop-filter: blur(11px) saturate(1.06);
  flex-direction: column;
  gap: 12px;
}

.im-card {
  width: min(790px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  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;
}

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

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

.im-card h1,
.im-card h2,
.im-card h3 {
  margin: 4px 0 8px;
}

.im-card h1 {
  margin: 6px 0 8px;
  font-size: clamp(34px, 5vw, 48px);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

.im-mode-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.im-mode-item {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.7);
  padding: 10px 12px;
  text-align: left;
}

.im-mode-item h4 {
  margin: 0 0 4px;
  color: #f8fafc;
}

.im-mode-item p {
  margin: 0;
  color: #cbd5e1;
  font-size: 12px;
}

.im-mode-actions {
  margin-top: 8px;
}

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

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

.im-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) 34%,
    rgba(59, 130, 246, 0.05) 100%
  );
}

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

  .im-hud-stats span {
    font-size: 11px;
    padding: 3px 7px;
  }

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