/* Critterdoku web: isti izgled kao igra (boje iz ui/theme/Theme.kt, grafika iz res/drawable-nodpi). Prvo telefon. */
@font-face {
  font-family: "Baloo 2";
  src: url("/assets/font/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #F6F1E7;
  --surface: #FBF7F0;
  --surface-2: #EDE4D6;
  --ink: #3B322B;
  --ink-soft: rgba(59, 50, 43, .62);
  --primary: #5E7552;
  --accent: #B86B4B;
  --board: #FFFFFF;
  --grid-shadow: rgba(0, 0, 0, .08);
  --error: #C0392B;
  --hint: #E0A030;
  --ok: #3E7D4F;
  --doodle-opacity: .55;
  --card-shadow: 0 6px 18px rgba(80, 55, 30, .14), 0 1px 3px rgba(80, 55, 30, .12);
  --r0: #F3D9A4; --r1: #AAD79B; --r2: #F5AB8A; --r3: #9DCAEA; --r4: #F2DB76; --r5: #C8AAE8;
  --r6: #86D2C4; --r7: #F2A8BB; --r8: #F7C590; --r9: #C6DA84; --r10: #B4E2EE;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1B1916; --surface: #2B2723; --surface-2: #38332D; --ink: #F1E8DA; --ink-soft: rgba(241, 232, 218, .62);
  --primary: #9DB58F; --accent: #D99A7A; --board: #2B2723; --grid-shadow: rgba(0, 0, 0, .3);
  --error: #FF6F5E; --hint: #F2C14E; --ok: #8BD39B; --doodle-opacity: .07;
  --card-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  --r0: #C9925A; --r1: #4F9D5D; --r2: #E27D58; --r3: #4C7BC6; --r4: #D9B740; --r5: #8E6CC9;
  --r6: #3FA596; --r7: #D46A8C; --r8: #E5A04F; --r9: #8DAA3E; --r10: #5AAFC9;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: "Baloo 2", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 17px; line-height: 1.45;
  overflow-x: hidden;
}
/* doodle pozadina kao u igri */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/img/doodle_tile.webp") repeat; background-size: 420px; opacity: var(--doodle-opacity);
}
a { color: var(--accent); }
img { max-width: 100%; }
button { font: inherit; color: inherit; }

