:root {
  --ink: #1c2430;
  --muted: #5c6775;
  --line: #d5dbe2;
  --bg: #eef1f3;
  --panel: rgba(255, 255, 255, 0.92);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

body {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
}

.top {
  padding: 1.05rem 1.4rem 0.35rem;
}

.top h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.top p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.stage {
  position: relative;
  min-height: 0;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#view:active { cursor: grabbing; }

.status {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.status.is-hidden { display: none; }

.status.is-error { color: #9b2c2c; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.75rem 1rem 1.05rem;
}

.controls button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.controls button:hover { border-color: #b7c0ca; }

.controls button[aria-pressed="true"] {
  background: #1c2430;
  color: #fff;
  border-color: #1c2430;
}

.controls button:focus-visible {
  outline: 2px solid #1a7a34;
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .top { padding: 0.85rem 1rem 0.2rem; }
  .top p { font-size: 0.82rem; }
  .controls { gap: 0.4rem; padding: 0.55rem 0.7rem 0.85rem; }
  .controls button { font-size: 0.78rem; padding: 0.55rem 0.72rem; }
}

/* Compact mode for CMS card iframes — fill the iframe box fully */
html:has(body.is-embed) {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

body.is-embed {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: none;
  background: transparent;
}

body.is-embed .stage,
body.is-embed #view {
  background: transparent;
}

body.is-embed .top,
body.is-embed .controls {
  display: none !important;
}

body.is-embed .stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body.is-embed #view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

body.is-embed .status {
  font-size: 0.82rem;
}
