/* The host styles stay separate from the public page and Flutter's renderer. */
/* Entry colors remain available when the public stylesheet is disabled. */
:root {
  --entry-canvas: #f4f7f6;
  --entry-ink: #202a26;
  --entry-ink-soft: #59655f;
  --entry-brand: #0f5c4d;
  --entry-on-brand: #fff;
  --launch-canvas: #0b3b30;
  --launch-ink: #fff;
}

html[data-theme="dark"] {
  --entry-canvas: #191c1b;
  --entry-ink: #f3f1ea;
  --entry-ink-soft: #adb8b0;
  --entry-brand: #7bc6a3;
  --entry-on-brand: #191c1b;
}

#likarflow-launch-screen,
#likarflow-load-error,
#public-script-error {
  display: none;
}

/* entry.js sets the app entry language in <head>, before feedback can paint. */
html[lang="en"] [data-entry-copy][lang="uk"],
html[lang="uk"] [data-entry-copy][lang="en"] { display: none; }

#app-transition-status[hidden],
#retry-app-transition[hidden] { display: none; }

/* Keep the current page and its scroll position while Flutter starts beneath it. */
html[data-surface="opening"] #public-site {
  position: fixed;
  inset: 0;
  z-index: 2147483645;
  overflow-y: scroll;
  background: var(--canvas);
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}

html[data-surface="opening"] flutter-view { pointer-events: none; }

.is-opening { position: relative; color: transparent !important; cursor: progress; transition: none !important; }
.is-opening > * { visibility: hidden; }
.is-opening::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: calc(50% - 9px);
  top: calc(50% - 9px);
  box-sizing: border-box;
  border: 2px solid var(--brand, var(--entry-brand));
  border-right-color: transparent;
  border-radius: 50%;
  animation: app-opening-spin .8s linear infinite;
}
.button-primary.is-opening::after { border-color: var(--on-brand); border-right-color: transparent; }
.button-light.is-opening::after { border-color: var(--brand-deep); border-right-color: transparent; }

.app-transition-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

#app-transition-status {
  position: fixed;
  z-index: 2147483646;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  font: 1rem/1.5 system-ui, sans-serif;
}
#app-transition-status p { margin: 0; }
.app-transition-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.app-transition-actions button {
  min-height: 44px;
  padding: 6px 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
}
@keyframes app-opening-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .is-opening::after { animation: none; }
}

html[data-surface="app"],
html[data-surface="app"] body {
  width: 100%;
  height: 100%;
  margin: 0;
  background-color: var(--entry-canvas);
}

html[data-surface="app"] #public-site {
  display: none;
}

html[data-surface="app"] #likarflow-launch-screen {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 24px;
  box-sizing: border-box;
  background-color: var(--launch-canvas);
  color: var(--launch-ink);
  font: 1rem/1.5 system-ui, sans-serif;
  text-align: center;
}

#likarflow-launch-screen p { margin: 0; }

#likarflow-launch-screen img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
}

html[data-load-failed="true"] #likarflow-launch-screen {
  display: none;
}

html[data-load-failed="true"] #likarflow-load-error {
  position: fixed;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px;
  overflow-y: auto;
  background: var(--entry-canvas);
  color: var(--entry-ink);
  font: 1rem/1.6 system-ui, sans-serif;
  text-align: center;
}

#likarflow-load-error h2,
#likarflow-load-error p {
  max-width: 34rem;
  margin: 0;
}

#likarflow-load-error h2 { font-size: 1.6rem; }
#likarflow-load-error a { color: var(--entry-brand); }
#likarflow-load-error button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  background: var(--entry-brand);
  color: var(--entry-on-brand);
  font: inherit;
  cursor: pointer;
}

#likarflow-load-error :focus-visible { outline: 3px solid var(--entry-brand); outline-offset: 4px; }
.public-script-note { margin-block: 18px; color: var(--entry-ink-soft); font: .875rem/1.6 system-ui, sans-serif; }
html[data-public-script-failed="true"] #public-script-error { display: block; }