/* ---------- tekst kao u igri: krem→zlatni prelaz sa debelim smeđim obrubom ---------- */
.gt {
  position: relative; display: inline-block; font-weight: 800; line-height: 1.05; letter-spacing: .01em;
  color: #5A2C0C; -webkit-text-stroke: .2em #5A2C0C; paint-order: stroke fill;
  text-shadow: 0 .07em .06em rgba(60, 25, 5, .35);
}
.gt::after {
  content: attr(data-t); position: absolute; inset: 0; -webkit-text-stroke: 0; text-shadow: none;
  background: linear-gradient(180deg, #FFFADE 22%, #FFD36A 58%, #FFB12E 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- dugmad iz igre (generisane daske, tekst sa obrisom) ---------- */
.fbtn {
  position: relative; display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer;
  text-decoration: none; transition: transform .12s ease; user-select: none; -webkit-user-select: none;
}
.fbtn img { display: block; width: 100%; height: auto; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(70, 40, 10, .22)); }
.fbtn span {
  position: absolute; left: 0; right: 0; top: var(--ty, 50%); transform: translate(var(--tx, 0), -50%);
  text-align: center; font-weight: 800; font-size: var(--fs, 26px); line-height: 1; color: #fff;
  -webkit-text-stroke: .2em var(--oc, #5A2E10); paint-order: stroke fill; white-space: nowrap;
  text-shadow: 0 .08em .05em rgba(0, 0, 0, .25);
}
.fbtn:active { transform: scale(.95); }
.fbtn.pulse { animation: pulse 1.6s ease-in-out infinite; }
.fbtn[disabled], .fbtn.done { opacity: .55; filter: saturate(.6); pointer-events: none; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- raspored ---------- */
.screen { max-width: 560px; margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.topbar {
  display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 0 6px;
}
.round {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--card-shadow);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.round img { width: 30px; height: 30px; }
.round:active { transform: scale(.92); }
.title { text-align: center; font-size: 28px; }
.card { background: var(--surface); border-radius: 22px; box-shadow: var(--card-shadow); }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }

/* ---------- početna ---------- */
.home-logo { display: block; width: min(100%, 440px); margin: 6px auto 0; animation: logo-in .7s cubic-bezier(.3, 1.6, .5, 1) both, sway 4s ease-in-out .8s infinite; transform-origin: 50% 80%; }
@keyframes logo-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sway { 0%, 100% { rotate: -1deg; translate: 0 2px; } 50% { rotate: 1deg; translate: 0 -2px; } }
.tagline { text-align: center; font-size: 19px; font-weight: 600; color: var(--ink-soft); margin: 2px 0 14px; }
.home-btns { display: grid; gap: 12px; justify-items: center; }
.home-btns .fbtn { max-width: 380px; }
.sec-label { font-weight: 800; font-size: 16px; margin: 10px 0 -8px; color: var(--ink); }
.under { font-weight: 700; font-size: 15px; margin-top: -12px; }
.app-cta { padding: 18px 16px 16px; text-align: center; margin-top: 22px; }
.app-cta h2 { margin: 0 0 4px; font-size: 26px; }
.app-cta p { margin: 0 0 12px; }
.shots { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 10px; margin: 0 -4px; }
.shots img { width: 46%; min-width: 150px; border-radius: 16px; scroll-snap-align: center; box-shadow: var(--card-shadow); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tile { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; box-shadow: var(--card-shadow); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile b { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; color: #fff; font-size: 15px; text-align: center;
  background: linear-gradient(transparent, rgba(30, 20, 10, .75)); }
.play-badge {
  display: inline-flex; align-items: center; gap: 10px; background: #1d1d1d; color: #fff; text-decoration: none;
  border-radius: 12px; padding: 8px 18px 8px 14px; font-weight: 700; line-height: 1.1; box-shadow: var(--card-shadow);
}
.play-badge small { display: block; font-size: 11px; font-weight: 500; opacity: .85; letter-spacing: .04em; text-transform: uppercase; }
.play-badge svg { width: 26px; height: 26px; }
.site-foot { text-align: center; font-size: 14px; color: var(--ink-soft); padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.site-foot a { color: inherit; }
.lang-btn { background: none; border: 0; text-decoration: underline; cursor: pointer; color: inherit; font-size: 14px; padding: 0; }

/* ---------- lista nivoa ---------- */
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.lv {
  position: relative; aspect-ratio: 1; border-radius: 18px; border: 0; cursor: pointer; background: var(--surface);
  box-shadow: var(--card-shadow); display: grid; place-items: center; align-content: center; gap: 0; padding: 4px; color: var(--ink);
}
.lv b { font-size: 24px; line-height: 1; }
.lv .stars { font-size: 13px; color: #E0A030; letter-spacing: -1px; min-height: 16px; }
.lv.cur { outline: 3px solid #E0A030; animation: pulse 1.8s ease-in-out infinite; }
.lv.locked { opacity: .45; cursor: default; }
.lv.new::after { content: ""; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; background: var(--ico) center / contain no-repeat; }
.lv.app { background: linear-gradient(160deg, #FFE9B8, #F6C46A); }

/* ---------- igra ---------- */
.stats { display: flex; justify-content: center; gap: 8px; }
.chip { background: var(--surface); border-radius: 14px; box-shadow: var(--card-shadow); padding: 3px 12px; text-align: center; min-width: 74px; }
.chip small { display: block; font-size: 12px; color: var(--ink-soft); line-height: 1.2; }
.chip b { font-size: 17px; line-height: 1.2; }
.hearts { display: flex; justify-content: center; gap: 6px; margin: 8px 0 6px; min-height: 28px; }
.hearts img { width: 30px; transition: transform .3s, opacity .3s, filter .3s; }
.hearts img.lost { filter: grayscale(1); opacity: .35; transform: scale(.8); }
.hearts img.pop { animation: heart-pop .5s; }
@keyframes heart-pop { 30% { transform: scale(1.35) rotate(-8deg); } }
.rules { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent); }
.rules::-webkit-scrollbar { display: none; }
.rule-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; background: var(--surface); border: 0; cursor: pointer;
  border-radius: 16px; box-shadow: var(--card-shadow); padding: 6px 12px 6px 6px; font-weight: 700; font-size: 14px; line-height: 1.15; color: var(--ink);
  max-width: 230px; text-align: left;
}
.rule-chip img { width: 30px; height: 30px; flex: 0 0 30px; }
.guided { background: #FFE9B8; color: #4A2E14; border-radius: 16px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; font-size: 15px; margin-bottom: 8px; }
.guided img { width: 26px; }

.board-wrap { position: relative; margin: 2px auto 0; }
.sil {
  display: flex; justify-content: center; gap: 2px; width: max-content; max-width: 100%; margin: 0 auto -1px; padding: 6px 14px 4px;
  background: var(--board); border-radius: 16px 16px 0 0; position: relative;
}
.sil img { width: 26px; height: 26px; filter: grayscale(1) brightness(.6) opacity(.35); transition: filter .4s, transform .4s; }
.sil img.found { filter: none; transform: scale(1.12); }
.board {
  position: relative; overflow: visible; background: var(--board); border-radius: 18px; box-shadow: var(--card-shadow); padding: 8px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.grid { position: relative; width: 100%; aspect-ratio: 1; }
.cell { position: absolute; }
.tilebg { position: absolute; background: var(--c); box-shadow: 0 .03em 0 var(--grid-shadow); animation: tile-in .405s cubic-bezier(.34, 1.56, .64, 1) backwards; }
/* bez početnog scale(0): ako animacija ne krene (pozadinski tab, ušteda baterije), pločice su ipak vidljive */
@keyframes tile-in { from { transform: scale(0); } }
.motif {
  position: absolute; inset: 19%; background: var(--mc);
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.item, .mark, .badge { position: absolute; pointer-events: none; }
.item img { width: 100%; height: 100%; display: block; }
.item .num {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -48%); font-weight: 800; color: #FFF8EC;
  -webkit-text-stroke: .22em #5A2E10; paint-order: stroke fill; line-height: 1;
}
.mark.x img { width: 100%; height: 100%; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .18)); }

.mark.animal img { width: 100%; height: 100%; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .25)); }
/* animacije kao u igri (fx.js): iskrice X-a, čestice slijetanja, slavlje */
.item { animation: tile-in .405s cubic-bezier(.34, 1.56, .64, 1) backwards; }
.badge { animation: fade .25s ease-out var(--intro, 0ms) backwards; }
.spark { position: absolute; border-radius: 50%; background: #fff; pointer-events: none; z-index: 3; }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: visible; }
.particle { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform, opacity; }
.tile-ov { position: absolute; pointer-events: none; z-index: 2; }
.wrong-hl { background: color-mix(in srgb, var(--error) 45%, transparent); box-shadow: inset 0 0 0 .17em var(--error); }
.flash-hl { background: color-mix(in srgb, var(--error) 35%, transparent); }
.hint-box { position: absolute; inset: 0; pointer-events: none; z-index: 2; background: color-mix(in srgb, var(--hint) 10%, transparent); box-shadow: inset 0 0 0 .17em var(--hint); }
.hint-box i { position: absolute; inset: 6%; border-radius: 20%; box-shadow: inset 0 0 0 .21em var(--ink); }
.hint-box img { position: absolute; inset: 8%; width: 84%; height: 84%; opacity: .8; }
.celebrate { position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: visible; }
.cel-banner { position: absolute; top: 0; }
.cel-banner img { width: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); }
.cel-banner span { position: absolute; left: 0; right: 0; top: 66%; transform: translateY(-50%); text-align: center; font-weight: 800; color: #6B3A22; line-height: 1; }
.badge { border-radius: 50%; background: var(--board); box-shadow: 0 2px 3px rgba(0, 0, 0, .16); outline: 1px solid rgba(59, 50, 43, .25); display: grid; place-items: center; transition: opacity .3s; }
.badge img { width: 92%; height: 92%; }


.tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.tool { background: none; border: 0; cursor: pointer; display: grid; justify-items: center; gap: 0; padding: 4px 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); position: relative; }
.tool img { width: 44px; height: 44px; transition: transform .12s; }
.tool:active img { transform: scale(.88); }
.tool[disabled] { opacity: .4; }
.tool .cnt { position: absolute; top: 0; right: calc(50% - 30px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #D9534F; color: #fff; font-size: 12px; line-height: 20px; }
.tip { text-align: center; color: var(--ink-soft); font-size: 14px; margin-top: 6px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0;
  background: var(--surface); box-shadow: var(--card-shadow); border-radius: 16px; padding: 10px 16px; font-weight: 700; z-index: 30;
  transition: transform .25s, opacity .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- prozori ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(30, 22, 14, .45); backdrop-filter: blur(3px); animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: min(100%, 420px); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3); padding: 18px 18px 16px; text-align: center; animation: pop .35s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.dialog h2 { margin: 4px 0 6px; font-size: 30px; }
.dialog p { margin: 6px 0 12px; }
.dialog .art { width: 100%; border-radius: 18px; display: block; margin: 0 auto 8px; }
.dialog .fbtn { max-width: 300px; margin: 10px auto 0; }
.big-stars { font-size: 46px; letter-spacing: 4px; color: #F2B630; text-shadow: 0 2px 0 #9B6A10; line-height: 1.1; }
.big-stars .off { color: var(--surface-2); text-shadow: none; }
.res-row { display: flex; justify-content: center; gap: 18px; color: var(--ink-soft); font-weight: 700; }
.linkish { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; margin-top: 8px; font-size: 15px; }
.confetti { position: fixed; top: -40px; width: 26px; height: 26px; z-index: 50; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- pravni tekstovi ---------- */
.doc-page { background: var(--bg); }
.doc-top { text-align: center; padding: calc(14px + env(safe-area-inset-top)) 16px 0; }
.doc-logo img { width: min(70%, 300px); height: auto; }
.doc { max-width: 720px; margin: 0 auto; padding: 8px 18px 10px; background: var(--surface); border-radius: 24px; box-shadow: var(--card-shadow); }
@media (min-width: 760px) { .doc { padding: 18px 40px 24px; margin-top: 10px; } }
.doc h1 { font-size: 38px; margin: 14px 0 4px; }
.doc h2 { font-size: 23px; margin: 26px 0 6px; }
.doc h3 { font-size: 18px; margin: 18px 0 4px; }
.doc p, .doc li { font-size: 16px; }
.doc-meta { color: var(--ink-soft); font-size: 14px !important; }
.doc-links { margin-top: 28px; text-align: center; font-weight: 700; }
.doc code { font-size: 14px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }

@media (min-width: 700px) {
  .levels { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- traka na vrhu (samo široki ekran) ---------- */
.topnav { display: none; }
.side-app { display: none; }

/* ---------- široki ekran (računar, tablet položeno): sajt se otvara širok, ne kao uska kolona ---------- */
@media (min-width: 980px) {
  body { font-size: 18px; }
  .topnav {
    display: flex; align-items: center; gap: 26px; max-width: 1180px; margin: 0 auto; padding: 14px 24px 0;
    font-weight: 800; font-size: 18px;
  }
  .topnav a { color: var(--ink); text-decoration: none; }
  .topnav a:hover { color: var(--accent); }
  .topnav .nav-logo { margin-right: auto; }
  .topnav .nav-logo img { height: 64px; width: auto; display: block; }
  .topnav .nav-app { background: var(--primary); color: #fff; padding: 8px 18px; border-radius: 999px; box-shadow: var(--card-shadow); }
  .topnav .nav-app:hover { color: #fff; filter: brightness(1.08); }

  .screen.wide, .game-layout { max-width: 1400px; padding-left: 40px; padding-right: 40px; }

  /* početna: igra lijevo, aplikacija desno */
  .home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; padding-top: 10px; }
  .home-layout .home-logo { width: min(100%, 430px); }
  .home-layout .tagline { font-size: 22px; }
  .home-layout .side-cta .app-cta { margin-top: 0; position: sticky; top: 16px; }
  .home-layout .shots img { width: 31%; min-width: 0; }
  .home-layout .howto { margin-top: 22px; }

  /* igra: velika tabla lijevo, panel desno */
  .game-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 420px; column-gap: 48px; align-items: start;
    grid-template-rows: auto auto auto auto auto auto 1fr;
    grid-template-areas: "top top" "board hearts" "board guided" "board rules" "board tools" "board tip" "board .";
  }
  .game-layout > .topbar { grid-area: top; grid-template-columns: 50px 1fr 50px; }
  .game-layout > .hearts { grid-area: hearts; justify-content: flex-start; margin-top: 4px; }
  .game-layout > .guided { grid-area: guided; }
  .game-layout > .rules {
    grid-area: rules; flex-wrap: wrap; overflow: visible; mask-image: none; -webkit-mask-image: none; padding: 4px 0 8px;
  }
  .game-layout > .rules .rule-chip { max-width: 100%; }
  .game-layout > #board { grid-area: board; width: min(100%, calc(100dvh - 250px)); min-width: 440px; justify-self: center; }
  .game-layout > .tools { grid-area: tools; margin-top: 10px; }
  .game-layout > .tip { grid-area: tip; text-align: left; }
  .game-layout .sil img { width: 32px; height: 32px; }
  .game-layout { grid-template-areas: "top top" "board hearts" "board guided" "board rules" "board tools" "board tip" "board app"; }
  .game-layout > .side-app { grid-area: app; display: block; overflow: hidden; margin-top: 14px; }
  .side-app img { width: 100%; height: 120px; object-fit: cover; display: block; }
  .side-app div { padding: 10px 14px 14px; }
  .side-app b { font-size: 18px; }
  .side-app p { font-size: 14px; margin: 4px 0 10px; color: var(--ink-soft); }

  .levels { grid-template-columns: repeat(10, 1fr); gap: 12px; }
  .screen.wide .app-cta .shots img { width: 31%; min-width: 0; }
  .site-foot { font-size: 15px; }
}
