/* Zvjezdano nebo: tamna kosmička tema + živi DOM (Pixi pozadina vidljiva kroz poluprozične slojeve) */

:root {
  --bg-page: #05040a;
  --bg: #0c0a14;
  --bg-elevated: rgba(18, 14, 30, 0.88);
  --glass-bg: rgba(16, 12, 28, 0.62);
  --glass-border: rgba(216, 194, 140, 0.22);
  --fg: #f4f0e8;
  --fg-soft: rgba(244, 240, 232, 0.9);
  --muted: rgba(200, 190, 175, 0.72);
  --muted-2: rgba(244, 240, 232, 0.42);
  --line: rgba(216, 194, 140, 0.18);
  --line-strong: rgba(216, 194, 140, 0.38);
  --accent: #d8c28c;
  --accent-ink: #141018;
  --accent-warm: #e8d5a0;
  --tap-highlight: transparent;
  --header-bg: rgba(8, 6, 18, 0.94);
  --header-fg: #f7f3eb;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --pad-x: clamp(1.2rem, 5vw, 1.85rem);
  --pad-y: 1.25rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 999px;
  --shadow-soft: 0 4px 28px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-sheet: 0 -20px 56px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 32px rgba(216, 194, 140, 0.12);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --touch-min: 48px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .panel-overlay,
  .panel {
    transition-duration: 0.1s !important;
  }

  .pressable,
  .pressable:active {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .main-scroll.motion-tab-target.motion-tab-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  height: 100%;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg-page);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, #1a1530 0%, transparent 55%),
    linear-gradient(168deg, #0e0c18 0%, var(--bg-page) 45%, #06040c 100%);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: var(--tap-highlight);
}

/* Shell: Pixi ispod DOM-a (Faza A) */
.app-shell {
  position: relative;
  height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  max-height: 100dvh;
  max-height: 100svh;
  display: flex;
  flex-direction: column;
}

.pixi-bg {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#app-root {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

#app-root > .screen-auth,
#app-root > .screen-boot {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

button {
  touch-action: manipulation;
}

.app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(6, 4, 12, 0.45) 0%, rgba(6, 4, 12, 0.72) 100%);
}

.app__main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* —— Top bar —— */
.topbar {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(var(--touch-min), auto) 1fr minmax(var(--touch-min), auto);
  align-items: center;
  gap: 0.5rem;
  min-height: calc(var(--touch-min) + var(--safe-top));
  padding: calc(var(--safe-top) + 0.35rem) calc(var(--pad-x) + var(--safe-right)) 0.65rem calc(var(--pad-x) + var(--safe-left));
  background: linear-gradient(
    175deg,
    rgba(22, 16, 40, 0.96) 0%,
    rgba(10, 8, 20, 0.94) 45%,
    rgba(6, 4, 14, 0.92) 100%
  );
  color: var(--header-fg);
  border-bottom: 1px solid rgba(216, 194, 140, 0.14);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.38), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(216, 194, 140, 0.45) 50%, transparent 100%);
  opacity: 0.85;
  pointer-events: none;
}

.topbar__btn:is(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--touch-min) - 2px);
  min-width: calc(var(--touch-min) - 2px);
  padding: 0 0.65rem;
  margin: 0;
  cursor: pointer;
  color: rgba(244, 240, 232, 0.92);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  border-radius: var(--radius-full);
  border: 1px solid rgba(216, 194, 140, 0.2);
  background: rgba(8, 6, 18, 0.55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 2px 12px rgba(0, 0, 0, 0.25);
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out), opacity 0.15s var(--ease-out), transform 0.12s var(--ease-out);
}

.topbar__btn:is(button):hover {
  border-color: rgba(216, 194, 140, 0.38);
  background: rgba(216, 194, 140, 0.1);
  color: var(--fg);
}

.topbar__btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.topbar__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar__btn--right:is(button) {
  letter-spacing: 0.08em;
}

.topbar__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 4.8vw, 1.55rem);
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(247, 243, 235, 0.96);
  background: linear-gradient(180deg, #faf6ef 0%, #e8dcc4 38%, #d8c28c 72%, #b89d6a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.05;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .topbar__title {
    color: rgba(247, 243, 235, 0.95);
    background: none;
  }
}

.topbar__btn:not(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--touch-min) - 2px);
  min-width: calc(var(--touch-min) - 2px);
}

.topbar__chevron {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 200;
  opacity: 0.92;
  margin-top: -0.06em;
  color: rgba(216, 194, 140, 0.95);
}

