/* Page chrome around the Compose canvas: the loading, unsupported and failed screens.
 * Colors are the dark TarotTokens (app/src/main/kotlin/com/tarot2go/app/ui/theme/TarotTokens.kt);
 * change them there first and mirror them here. */
:root {
  --table-surface: #17120F;
  --table-raised: #2B1F1A;
  --card-paper: #EFE6D6;
  --card-frame: #C9A86A;
  --text-primary: #EDE6DD;
  --text-secondary: #C3B6AA;
  --accent-fill: #3F6A61;
  --on-accent-fill: #EFF6F3;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  color-scheme: dark;
}

[hidden] { display: none !important; }

/* A fixed, non-scrolling page: no rubber-band bounce or pull-to-refresh around the canvas. */
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--table-surface);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  position: fixed;
  inset: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Compose sizes the canvas itself (inline width and height). Compose handles every touch, so the
 * browser must not pan, zoom, select text or show the long-press callout on it. */
#tarot2go {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  outline: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right))
    calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
  background: radial-gradient(ellipse at 50% 40%, var(--table-raised), var(--table-surface) 70%);
  text-align: center;
  transition: opacity 280ms ease-out;
}
.screen.leaving { opacity: 0; pointer-events: none; }
.screen h1 {
  margin: 20px 0 4px;
  font: 600 1.6rem/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
}
.screen p { margin: 4px 0; max-width: 32em; color: var(--text-secondary); }
.screen .small { font-size: 0.875rem; }
.screen a { color: var(--text-primary); }

/* The card back from the launcher icon, gently breathing while the app loads. */
.card-back {
  position: relative;
  width: 72px;
  height: 116px;
  border-radius: 6px;
  background: var(--card-paper);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.card-back::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1.5px solid var(--card-frame);
  border-radius: 4px;
}
.card-back span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  border: 2px solid var(--card-frame);
  transform: translate(-50%, -50%) rotate(45deg);
}
#boot .card-back { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: translateY(0); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
  50% { transform: translateY(-6px); box-shadow: 0 18px 36px rgba(0, 0, 0, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  #boot .card-back { animation: none; }
  .screen { transition: none; }
}

.button {
  margin-top: 12px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 22px;
  background: var(--accent-fill);
  color: var(--on-accent-fill);
  font: 600 1rem system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

/* "A new version is ready" pill, above the home indicator. */
.update {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 16px;
  border-radius: 28px;
  background: var(--table-raised);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.update .button { margin: 0; }

#safe-area-probe {
  position: fixed;
  visibility: hidden;
  pointer-events: none;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
