@property --accent-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #e83030;
}

@property --on-accent-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #ffffff;
}

@property --tree-accent-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #e83030;
}

@property --tree-on-accent-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #ffffff;
}

@property --chrome-accent-shade-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #111111;
}

@property --chrome-accent-shade-strength {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}

:root {
  --accent-color: #e83030;
  --on-accent-color: #ffffff;
  --tree-accent-color: #e83030;
  --tree-on-accent-color: #ffffff;
  --color-main: #2b2926;
  --color-back: #f6f1e7;
  --color-panel: rgba(247, 241, 231, 0.86);
  --color-border: rgba(158, 142, 121, 0.24);
  --color-border-strong: rgba(122, 108, 90, 0.42);
  --color-muted: rgba(92, 79, 63, 0.78);
  --tree-transition-duration: 300ms;
  --hosted-accent-duration: 3333ms;
  --accent-transition-duration: var(--tree-transition-duration);
  --tree-visualization-background-transition-duration: 0ms;
  --accent-color-transition: var(--accent-transition-duration) ease;
  --chrome-accent-shade-color: #111111;
  --chrome-accent-shade-strength: 0%;
  --chrome-accent-visible-shade-strength: max(30%, var(--chrome-accent-shade-strength));
  --tree-accent-symbol-filter:
    drop-shadow(1px 1px 2px color-mix(in srgb, var(--chrome-accent-shade-color) calc(var(--chrome-accent-visible-shade-strength) * 0.88), transparent))
    drop-shadow(2px 2px 5px color-mix(in srgb, var(--chrome-accent-shade-color) calc(var(--chrome-accent-visible-shade-strength) * 0.62), transparent))
    drop-shadow(4px 4px 14px color-mix(in srgb, var(--chrome-accent-shade-color) calc(var(--chrome-accent-visible-shade-strength) * 0.34), transparent));
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition:
    --accent-color var(--accent-color-transition),
    --on-accent-color var(--accent-color-transition),
    --tree-accent-color var(--accent-color-transition),
    --tree-on-accent-color var(--accent-color-transition),
    --chrome-accent-shade-color var(--accent-color-transition),
    --chrome-accent-shade-strength var(--accent-color-transition);
}

:root[data-brightness="dark"] {
  --color-main: #f3efe7;
  --color-back: #1d1b19;
  --color-panel: rgba(45, 42, 38, 0.92);
  --color-border: rgba(238, 231, 219, 0.22);
  --color-border-strong: rgba(238, 231, 219, 0.42);
  --color-muted: rgba(224, 216, 202, 0.78);
  --chrome-accent-visible-shade-strength: var(--chrome-accent-shade-strength);
  --tree-accent-symbol-filter:
    drop-shadow(0 0 2px color-mix(in srgb, var(--chrome-accent-shade-color) var(--chrome-accent-shade-strength), transparent))
    drop-shadow(0 0 10px color-mix(in srgb, var(--accent-color) 28%, transparent))
    drop-shadow(0 0 20px color-mix(in srgb, var(--accent-color) 16%, transparent));
}

:root[data-embed="full"],
:root[data-embed="inline"] {
  /* Embedded apps receive the actual background from the Homepage bridge. */
  --color-back: transparent;
  --accent-transition-duration: var(--hosted-accent-duration);
  --accent-color-transition: var(--accent-transition-duration) ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--color-back);
  color: var(--color-main);
  font-family: var(--font-ui);
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

a {
  color: inherit;
}

button,
a,
canvas {
  -webkit-tap-highlight-color: transparent;
}

#app-direct-header,
#app-direct-footer {
  position: fixed;
  z-index: 20;
  color: var(--color-muted);
  font-size: 12px;
  pointer-events: none;
}

#app-direct-header {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

#app-direct-header nav,
#app-direct-header a,
#app-direct-header button,
#app-direct-footer a {
  pointer-events: auto;
}

#app-direct-header nav {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

#app-direct-header nav a {
  text-decoration: none;
}

#app-direct-header nav a:last-child {
  color: var(--color-main);
}

#app-direct-header nav a:not(:last-child)::after {
  content: "/";
  margin-left: 7px;
  color: var(--color-muted);
}

#app-direct-header [data-homepage-logo-link],
#app-direct-header [data-homepage-logo-trigger] {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  text-decoration: none;
}

#app-direct-header [data-homepage-logo-trigger] {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  appearance: none;
  cursor: pointer;
}

#app-direct-header img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

#app-direct-footer {
  right: 16px;
  bottom: 12px;
  left: 16px;
  text-align: left;
}

#app-direct-footer a {
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--tree-transition-duration) ease,
    background-color var(--tree-transition-duration) ease,
    text-decoration-color var(--tree-transition-duration) ease;
}