/* —— Tabs (interaktivni footer) —— */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  flex-shrink: 0;
}

.tabs--footer {
  background: rgba(8, 6, 18, 0.94);
  border-top: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(216, 194, 140, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding-bottom: var(--safe-bottom);
  position: relative;
  z-index: 30;
}

.tabs__btn {
  background: none;
  border: 0;
  min-height: calc(var(--touch-min) - 2px);
  padding: 0.45rem 0.35rem 0.55rem;
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-top: 3px solid transparent;
  margin-top: -1px;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.tabs__btn[aria-selected="true"] {
  color: var(--accent);
  border-top-color: var(--accent);
  background: rgba(216, 194, 140, 0.07);
}

.tabs__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

/* —— Date strip —— */
.date-strip-wrap {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 8, 20, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.date-strip {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.85rem calc(var(--pad-x) + var(--safe-right)) 1.05rem calc(var(--pad-x) + var(--safe-left));
  scroll-snap-type: x mandatory;
  scroll-padding-inline: calc(var(--pad-x) + 0.5rem);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
}

.date-strip:active {
  cursor: grabbing;
}

.date-strip::-webkit-scrollbar {
  display: none;
}

.date-pill {
  flex: 0 0 auto;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 52px;
  padding: 0.35rem 0.25rem;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  border-radius: var(--radius-md);
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.date-pill:active {
  background: rgba(255, 255, 255, 0.06);
}

.date-pill__dow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.date-pill__num {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.date-pill--today:not(.date-pill--selected) .date-pill__num {
  border-color: var(--line-strong);
  color: var(--fg);
  box-shadow: 0 0 0 1px rgba(216, 194, 140, 0.15);
}

.date-pill--selected .date-pill__num {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift), var(--shadow-glow);
}

.date-pill--selected {
  color: var(--fg);
}

/* —— Main scroll —— */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  padding: 1.5rem calc(var(--pad-x) + var(--safe-right)) calc(1.35rem + var(--safe-bottom)) calc(var(--pad-x) + var(--safe-left));
  background: rgba(4, 3, 10, 0.25);
}

.section-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(216, 194, 140, 0.75);
  margin-bottom: 0.95rem;
}

/* —— Daily (Dnevno) + Sačuvano (isti glass panel) —— */
.daily-panel,
.saved-panel {
  padding: 1.15rem 1rem 1.2rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(22, 18, 36, 0.92), rgba(12, 10, 22, 0.88));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.daily-panel {
  margin-bottom: 0.85rem;
}

.saved-panel {
  margin-bottom: 0;
}

.saved-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.daily-panel__greeting {
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 6.2vw, 2.05rem);
  font-weight: 400;
  line-height: 1.14;
  margin: 0 0 0.85rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-shadow: 0 0 36px rgba(216, 194, 140, 0.1);
}

.daily-panel__eyebrow,
.saved-panel__eyebrow {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(216, 194, 140, 0.85);
  margin-bottom: 1rem;
}

.daily-panel__loading,
.saved-panel__loading {
  padding: 0.5rem 0 0.35rem;
}

.daily-panel__loading .loading,
.saved-panel__loading .loading {
  justify-content: center;
}

.daily-insights,
.saved-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem 0.48rem;
}

.daily-insight,
.saved-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.28rem;
  width: 100%;
  min-height: 5.1rem;
  padding: 0.55rem 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  background: rgba(8, 6, 18, 0.5);
  border: 1px solid var(--glass-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.daily-insight .ui-icon,
.saved-card .ui-icon {
  margin-bottom: 0.1rem;
}

.daily-insight .ui-icon__svg,
.saved-card .ui-icon__svg {
  width: 1.55rem;
  height: 1.55rem;
}

.daily-insight__text {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--fg-soft);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.daily-insight--empty,
.saved-card--empty {
  grid-column: 1 / -1;
  min-height: 4.5rem;
  justify-content: center;
  color: var(--muted);
}

.daily-insight--empty .daily-insight__text,
.saved-card--empty .saved-card__empty-text {
  color: var(--muted);
  -webkit-line-clamp: unset;
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
  max-width: 22rem;
  margin: 0 auto;
}

.saved-card__title {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--fg-soft);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  width: 100%;
}

.saved-card__meta {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  width: 100%;
}

.saved-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.saved-card:active {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.daily-prose {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(216, 194, 140, 0.12);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--muted);
}

.daily-prose p {
  margin: 0 0 0.65rem;
}

