/* ——— Desktop-style app window (scripts/otc-app-window.js) ——— */

html.otc-appwin-open { overflow: hidden; }

.otc-appwin {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vw, 32px);
}

.otc-appwin[hidden] { display: none; }

.otc-appwin__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 22, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.otc-appwin__frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1480px, 100%);
  height: min(940px, 100%);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 255, 0.3);
  background: #0c1228;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform: translateY(14px) scale(0.985);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1), opacity 0.2s ease;
}

.otc-appwin.is-open .otc-appwin__backdrop { opacity: 1; }
.otc-appwin.is-open .otc-appwin__frame { transform: none; opacity: 1; }

.otc-appwin.is-maximized { padding: 0; }
.otc-appwin.is-maximized .otc-appwin__frame,
.otc-appwin__frame:fullscreen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: 0;
}

/* Title bar */
.otc-appwin__titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  background: linear-gradient(180deg, #151f3a 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(148, 163, 255, 0.18);
  color: #e8edff;
}

.otc-appwin__dots {
  display: inline-flex;
  gap: 6px;
}

.otc-appwin__dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #5b4bff;
}

.otc-appwin__dots span:nth-child(2) { background: #22d3ee; }
.otc-appwin__dots span:nth-child(3) { background: #34d399; }

.otc-appwin__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
  font-size: 17px;
}

.otc-appwin__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.otc-appwin__about {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(103, 232, 249, 0.45);
  background: rgba(34, 211, 238, 0.12);
  color: #a5f3fc;
  font: 800 14px/1 "Plus Jakarta Sans", Segoe UI, Arial, sans-serif;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.otc-appwin__about:hover,
.otc-appwin__about[aria-expanded="true"] {
  background: #22d3ee;
  color: #0c1228;
  transform: scale(1.06);
}

.otc-appwin__about:focus-visible {
  outline: 3px solid #22d3ee;
  outline-offset: 2px;
}

.otc-appwin__ctrl[aria-expanded="true"] {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(103, 232, 249, 0.6);
}

.otc-appwin__titles {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.otc-appwin__title {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}

.otc-appwin__host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #8b96c4;
  font-size: 13px;
}

.otc-appwin__controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.otc-appwin__ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 255, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #e0e7ff;
  font: 600 13px/1 "Outfit", Segoe UI, Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.otc-appwin__ctrl:hover {
  background: rgba(91, 75, 255, 0.28);
  border-color: rgba(129, 140, 248, 0.6);
}

.otc-appwin__ctrl:focus-visible,
.otc-appwin__btn:focus-visible,
.otc-appwin__status a:focus-visible {
  outline: 3px solid #22d3ee;
  outline-offset: 2px;
}

.otc-appwin__ctrl--close { padding: 0 9px; }
.otc-appwin__ctrl--close:hover { background: rgba(239, 68, 68, 0.3); border-color: rgba(248, 113, 113, 0.7); }

/* Optional note bar */
.otc-appwin__note {
  margin: 0;
  padding: 9px 16px;
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
  color: #312e81;
  font-size: 14px;
  line-height: 1.5;
}

.otc-appwin__note[hidden] { display: none; }

.otc-appwin__note a { color: #4338ca; font-weight: 700; }

/* Body */
.otc-appwin__body {
  position: relative;
  flex: 1;
  background: #fff;
}

.otc-appwin__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.otc-appwin__loading,
.otc-appwin__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  color: #111827;
}

.otc-appwin__loading[hidden],
.otc-appwin__fallback[hidden],
.otc-appwin__launch[hidden] { display: none; }

.otc-appwin__loading { color: #4b5563; font-weight: 600; }

.otc-appwin__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(91, 75, 255, 0.18);
  border-top-color: #5b4bff;
  animation: otc-appwin-spin 0.8s linear infinite;
}

@keyframes otc-appwin-spin { to { transform: rotate(360deg); } }

.otc-appwin__fallback-ico { font-size: 40px; }

.otc-appwin__fallback-title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.otc-appwin__fallback-copy {
  margin: 0;
  max-width: 46ch;
  color: #4b5563;
  line-height: 1.55;
}

.otc-appwin__fallback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.otc-appwin__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #5b4bff, #4338ca);
  color: #fff;
  font: 700 15px/1 "Plus Jakarta Sans", Segoe UI, Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(91, 75, 255, 0.3);
}

.otc-appwin__btn--ghost {
  background: #fff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  box-shadow: none;
}

.otc-appwin__btn[hidden] { display: none; }

.otc-appwin__status {
  margin: 0;
  padding: 7px 14px;
  background: #0f172a;
  border-top: 1px solid rgba(148, 163, 255, 0.18);
  color: #a5b4fc;
  font-size: 13px;
  text-align: center;
}

.otc-appwin__status a {
  color: #67e8f9;
  font-weight: 700;
}

@media (max-width: 720px) {
  .otc-appwin { padding: 0; }
  .otc-appwin__frame { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .otc-appwin__titlebar { gap: 8px; padding-left: 10px; }
  .otc-appwin__dots,
  .otc-appwin__host,
  .otc-appwin__ctrl span { display: none; }
  .otc-appwin__ctrl { padding: 0 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .otc-appwin__frame,
  .otc-appwin__backdrop { transition: none; }
  .otc-appwin__spinner { animation-duration: 2s; }
}