#app-preferences-panel {
  position: fixed;
  top: 58px;
  right: 18px;
  z-index: 25;
  width: min(21rem, calc(100vw - 36px));
  pointer-events: auto;
}

.app-preferences-card {
  padding: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 14px;
  background: var(--color-panel);
  color: var(--color-main);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--chrome-accent-shade-color) 18%, transparent);
  backdrop-filter: blur(14px);
}

.app-preferences-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-preferences-heading h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.app-preferences-heading button,
#app-preferences-reset {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--color-main);
  cursor: pointer;
}

.app-preferences-heading button {
  width: 2rem;
  padding: 0;
  border: 0;
  font-size: 1.35rem;
  line-height: 1;
}

#app-preferences-season-value {
  margin: 1rem 0 0.75rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.app-preferences-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 1rem;
  font-size: 0.82rem;
}

.app-preferences-links a {
  color: var(--accent-color);
  text-underline-offset: 3px;
}

#app-preferences-version {
  display: block;
  margin-top: 0.9rem;
  color: var(--color-muted);
  font-size: 0.72rem;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
}

#app-visualization-hit-area {
  position: fixed;
  top: 41%;
  left: 50%;
  z-index: 11;
  width: min(88vw, 34rem);
  height: min(54vh, 34rem);
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  appearance: none;
}

#app-new-shape-link {
  position: fixed;
  right: 16px;
  bottom: 6.5rem;
  left: 16px;
  z-index: 12;
  display: block;
  color: var(--accent-color);
  font-family: var(--font-ui);
  font-size: clamp(0.78rem, 1.9vw, 0.95rem);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--accent-transition-duration) ease;
  pointer-events: none;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

#app-interaction-hint {
  position: fixed;
  right: 16px;
  bottom: calc(6.5rem + 3.05rem + 1.35em);
  left: 16px;
  z-index: 12;
  display: block;
  color: var(--accent-color);
  font-family: var(--font-ui);
  font-size: var(--type-base-size, clamp(1rem, 0.96rem + 0.2vw, 1.08rem));
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  opacity: 1;
  transition: color var(--accent-transition-duration) ease,
    opacity var(--tree-transition-duration) ease;
  pointer-events: none;
  cursor: default;
  user-select: text;
  -webkit-user-select: text;
}

#app-interaction-hint.is-dismissed {
  visibility: hidden;
  opacity: 0;
}

#app-new-shape-link strong,
#app-new-shape-link > span {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  color: var(--accent-color);
  transition: color var(--accent-transition-duration) ease;
  pointer-events: auto;
}

#app-interaction-hint > span {
  display: inline-block;
  color: var(--accent-color);
  transition: color var(--accent-transition-duration) ease;
  pointer-events: auto;
  cursor: pointer;
}

#app-new-shape-link a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  pointer-events: auto;
  cursor: pointer;
  transition: color var(--accent-transition-duration) ease,
    background-color var(--tree-transition-duration) ease,
    text-decoration-color var(--tree-transition-duration) ease;
}

#app-new-shape-link a:hover,
#app-new-shape-link a:focus-visible {
  text-decoration: underline;
}

#app-new-shape-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-color) 30%, transparent);
  outline-offset: 3px;
}

#root,
#root > div:first-child {
  width: 100%;
  height: 100%;
  min-height: 0 !important;
}

#root > div:first-child {
  height: 100% !important;
  background: var(--color-back) !important;
  transform: translateZ(0);
  transition: background-color var(--tree-visualization-background-transition-duration) ease !important;
}

#root canvas {
  transition: background-color var(--tree-visualization-background-transition-duration) ease !important;
}

#root * {
  transition-duration: var(--tree-transition-duration) !important;
}

#root > div:first-child > div[style*="bottom: 0px"][style*="left: 0px"] {
  background: transparent !important;
  padding-bottom: 0 !important;
  pointer-events: none !important;
}

#root > div:first-child > div[style*="bottom: 0px"] > div {
  width: min(460px, calc(100% - 24px)) !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  pointer-events: none !important;
}

#root div:has(> input[type="url"]),
#root a,
#root input,
#root button:not([role="radio"]),
#root [role="button"]:not(canvas) {
  display: none !important;
}

#root [role="radiogroup"][aria-label="Season selector"],
#root [role="radiogroup"][aria-label="Season"] {
  position: fixed !important;
  right: 18px !important;
  bottom: 16px !important;
  left: auto !important;
  display: flex !important;
  width: 40px !important;
  margin: 0 !important;
  gap: 0 !important;
  flex-direction: column !important;
  align-items: center !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  pointer-events: auto !important;
  z-index: 14 !important;
}

html[data-embed="full"] #root [role="radiogroup"][aria-label="Season selector"],
html[data-embed="full"] #root [role="radiogroup"][aria-label="Season"],
html[data-embed="inline"] #root [role="radiogroup"][aria-label="Season selector"],
html[data-embed="inline"] #root [role="radiogroup"][aria-label="Season"] {
  display: none !important;
}