.daily-prose p:last-child {
  margin-bottom: 0;
}

.daily-ornament {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 2rem;
  opacity: 0.38;
  filter: contrast(1.05);
}

.daily-ornament .ui-icon {
  opacity: 0.95;
}

.daily-ornament .ui-icon__svg {
  width: 1.65rem;
  height: 1.65rem;
}

.body-copy {
  font-size: 1rem;
  line-height: 1.78;
  color: var(--fg-soft);
  max-width: 40rem;
}

.body-copy p {
  margin: 0 0 1.1rem;
}

.u {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent);
}

/* —— UI ikone (SVG, tema) —— */
.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(216, 194, 140, 0.92);
}

.ui-icon__svg {
  display: block;
  width: 1.25em;
  height: 1.25em;
}

.btn-primary .ui-icon {
  color: var(--accent-ink);
}

/* —— Auth —— */
.screen-auth {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: calc(2rem + var(--safe-top)) calc(var(--pad-x) + var(--safe-right)) calc(2rem + var(--safe-bottom)) calc(var(--pad-x) + var(--safe-left));
}

.screen-auth__mark {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
  user-select: none;
}

.screen-auth__mark .ui-icon {
  color: rgba(216, 194, 140, 0.72);
}

.screen-auth__mark .ui-icon__svg {
  width: 2.75rem;
  height: 2.75rem;
}

.screen-auth__inner {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lift), var(--shadow-glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.screen-auth__brand {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 12vw, 3.25rem);
  font-weight: 400;
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.screen-auth .field--locale {
  margin-bottom: 1rem;
  text-align: left;
}

.screen-auth__tag {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
  margin: 0 0 2.25rem;
}

.auth-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 1.75rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(8, 6, 16, 0.65);
  box-shadow: var(--shadow-soft);
}

.auth-toggle button {
  flex: 1;
  background: transparent;
  border: 0;
  min-height: var(--touch-min);
  padding: 0.65rem 0.5rem;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.auth-toggle button + button {
  border-left: 1px solid var(--line);
}

.auth-toggle button[aria-selected="true"] {
  color: var(--accent-ink);
  background: var(--accent);
}

.auth-toggle button:active:not([aria-selected="true"]) {
  background: rgba(255, 255, 255, 0.06);
}

.field {
  margin-bottom: 1.15rem;
}

.field label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: rgba(6, 4, 14, 0.55);
  color: var(--fg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(216, 194, 140, 0.15);
}

.field input::placeholder {
  color: var(--muted-2);
}

.field select {
  cursor: pointer;
  appearance: none;
  background-color: rgba(6, 4, 14, 0.55);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d8c28c' d='M1 1.5L6 6l5-4.5' stroke='%23d8c28c' stroke-width='1.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.45rem;
  line-height: 1.45;
}

/* —— Bootstrap / onboarding —— */
.screen-boot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-x);
  padding-top: calc(var(--pad-x) + var(--safe-top));
  padding-bottom: calc(var(--pad-x) + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.screen-boot__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

/* Faza E: Pixi boot + CSS rezerva */
.boot-visual-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto;
}

.boot-pixi {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  pointer-events: none;
}

.boot-spinner--fallback {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: bootSpin 0.75s linear infinite;
}

.boot-visual-wrap[data-fallback="1"] .boot-spinner--fallback {
  display: block;
}

.boot-visual-wrap[data-fallback="1"] .boot-pixi {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .boot-spinner--fallback {
    animation-duration: 1.4s;
  }
}

.boot-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: bootSpin 0.75s linear infinite;
}

@keyframes bootSpin {
  to {
    transform: rotate(360deg);
  }
}

.screen-onboarding {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.screen-onboarding .main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.onboarding-kicker {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.onboarding-lead {
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 5vw, 1.95rem);
  font-weight: 400;
  line-height: 1.18;
  margin: 0 0 1.5rem;
  letter-spacing: -0.02em;
}

.onboarding-dots {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 1.65rem;
}

.onboarding-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: transform 0.25s var(--ease-spring), background 0.2s;
}

.onboarding-dots span.is-on {
  background: var(--accent);
  transform: scale(1.15);
}

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.65rem;
}

