/* ============================================================
   OSNOVNA.BA — THEME v2 ("Otok")
   Navy ink, sunset orange, mint, sun yellow. Nunito everywhere.
   Tailwind utilities handle layout; these classes carry the look.
   ============================================================ */
:root {
  --ink:      #1B1F3B;   /* navy — text, headers, nav */
  --ink-2:    #243061;   /* raised navy */
  --ink-3:    #2B3A6B;   /* sea */
  --muted:    #5B6478;
  --muted-2:  #8A93A6;
  --line:     #D8DFEA;
  --bg:       #EEF3FA;
  --card:     #FFFFFF;
  --sunset:   #FF6B35;   /* primary action */
  --sunset-2: #E85A26;
  --sunset-bg:#FFE9DF;
  --mint:     #2EC4B6;   /* success / progress */
  --mint-2:   #1E9C90;
  --mint-bg:  #E3F8F5;
  --sun:      #FFC857;   /* stars, gold */
  --sun-2:    #B07A00;
  --sun-bg:   #FFF8E6;
  --violet:   #7C5CFF;
  --violet-bg:#EFEBFF;
  --rose:     #E0405A;
  --rose-bg:  #FDE8EC;
  --bronze:   #E39B6C;
  --silver:   #C9D2E3;
  --gold:     #FFC857;
  --radius:   20px;
  --radius-sm:14px;
  --shadow:   0 1px 0 var(--line);
  --shadow-lg:0 10px 30px rgba(27,31,59,.10);
}

* { box-sizing: border-box; }
html, body { font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C9D2E3; border-radius: 99px; }