#root [role="radiogroup"] > button[role="radio"] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--color-main) !important;
  font-family: var(--font-ui) !important;
  font-size: 0 !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  transition: color var(--accent-transition-duration) ease,
    background-color var(--tree-transition-duration) ease !important;
  pointer-events: auto !important;
}

#root [role="radiogroup"] > button[role="radio"] > span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  font-size: 0 !important;
}

#root [role="radiogroup"] > button[role="radio"] > span > svg {
  width: 22px !important;
  height: 22px !important;
  color: var(--color-main) !important;
  stroke: currentColor !important;
  filter: var(--tree-accent-symbol-filter);
  transition: color var(--accent-transition-duration) ease,
    fill var(--accent-transition-duration) ease,
    stroke var(--accent-transition-duration) ease,
    filter var(--accent-transition-duration) ease !important;
}

#root [role="radiogroup"] > button[role="radio"]:hover > span > svg,
#root [role="radiogroup"] > button[role="radio"][aria-checked="true"] > span > svg {
  color: var(--tree-accent-color) !important;
}

#root [role="radiogroup"] > button[role="radio"]:hover {
  background: transparent !important;
  color: var(--tree-accent-color) !important;
}

#root [role="radiogroup"] > button[role="radio"][aria-checked="true"] {
  color: var(--tree-accent-color) !important;
}

#root [role="radiogroup"] > button[role="radio"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--tree-accent-color) 30%, transparent) !important;
  outline-offset: 3px !important;
}

#root [role="radiogroup"] > button[role="radio"][aria-label="Spring"] {
  position: relative;
}

#root [role="radiogroup"] > button[role="radio"][aria-label="Spring"] > span > svg {
  display: block !important;
}

#root canvas {
  background: var(--color-back) !important;
  outline: none;
  cursor: default !important;
}

#root img[alt^="QR code for "] {
  pointer-events: none !important;
}

#root canvas:focus-visible {
  outline: 3px solid var(--tree-accent-color);
  outline-offset: -6px;
}

#root > div:first-child:has(h2) {
  background: var(--color-back) !important;
  color: var(--color-main) !important;
}

#root > div:first-child:has(h2) h2 {
  margin: 0 0 0.55rem !important;
  color: var(--color-main) !important;
  font-family: var(--font-ui) !important;
  font-size: clamp(1.45rem, 7vw, 2rem) !important;
  line-height: 1.1 !important;
}

#root > div:first-child:has(h2) p {
  margin: 0 !important;
  color: var(--color-muted) !important;
  font-family: var(--font-ui) !important;
  font-size: clamp(0.95rem, 4.2vw, 1.15rem) !important;
  line-height: 1.35 !important;
}

#app-runtime-status {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  transform: translate(-50%, -50%);
  max-width: min(90vw, 32rem);
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-panel);
  color: var(--color-main);
  text-align: center;
}

@media (max-width: 380px) {
  #app-direct-header {
    padding: 12px;
    font-size: 11px;
  }

  #app-direct-header nav {
    gap: 5px;
  }

  #app-direct-header nav a:not(:last-child)::after {
    margin-left: 5px;
  }

  #app-direct-header [data-homepage-logo-link],
  #app-direct-header [data-homepage-logo-trigger],
  #app-direct-header img {
    width: 30px;
    height: 30px;
  }

  #app-direct-footer {
    right: 12px;
    bottom: 10px;
    left: 12px;
    font-size: 11px;
  }

  #app-new-shape-link {
    right: 12px;
    bottom: 6.25rem;
    left: 12px;
    font-size: 0.76rem;
  }

  #app-interaction-hint {
    right: 12px;
    bottom: calc(6.25rem + 3.05rem + 1.35em);
    left: 12px;
  }

  #root [role="radiogroup"][aria-label="Season selector"],
  #root [role="radiogroup"][aria-label="Season"] {
    right: 12px !important;
    bottom: 12px !important;
  }
}

html[data-embed="full"] #app-direct-header,
html[data-embed="full"] #app-direct-footer,
html[data-embed="full"] #app-preferences-panel,
html[data-embed="inline"] #app-direct-header,
html[data-embed="inline"] #app-direct-footer,
html[data-embed="inline"] #app-preferences-panel,
html[data-embed="inline"] #app-new-shape-link,
html[data-embed="inline"] #app-interaction-hint {
  display: none;
}

html[data-embed="full"] #app,
html[data-embed="inline"] #app {
  height: 100dvh;
}

@media (prefers-reduced-motion: reduce) {
  #root * {
    transition-duration: 0s !important;
  }

  #root [role="radiogroup"] > button[role="radio"] {
    transition: none !important;
  }
}