.btn-ghost {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.85rem 1rem;
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.btn-ghost:active {
  background: rgba(255, 255, 255, 0.06);
}

/* —— Birth map —— */
.birth-map-wrap {
  margin: 0.5rem 0 0.85rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  height: min(46vh, 300px);
  min-height: 200px;
  position: relative;
  z-index: 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.birth-map-wrap .leaflet-container {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background: #e5e0d8;
  border-radius: inherit;
}

.birth-map-fallback {
  padding: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.btn-primary {
  width: 100%;
  min-height: var(--touch-min);
  margin-top: 0.25rem;
  padding: 0.95rem 1.25rem;
  background: linear-gradient(180deg, #e4d4a4 0%, var(--accent) 100%);
  color: var(--accent-ink);
  border: 1px solid rgba(216, 194, 140, 0.45);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), var(--shadow-glow);
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s var(--ease-out), opacity 0.2s;
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.35);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.flash {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--fg);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.flash--err {
  color: #ffb4b4;
  background: rgba(80, 20, 28, 0.55);
  border-color: rgba(255, 120, 120, 0.35);
}

/* —— Chart —— */
.chart-table-wrap {
  margin-top: 0.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mono-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.mono-list th,
.mono-list td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.mono-list tr:last-child td {
  border-bottom: 0;
}

.mono-list th {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(8, 6, 18, 0.75);
}

.cta-block {
  margin-top: 0.5rem;
}

/* —— Natal chart (Pixi) —— */
.natal-chart-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid rgba(216, 194, 140, 0.22);
  background: linear-gradient(165deg, #2e2740 0%, #14121a 52%, #0a090e 100%);
  box-shadow: var(--shadow-lift), 0 0 0 1px rgba(216, 194, 140, 0.08), 0 20px 50px rgba(12, 10, 8, 0.18);
  margin-bottom: 1rem;
}

.natal-chart-mount {
  position: relative;
  width: 100%;
  height: min(88vw, 420px);
  min-height: 280px;
  display: block;
  touch-action: none;
}

.natal-chart-refresh {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  pointer-events: auto;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(216, 194, 140, 0.35);
  background: rgba(8, 6, 18, 0.72);
  color: rgba(216, 194, 140, 0.95);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.natal-chart-refresh:hover {
  border-color: rgba(216, 194, 140, 0.55);
  background: rgba(14, 11, 26, 0.88);
}

.natal-chart-refresh .ui-icon__svg {
  width: 1.05rem;
  height: 1.05rem;
}

.natal-chart-panel {
  padding: 1.1rem 1rem 1.15rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(22, 18, 36, 0.92), rgba(12, 10, 22, 0.88));
  border: 1px solid var(--glass-border);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.natal-chart-panel__eyebrow {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(216, 194, 140, 0.85);
  margin-bottom: 0.5rem;
}

.natal-chart-panel__name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  color: var(--fg);
}

.natal-chart-panel__meta {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.95rem;
}

.natal-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.38rem 0.42rem;
  padding: 0.1rem 0 0;
}

.natal-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid var(--glass-border);
  background: rgba(8, 6, 18, 0.55);
  color: var(--fg-soft);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.28rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.natal-chip__sym {
  font-size: 1.02rem;
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
}

.natal-chip__lbl {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  line-height: 1.12;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.1rem;
}

.natal-chip--active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: rgba(216, 194, 140, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.natal-chip--active .natal-chip__sym {
  color: var(--accent-ink);
}

.stack-gap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: none;
  border: 0;
  border-bottom: 1.5px solid rgba(216, 194, 140, 0.55);
  padding: 0.35rem 0;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(244, 240, 232, 0.92);
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}

.btn-line:active {
  opacity: 0.65;
}

/* —— Settings panel —— */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 1, 8, 0.62);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease-out), backdrop-filter 0.32s var(--ease-out);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

.panel-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 400px);
  height: 100%;
  height: 100dvh;
  background: linear-gradient(195deg, rgba(20, 16, 34, 0.97) 0%, rgba(10, 8, 18, 0.98) 100%);
  border-left: 1px solid var(--glass-border);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.38s var(--ease-out), box-shadow 0.38s var(--ease-out);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  will-change: transform;
}

.panel.is-open {
  transform: translateX(0);
  box-shadow: -20px 0 56px rgba(0, 0, 0, 0.6), 0 0 48px rgba(216, 194, 140, 0.06);
}

.panel:not(.is-open) {
  will-change: auto;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.85rem + var(--safe-top)) calc(var(--pad-x) + var(--safe-right)) 1rem calc(var(--pad-x) + var(--safe-left));
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.panel__head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.panel__body {
  padding: 1.15rem calc(var(--pad-x) + var(--safe-right)) calc(1.5rem + var(--safe-bottom)) calc(var(--pad-x) + var(--safe-left));
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.panel__close {
  flex-shrink: 0;
  width: var(--touch-min);
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--fg);
  transition: background 0.15s;
}