/* ── Primitives ─────────────────────────────────────────────── */
.o-card   { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.o-card-sm{ background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.o-ink    { background: var(--ink); color: #fff; border-radius: var(--radius); }
.o-pill   { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 12px; }
.o-chip   { display: inline-flex; align-items: center; gap: 5px; background: #fff; border-radius: 999px; padding: 6px 10px; box-shadow: var(--shadow); font-weight: 800; font-size: 13px; }

.btn      { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; padding: 14px 20px;
            font-weight: 900; font-size: 15px; border: 0; cursor: pointer; transition: transform .08s, background .15s, box-shadow .15s; line-height: 1.1; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--sunset); color: #fff; box-shadow: 0 6px 18px rgba(255,107,53,.28); }
.btn-primary:hover { background: var(--sunset-2); }
.btn-mint    { background: var(--mint); color: #063B36; }
.btn-mint:hover { background: #27B3A6; }
.btn-sun     { background: var(--sun); color: #3A2A00; }
.btn-sun:hover { background: #F5BC45; }
.btn-ink     { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-2); }
.btn-ghost   { background: #fff; color: var(--muted); box-shadow: var(--shadow); }
.btn-ghost:hover { color: var(--ink); }
.btn-soft    { background: var(--bg); color: var(--ink); }
.btn-sm      { padding: 9px 14px; font-size: 13px; border-radius: 12px; }
.btn-xs      { padding: 6px 10px; font-size: 12px; border-radius: 10px; }

.input { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15px; font-weight: 600;
         background: #fff; color: var(--ink); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--sunset); }
.label { font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.h1 { font-size: 26px; font-weight: 900; line-height: 1.1; letter-spacing: -.01em; }
.h2 { font-size: 20px; font-weight: 900; line-height: 1.15; }
.h3 { font-size: 15px; font-weight: 900; }
.muted { color: var(--muted); }

/* ── Nav ─────────────────────────────────────────────────────── */
.topnav { background: var(--ink); color: #fff; height: 60px; position: sticky; top: 0; z-index: 50; }
.topnav a, .topnav button { color: #C9D6F0; font-weight: 800; }
.topnav .active { color: var(--sun); border-bottom: 2px solid var(--sun); padding-bottom: 2px; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line);
             display: flex; justify-content: space-around; align-items: center; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 60px; color: var(--muted); font-size: 10px; font-weight: 900; text-decoration: none; }
.bottomnav a.active { color: var(--sunset); }
@media (min-width: 1024px) { .bottomnav { display: none; } body.has-bottomnav main { padding-bottom: 0 !important; } }
body.has-bottomnav main { padding-bottom: 84px; }

/* ── Island map ─────────────────────────────────────────────── */
.island-wrap { background: var(--ink); border-radius: 24px; color: #fff; overflow: hidden; }
.island-svg text { font-family: 'Nunito', sans-serif; font-weight: 900; }
.tile { cursor: pointer; transition: transform .12s; transform-box: fill-box; transform-origin: center; }
.tile:hover { transform: scale(1.06); }
.tile-fog     rect { fill: #2B3A6B; opacity: .6; }
.tile-sketch  rect { fill: #2B3A6B; stroke: #9FB3D9; stroke-dasharray: 4 3; }
.tile-colored rect { fill: var(--mint); }
.tile-gold    rect { fill: var(--sun); }
.tile-current rect { fill: var(--sunset); }
.tile-fog text, .tile-sketch text { fill: #9FB3D9; }
.tile-colored text { fill: #083A36; }
.tile-gold text { fill: #5B3B00; }
.tile-current text { fill: #fff; }
@keyframes tilePulse { 0%,100% { stroke-opacity: .25; } 50% { stroke-opacity: .7; } }
.tile-ring { fill: none; stroke: var(--sunset); stroke-width: 3; animation: tilePulse 1.6s ease-in-out infinite; }

/* ── Quests ─────────────────────────────────────────────────── */
.quest { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.quest.done .quest-title { color: var(--muted-2); text-decoration: line-through; }
.quest.active { border: 2px solid var(--sun); }
.quest-check { width: 28px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 10px; font-weight: 900; }
.quest.done .quest-check { background: var(--mint); color: #fff; }
.quest:not(.done) .quest-check { border: 3px solid var(--sun); }
.bar { height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: var(--sun); transition: width .5s; }
.bar.mint > div { background: var(--mint); }
.bar.ink > div { background: var(--ink); }

/* ── Gems ───────────────────────────────────────────────────── */
.gem-card { background: #fff; border-radius: 18px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow); text-align: center; }
.gem-card.cracked { border: 2px solid var(--sunset); }
.gem-card.undiscovered { opacity: .55; }
.gem-name { font-size: 11px; font-weight: 900; line-height: 1.2; }
.gem-sub  { font-size: 10px; font-weight: 800; color: var(--muted); }

/* ── Lesson content ─────────────────────────────────────────── */
.lesson-html { line-height: 1.8; color: #1e293b; }
.lesson-html h1, .lesson-html h2, .lesson-html h3 { font-weight: 800; margin: 1.25rem 0 .5rem; color: var(--ink); }
.lesson-html h1 { font-size: 1.4rem; } .lesson-html h2 { font-size: 1.2rem; } .lesson-html h3 { font-size: 1.05rem; }
.lesson-html p  { margin-bottom: .875rem; }
.lesson-html ul, .lesson-html ol { margin: .5rem 0 .875rem 1.5rem; }
.lesson-html ul { list-style: disc; } .lesson-html ol { list-style: decimal; }
.lesson-html li { margin-bottom: .3rem; }
.lesson-html table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
.lesson-html th, .lesson-html td { border: 1px solid var(--line); padding: .5rem .75rem; text-align: left; }
.lesson-html th { background: var(--bg); font-weight: 700; }
.lesson-html img { max-width: 100%; border-radius: .75rem; margin: .75rem 0; }
.lesson-html svg[viewBox] { max-width: 100%; height: auto; margin: .75rem 0; }
.lesson-html a  { color: var(--sunset-2); text-decoration: underline; }

/* ── Answer options ─────────────────────────────────────────── */
.opt-btn { transition: all .15s ease; cursor: pointer; border: 2px solid var(--line); background: #fff; border-radius: 14px; font-weight: 700; color: var(--ink); }
.opt-btn:hover:not(:disabled) { border-color: var(--sunset); background: var(--sunset-bg); transform: translateX(3px); }
.opt-btn:disabled { cursor: default; }
.opt-btn.correct  { border-color: var(--mint-2) !important; background: var(--mint-bg) !important; color: #0F5F58; }
.opt-btn.wrong    { border-color: var(--rose) !important; background: var(--rose-bg) !important; color: #9F1C32; }
.opt-btn.revealed { border-color: var(--mint-2) !important; background: #CDEFEA !important; color: #0F5F58; }
.opt-btn.missed   { border-color: var(--mint-2) !important; background: #BDE9E2 !important; color: #0F5F58; border-style: dashed !important; }
.opt-label { background: var(--bg); color: var(--muted); }
.word-bank-btn { transition: all .15s ease; cursor: pointer; }
.word-bank-btn:hover:not(:disabled) { border-color: var(--sunset) !important; background: var(--sunset-bg) !important; color: var(--sunset-2) !important; transform: translateY(-2px); }
.word-bank-btn:disabled { cursor: default; }
.word-bank-btn.correct  { border-color: var(--mint-2) !important; background: var(--mint-bg) !important; color: #0F5F58 !important; }
.word-bank-btn.wrong    { border-color: var(--rose) !important; background: var(--rose-bg) !important; color: #9F1C32 !important; }
.word-bank-btn.revealed { border-color: var(--mint-2) !important; background: #CDEFEA !important; color: #0F5F58 !important; }
.word-bank-btn.missed   { border-color: var(--mint-2) !important; background: #BDE9E2 !important; color: #0F5F58 !important; border-style: dashed !important; }
.inline-select { border: 2px solid #9FB3D9; border-radius: 10px; padding: 2px 8px; font-weight: 800; background: #fff; }

/* ── Chat bubbles ───────────────────────────────────────────── */
.bubble-user { background: var(--ink); color: #fff; border-radius: 18px 18px 6px 18px; max-width: 84%; margin-left: auto; padding: 10px 14px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.bubble-ai   { background: #fff; color: var(--ink); border-radius: 18px 18px 18px 6px; max-width: 90%; padding: 10px 14px; font-size: 14px; font-weight: 600; line-height: 1.5; box-shadow: var(--shadow); }
.chat-bg .bubble-ai { background: var(--bg); box-shadow: none; }
.lesson-card { background: var(--sun-bg); border: 1px solid #FFE39A; border-radius: 16px; padding: 12px 14px; }
.tutor-avatar { width: 28px; height: 28px; border-radius: 10px; background: var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Typing indicator ───────────────────────────────────────── */
@keyframes bounce-dot { 0%,100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-4px); opacity: 1; } }
.dot1 { animation: bounce-dot 1s infinite 0s; } .dot2 { animation: bounce-dot 1s infinite .2s; } .dot3 { animation: bounce-dot 1s infinite .4s; }

/* ── Mastery ring ───────────────────────────────────────────── */
.mastery-ring { --pct: 0; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--mint) calc(var(--pct)*1%), var(--line) 0);
                display: flex; align-items: center; justify-content: center; position: relative; }
.mastery-ring::after { content: ''; width: 42px; height: 42px; background: #fff; border-radius: 50%; position: absolute; }
.mastery-ring span { position: relative; z-index: 1; font-size: .65rem; font-weight: 900; color: var(--ink); }

/* ── Misc ───────────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .3s ease forwards; }
@keyframes xpFloat { 0% { opacity: 0; transform: translateY(0) scale(.8); } 15% { opacity: 1; transform: translateY(-4px) scale(1); } 70% { opacity: 1; transform: translateY(-20px) scale(1); } 100% { opacity: 0; transform: translateY(-36px) scale(.9); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.pop { animation: pop .35s cubic-bezier(.2,.9,.3,1.3) forwards; }
.grade-btn { transition: all .15s ease; }
.toast { background: var(--ink); color: #fff; border-radius: 16px; }
.fox { width: 76px; height: 76px; }

/* On phones the floating "Pitaj tutora" bar (bottom: 72px, ~56px tall)
   sits over the end of the question area; leave room so the last
   button and the "Prijavi grešku" link are reachable. */
@media (max-width: 1023px) { #question-area { padding-bottom: 11rem !important; } }

/* Legacy subject gradients still referenced by some views */
.subject-matematika, .subject-engleski, .subject-bosanski, .subject-biologija,
.subject-fizika, .subject-hemija, .subject-informatika, .subject-default { background: var(--ink); }