.panel__close:active {
  background: rgba(216, 194, 140, 0.15);
}

.panel__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-actions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.settings-actions .btn-line {
  width: 100%;
  justify-content: flex-start;
  border-radius: var(--radius-sm);
  padding-left: 0.25rem;
}

/* —— Modal —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 1, 8, 0.65);
  animation: modalFade 0.28s var(--ease-out) both;
}

@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal__sheet {
  position: relative;
  width: 100%;
  max-height: min(88dvh, 100% - var(--safe-top));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(26, 20, 40, 0.98) 0%, rgba(12, 10, 22, 0.99) 100%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--glass-border);
  padding: 0.5rem calc(var(--pad-x) + var(--safe-right)) calc(1.75rem + var(--safe-bottom)) calc(var(--pad-x) + var(--safe-left));
  box-shadow: var(--shadow-sheet), var(--shadow-glow);
  animation: sheetUp 0.34s var(--ease-out) both;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

@keyframes sheetUp {
  from {
    transform: translateY(22px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal__handle {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: rgba(216, 194, 140, 0.45);
  margin: 0.35rem auto 0.75rem;
  opacity: 0.85;
}

.modal__head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.25rem;
}

.modal__close-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -0.25rem -0.35rem 0 0;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.modal__close-icon:active {
  background: rgba(216, 194, 140, 0.15);
  color: var(--fg);
}

.modal__title {
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  font-weight: 400;
  margin: 0 0 0.85rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  padding-right: 2rem;
}

.modal__sheet .modal-openai-play {
  margin-bottom: 1.35rem;
  max-width: 100%;
}

.modal-openai-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.modal-openai-play .ui-icon__svg {
  width: 1.1rem;
  height: 1.1rem;
}

.settings-tts-form {
  margin-top: 0.5rem;
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.interpret-create {
  margin-bottom: 0.75rem;
  padding: 1.15rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.saved-panel .interpret-create {
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.saved-panel .interpret-create.stack-gap {
  gap: 1.15rem;
}

.saved-panel .interpret-create__fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.saved-panel .interpret-create__fields .field {
  margin-bottom: 0;
  padding: 0.72rem 0.82rem 0.78rem;
  border-radius: var(--radius-md);
  background: rgba(6, 4, 18, 0.58);
  border: 1px solid rgba(216, 194, 140, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.saved-panel .interpret-create__fields .field:focus-within {
  border-color: rgba(216, 194, 140, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(216, 194, 140, 0.08);
}

.saved-panel .interpret-create__fields .field label {
  margin-bottom: 0.42rem;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: rgba(216, 194, 140, 0.82);
}

.saved-panel .interpret-create__fields .field select {
  min-height: 48px;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  border-color: rgba(216, 194, 140, 0.16);
  background-color: rgba(4, 3, 12, 0.65);
}

.saved-panel .interpret-create__fields .field-hint {
  margin-top: 0.55rem;
  margin-bottom: 0;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(216, 194, 140, 0.1);
  font-size: 0.74rem;
  line-height: 1.48;
  color: rgba(200, 190, 175, 0.78);
}

.saved-panel .interpret-create__footer {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.saved-panel .interpret-create__footer .flash {
  margin-top: 0;
  font-size: 0.82rem;
  padding: 0.55rem 0.75rem;
}

.saved-panel .interpret-create__footer .flash:empty {
  display: none;
}

.saved-panel .interpret-create__submit {
  width: 100%;
  min-height: 48px;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.loading__dots {
  display: inline-flex;
  gap: 4px;
}

.loading__dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(216, 194, 140, 0.75);
  animation: loadBounce 1.1s ease-in-out infinite;
}

.loading__dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading__dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loadBounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.empty-state {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
  max-width: 22rem;
}

/* —— Faza D: DOM motion (tap, tab sadržaj, panel već animira) —— */
.pressable {
  transition: transform 0.14s var(--ease-out), opacity 0.14s var(--ease-out);
}

.pressable:active {
  transform: scale(0.97);
  opacity: 0.9;
}

button.pressable:disabled,
.pressable[disabled] {
  transform: none;
  opacity: 1;
}

@keyframes tabMainIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-scroll.motion-tab-target.motion-tab-in {
  animation: tabMainIn 0.3s var(--ease-out) both;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
