/* MYSTICA — The Grand Academy · system wizualny (rozdz. 16 dokumentacji)
 * Atramentowa czerń, śliwkowy fiolet, stare złoto, przygaszony ametyst, pergamin.
 * Motywy: ciemny (domyślny) i pergaminowy (jasny tryb czytania). Bez infantylnej grywalizacji.
 * Układ: telefon — jedna kolumna + dolne zakładki; od 840 px — boczne menu; od 1600 px — panel kontekstowy.
 */

:root {
  --bg: #0B0912;
  --bg-2: #120E1B;
  --surface: #171220;
  --raised: #241B30;
  --raised-2: #2E2340;
  --line: rgba(213, 184, 122, .16);
  --line-2: rgba(213, 184, 122, .28);
  --gold: #B99A5B;
  --gold-l: #D5B87A;
  --gold-d: #8E7440;
  --amethyst: #BFA9D6;
  --plum: #4A2C5E;
  --plum-l: #6B4785;
  --text: #F3EBDC;
  --text-2: #D2C6D8;
  --text-3: #A99DB3;
  --success: #93D0B4;
  --error: #E9B1B8;
  --warn: #E7C98B;
  --parchment: #F1E7D4;
  --on-gold: #1A1222;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-s: 0 4px 14px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(213, 184, 122, .2), 0 8px 30px rgba(74, 44, 94, .45);
  --r-card: 20px;
  --r-s: 12px;
  --r-xs: 8px;
  --serif: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --t-fast: 130ms;
  --t-mid: 220ms;
  --nav-h: 68px;
  --top-h: 60px;
  --side-w: 264px;
  --accent: var(--gold);
  --claim-a: #93D0B4;
  --claim-b: #9DB8E0;
  --claim-c: #BFA9D6;
  --claim-d: #D5B87A;
  --claim-e: #E9B1B8;
  --bg-art: radial-gradient(1200px 700px at 85% -10%, rgba(107, 71, 133, .32), transparent 60%),
            radial-gradient(900px 600px at -10% 20%, rgba(74, 44, 94, .35), transparent 60%),
            radial-gradient(700px 500px at 50% 110%, rgba(185, 154, 91, .10), transparent 60%);
  color-scheme: dark;
  font-size: 16px;
}

:root[data-theme="parchment"] {
  --bg: #F1E7D4;
  --bg-2: #EADDC4;
  --surface: #FBF6EC;
  --raised: #FFFFFF;
  --raised-2: #F5ECDB;
  --line: rgba(74, 44, 94, .16);
  --line-2: rgba(74, 44, 94, .28);
  --gold: #8A6A2E;
  --gold-l: #7A5B22;
  --gold-d: #A88A4F;
  --amethyst: #6B4785;
  --text: #1F1626;
  --text-2: #43354D;
  --text-3: #6D5F75;
  --success: #2F7D5D;
  --error: #A33A48;
  --warn: #8A6414;
  --on-gold: #FFF9EE;
  --shadow: 0 10px 30px rgba(60, 40, 20, .14);
  --shadow-s: 0 3px 10px rgba(60, 40, 20, .10);
  --glow: 0 0 0 1px rgba(138, 106, 46, .25), 0 8px 24px rgba(60, 40, 20, .12);
  --claim-a: #2F7D5D;
  --claim-b: #2F5E96;
  --claim-c: #6B4785;
  --claim-d: #8A6414;
  --claim-e: #A33A48;
  --bg-art: radial-gradient(1000px 600px at 90% -10%, rgba(185, 154, 91, .22), transparent 60%),
            radial-gradient(800px 500px at -10% 30%, rgba(107, 71, 133, .10), transparent 60%);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #F1E7D4; --bg-2: #EADDC4; --surface: #FBF6EC; --raised: #FFFFFF; --raised-2: #F5ECDB;
    --line: rgba(74, 44, 94, .16); --line-2: rgba(74, 44, 94, .28);
    --gold: #8A6A2E; --gold-l: #7A5B22; --gold-d: #A88A4F; --amethyst: #6B4785;
    --text: #1F1626; --text-2: #43354D; --text-3: #6D5F75;
    --success: #2F7D5D; --error: #A33A48; --warn: #8A6414; --on-gold: #FFF9EE;
    --shadow: 0 10px 30px rgba(60, 40, 20, .14); --shadow-s: 0 3px 10px rgba(60, 40, 20, .10);
    --glow: 0 0 0 1px rgba(138, 106, 46, .25), 0 8px 24px rgba(60, 40, 20, .12);
    --claim-a: #2F7D5D; --claim-b: #2F5E96; --claim-c: #6B4785; --claim-d: #8A6414; --claim-e: #A33A48;
    --bg-art: radial-gradient(1000px 600px at 90% -10%, rgba(185, 154, 91, .22), transparent 60%),
              radial-gradient(800px 500px at -10% 30%, rgba(107, 71, 133, .10), transparent 60%);
    color-scheme: light;
  }
}

:root[data-text="l"] { font-size: 17.5px; }
:root[data-text="xl"] { font-size: 19px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); background-image: var(--bg-art); background-attachment: fixed;
  color: var(--text); font-family: var(--sans); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .005em; color: var(--text); }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.9rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; font-family: var(--sans); font-weight: 650; letter-spacing: 0; }
p { margin: 0 0 .9em; }
a { color: var(--gold-l); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
strong { font-weight: 650; color: var(--text); }
em { font-style: italic; }
small, .small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
img, svg { max-width: 100%; }
svg.i { width: 1.25em; height: 1.25em; flex: 0 0 auto; vertical-align: -.22em; }
svg.chev { width: 18px; height: 18px; color: var(--text-3); }
.li-ic svg, .level-no svg { width: 21px; height: 21px; }
.badge svg.i { width: 12px; height: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(185, 154, 91, .35); color: var(--text); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold-l); outline-offset: 3px; border-radius: 6px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 999; background: var(--gold); color: var(--on-gold); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.gold { color: var(--gold-l); }
.center { text-align: center; }
.serif { font-family: var(--serif); }
.eyebrow { font-family: var(--sans); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-l); font-weight: 600; margin-bottom: .4rem; display: block; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 12px; }
.stack-l > * + * { margin-top: 22px; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 26px; } .mt4 { margin-top: 40px; }
.mb0 { margin-bottom: 0; } .mb2 { margin-bottom: 16px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------------- powłoka aplikacji ---------------- */

#app { min-height: 100vh; min-height: 100dvh; }
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); flex: 1 0 auto; }
.content.narrow { max-width: 760px; }
.content.focus { padding-bottom: 40px; max-width: 820px; }

.top {
  position: sticky; top: 0; z-index: 40; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 16px; display: flex; align-items: center; gap: 8px;
  background: linear-gradient(to bottom, rgba(11, 9, 18, .92), rgba(11, 9, 18, .78));
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
:root[data-theme="parchment"] .top { background: linear-gradient(to bottom, rgba(241, 231, 212, .94), rgba(241, 231, 212, .82)); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .top { background: linear-gradient(to bottom, rgba(241, 231, 212, .94), rgba(241, 231, 212, .82)); } }
.top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; min-width: 0; }
.wordmark { font-family: var(--serif); font-weight: 600; letter-spacing: .32em; font-size: 1.15rem; padding-left: .32em; color: var(--text); }
.wordmark small { display: block; font-family: var(--sans); font-size: .58rem; letter-spacing: .28em; color: var(--gold-l); margin-top: -3px; }
.top .title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: rgba(213, 184, 122, .08); color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-l); box-shadow: 0 0 0 2px var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 1.1rem;
  background: radial-gradient(circle at 30% 25%, var(--plum-l), var(--plum)); color: var(--gold-l); border: 1px solid var(--line-2);
}

.bnav {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50; height: var(--nav-h);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px; border-radius: 22px;
  background: rgba(23, 18, 32, .9); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
:root[data-theme="parchment"] .bnav { background: rgba(251, 246, 236, .94); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .bnav { background: rgba(251, 246, 236, .94); } }
.bnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--text-3);
  font-size: .68rem; font-weight: 600; letter-spacing: .02em; border-radius: 16px; transition: color var(--t-fast), background var(--t-fast); min-height: 44px;
}
.bnav a svg { width: 23px; height: 23px; }
.bnav a.on { color: var(--gold-l); background: rgba(185, 154, 91, .12); }
.bnav a:hover { color: var(--text); }

@media (min-width: 840px) {
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--side-w); flex: 0 0 var(--side-w);
    padding: 22px 14px 16px; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(23, 18, 32, .85), rgba(11, 9, 18, .6));
    overflow-y: auto;
  }
  :root[data-theme="parchment"] .side { background: linear-gradient(180deg, rgba(251, 246, 236, .9), rgba(241, 231, 212, .7)); }
  @media (prefers-color-scheme: light) { :root[data-theme="auto"] .side { background: linear-gradient(180deg, rgba(251, 246, 236, .9), rgba(241, 231, 212, .7)); } }
  .side .brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; padding: 6px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
  .side .brand svg { width: 64px; height: 64px; }
  .side nav { display: flex; flex-direction: column; gap: 4px; }
  .side nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--text-2); text-decoration: none; font-weight: 550; font-size: .95rem;
    border: 1px solid transparent; transition: background var(--t-fast), color var(--t-fast);
  }
  .side nav a svg { width: 21px; height: 21px; opacity: .85; }
  .side nav a:hover { background: rgba(213, 184, 122, .07); color: var(--text); }
  .side nav a.on { background: linear-gradient(90deg, rgba(185, 154, 91, .16), rgba(185, 154, 91, .04)); color: var(--gold-l); border-color: var(--line); }
  .side .side-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
  .side .side-foot { margin-top: auto; padding-top: 16px; font-size: .78rem; color: var(--text-3); }
  .side .side-foot a { color: var(--text-3); }
  .bnav { display: none; }
  .content { padding: 28px 32px 60px; }
  .top { padding-left: 28px; }
  .top .brand.mobile-only { display: none; }
}
@media (min-width: 1600px) {
  .content.with-panel { max-width: 1360px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
  .context-panel { display: block !important; position: sticky; top: calc(var(--top-h) + 20px); }
}
.context-panel { display: none; }

.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-3); padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); }
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; }
.sync-pill.pending i { background: var(--warn); }
.sync-pill.offline i { background: var(--text-3); }

/* ---------------- przyciski ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 11px 20px; border-radius: 14px;
  border: 1px solid var(--line-2); background: rgba(213, 184, 122, .06); color: var(--text); font-weight: 600; font-size: .96rem; letter-spacing: .01em;
  text-decoration: none; transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
  user-select: none; text-align: center; line-height: 1.25;
}
.btn:hover { background: rgba(213, 184, 122, .12); border-color: var(--gold); color: var(--text); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn svg { width: 19px; height: 19px; flex: 0 0 auto; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: var(--on-gold); border-color: transparent;
  box-shadow: 0 6px 22px rgba(185, 154, 91, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.primary:hover { filter: brightness(1.06); color: var(--on-gold); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(213, 184, 122, .08); color: var(--text); }
.btn.danger { border-color: rgba(233, 177, 184, .4); color: var(--error); background: rgba(233, 177, 184, .06); }
.btn.small { min-height: 36px; padding: 7px 14px; font-size: .86rem; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::after { content: ''; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }
.link-btn { background: none; border: 0; padding: 0; color: var(--gold-l); text-decoration: underline; text-underline-offset: 3px; font-weight: 550; min-height: 32px; }

/* ---------------- karty i powierzchnie ---------------- */

.card {
  position: relative; background: linear-gradient(180deg, rgba(36, 27, 48, .72), rgba(23, 18, 32, .82)); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow-s);
}
:root[data-theme="parchment"] .card { background: var(--surface); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .card { background: var(--surface); } }
.card.flat { box-shadow: none; }
.card.tight { padding: 14px 16px; }
.card.glow { box-shadow: var(--glow); border-color: var(--line-2); }
.card.hero { padding: 26px 22px; overflow: hidden; }
.card h3 { margin-bottom: .35em; }
a.card, button.card { display: block; text-decoration: none; color: inherit; text-align: left; width: 100%; transition: transform var(--t-mid), border-color var(--t-mid), box-shadow var(--t-mid); }
a.card:hover, button.card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--glow); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: 1fr; }
.grid.tools { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
@media (min-width: 600px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-head h2 { margin: 0; font-size: 1.45rem; }
.section-head a, .section-head button { font-size: .88rem; }

.page-head { margin: 4px 0 22px; }
.page-head h1 { margin-bottom: .2em; }
.page-head p { color: var(--text-2); max-width: 640px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .82rem; color: var(--text-3); margin-bottom: 10px; }
.crumbs a { color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--gold-l); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--line); color: var(--text-2); background: rgba(213, 184, 122, .05); min-height: 32px; white-space: nowrap;
}
button.chip:hover { border-color: var(--gold); color: var(--text); }
.chip.on { background: rgba(185, 154, 91, .18); color: var(--gold-l); border-color: var(--gold); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .72rem; font-weight: 650; letter-spacing: .03em; border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.badge.ok { color: var(--success); border-color: rgba(147, 208, 180, .4); background: rgba(147, 208, 180, .08); }
.badge.lock { color: var(--text-3); }
.badge.gold { color: var(--gold-l); border-color: rgba(213, 184, 122, .45); background: rgba(213, 184, 122, .08); }
.badge.err { color: var(--error); border-color: rgba(233, 177, 184, .45); }
.badge.soon { color: var(--amethyst); border-color: rgba(191, 169, 214, .4); }

.claim { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 650; letter-spacing: .02em; border-radius: 99px; padding: 3px 10px 3px 4px; border: 1px solid; background: transparent; }
.claim b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: .72rem; color: var(--bg); }
.claim.A { color: var(--claim-a); border-color: color-mix(in srgb, var(--claim-a) 45%, transparent); } .claim.A b { background: var(--claim-a); }
.claim.B { color: var(--claim-b); border-color: color-mix(in srgb, var(--claim-b) 45%, transparent); } .claim.B b { background: var(--claim-b); }
.claim.C { color: var(--claim-c); border-color: color-mix(in srgb, var(--claim-c) 45%, transparent); } .claim.C b { background: var(--claim-c); }
.claim.D { color: var(--claim-d); border-color: color-mix(in srgb, var(--claim-d) 45%, transparent); } .claim.D b { background: var(--claim-d); }
.claim.E { color: var(--claim-e); border-color: color-mix(in srgb, var(--claim-e) 45%, transparent); } .claim.E b { background: var(--claim-e); }
:root[data-theme="parchment"] .claim b { color: #fff; }

.progress { height: 6px; border-radius: 99px; background: rgba(213, 184, 122, .12); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-d), var(--gold-l)); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.progress.thin { height: 4px; }
.ring { --p: 0; --size: 64px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: conic-gradient(var(--gold-l) calc(var(--p) * 1%), rgba(213, 184, 122, .13) 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-family: var(--serif); font-weight: 700; font-size: 1.05rem; }

.dots { display: flex; gap: 6px; align-items: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(213, 184, 122, .2); display: block; }
.dots i.on { background: var(--gold-l); box-shadow: 0 0 8px rgba(213, 184, 122, .6); }

.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: rgba(23, 18, 32, .55); }
:root[data-theme="parchment"] .list { background: var(--surface); }
.list > * + * { border-top: 1px solid var(--line); }
.li {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: var(--text); min-height: 60px; background: transparent; border: 0; width: 100%; text-align: left;
  transition: background var(--t-fast);
}
a.li:hover, button.li:hover { background: rgba(213, 184, 122, .06); }
.li .li-ic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(185, 154, 91, .1); color: var(--gold-l); border: 1px solid var(--line); }
.li .li-ic svg { width: 21px; height: 21px; }
.li .li-t { font-weight: 600; line-height: 1.3; }
.li .li-s { font-size: .84rem; color: var(--text-3); line-height: 1.4; margin-top: 2px; }
.li .chev { color: var(--text-3); width: 18px; height: 18px; flex: 0 0 auto; }
.li.locked { opacity: .62; }
.li.done .li-ic { background: rgba(147, 208, 180, .12); color: var(--success); border-color: rgba(147, 208, 180, .35); }
.li.current { background: linear-gradient(90deg, rgba(185, 154, 91, .13), transparent); }

.empty { text-align: center; padding: 34px 18px; color: var(--text-2); }
.empty svg { width: 54px; height: 54px; color: var(--gold); opacity: .8; margin-bottom: 10px; }
.empty h3 { margin-bottom: .3em; }

.notice { display: flex; gap: 12px; padding: 13px 15px; border-radius: 14px; border: 1px solid var(--line); background: rgba(213, 184, 122, .06); font-size: .92rem; line-height: 1.5; color: var(--text-2); }
.notice svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--gold-l); margin-top: 2px; }
.notice.safety { border-color: rgba(233, 177, 184, .35); background: rgba(233, 177, 184, .06); }
.notice.safety svg { color: var(--error); }
.notice.ok { border-color: rgba(147, 208, 180, .35); background: rgba(147, 208, 180, .07); }
.notice.ok svg { color: var(--success); }
.notice.method svg { color: var(--amethyst); }
.notice b { color: var(--text); }

.skeleton { border-radius: 14px; background: linear-gradient(90deg, rgba(213, 184, 122, .06), rgba(213, 184, 122, .13), rgba(213, 184, 122, .06)); background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- formularze ---------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 600; font-size: .92rem; color: var(--text); }
.field .hint { font-size: .82rem; color: var(--text-3); line-height: 1.45; }
.input, textarea.input, select.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(11, 9, 18, .45); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast); font-size: 1rem;
}
:root[data-theme="parchment"] .input { background: #fff; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .input { background: #fff; } }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.55; }
.input::placeholder { color: var(--text-3); opacity: .8; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185, 154, 91, .22); outline: none; }
.input.invalid { border-color: var(--error); }
.field .err { color: var(--error); font-size: .84rem; }
.counter { font-size: .76rem; color: var(--text-3); text-align: right; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; line-height: 1.45; }
.check input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; border: 1.5px solid var(--line-2); background: rgba(11, 9, 18, .3); margin: 0; display: grid; place-items: center; transition: background var(--t-fast), border-color var(--t-fast); }
.check input:checked { background: var(--gold); border-color: var(--gold); }
.check input:checked::after { content: ''; width: 6px; height: 11px; border: solid var(--on-gold); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]:checked::after { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--on-gold); transform: none; }
.check:focus-within input { box-shadow: 0 0 0 3px rgba(185, 154, 91, .3); }
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: 0 0 50px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(213, 184, 122, .16); border: 1px solid var(--line-2); transition: background var(--t-fast); }
.switch span::before { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: var(--text-2); transition: transform var(--t-mid), background var(--t-mid); }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::before { transform: translateX(20px); background: var(--on-gold); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(185, 154, 91, .35); }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(11, 9, 18, .4); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .88rem; min-height: 38px; }
.seg button.on { background: var(--raised-2); color: var(--gold-l); box-shadow: var(--shadow-s); }
:root[data-theme="parchment"] .seg { background: var(--bg-2); }

/* ---------------- okna, arkusze, komunikaty ---------------- */

.scrim { position: fixed; inset: 0; z-index: 90; background: rgba(5, 3, 9, .62); backdrop-filter: blur(3px); animation: fade var(--t-mid) ease both; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); animation: up var(--t-mid) cubic-bezier(.2, .8, .2, 1) both;
}
.sheet::before { content: ''; display: block; width: 44px; height: 4px; border-radius: 9px; background: var(--line-2); margin: 4px auto 14px; }
.sheet h2 { font-size: 1.5rem; }
@media (min-width: 700px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line-2); padding: 26px 28px; }
  .sheet::before { display: none; }
}
.sheet.wide { max-width: 900px; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.rise { animation: rise .42s cubic-bezier(.2, .8, .2, 1) both; }

.toasts { position: fixed; z-index: 120; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
@media (min-width: 840px) { .toasts { bottom: 28px; } }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: .92rem; animation: up var(--t-mid) both; }
.toast svg { width: 20px; height: 20px; color: var(--gold-l); flex: 0 0 auto; }
.toast.ok svg { color: var(--success); }
.toast.err svg { color: var(--error); }

/* ---------------- Grand Hall ---------------- */

.hall-hero { position: relative; overflow: hidden; border-radius: 26px; padding: 26px 22px; border: 1px solid var(--line-2); box-shadow: var(--glow);
  background: radial-gradient(500px 300px at 100% 0%, rgba(213, 184, 122, .16), transparent 60%), linear-gradient(160deg, #2A1D3A, #160F21 60%, #120D1B); }
:root[data-theme="parchment"] .hall-hero { background: radial-gradient(500px 300px at 100% 0%, rgba(185, 154, 91, .25), transparent 60%), linear-gradient(160deg, #FFFDF8, #F4EAD8); }
.hall-hero .art { position: absolute; right: -40px; top: -30px; width: 240px; height: 240px; opacity: .22; color: var(--gold-l); pointer-events: none; }
.hall-hero h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.5rem); margin-bottom: .2em; position: relative; }
.hall-hero .lead { color: var(--text-2); max-width: 520px; position: relative; }
.next-step { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; position: relative; }
@media (min-width: 640px) { .next-step { flex-direction: row; align-items: center; } }
.next-step .ns-info { flex: 1 1 auto; min-width: 0; }
.next-step .ns-label { font-size: .78rem; color: var(--gold-l); text-transform: uppercase; letter-spacing: .14em; font-weight: 650; }
.next-step .ns-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; line-height: 1.2; margin: 3px 0; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(23, 18, 32, .5); text-align: center; }
:root[data-theme="parchment"] .stat { background: var(--surface); }
.stat b { display: block; font-family: var(--serif); font-size: 1.6rem; line-height: 1.1; color: var(--gold-l); }
.stat span { font-size: .76rem; color: var(--text-3); letter-spacing: .02em; }

/* ---------------- mapa świata / portale akademii ---------------- */

.portals { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.portal {
  --accent: var(--gold); position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--text); border-radius: 160px 160px 22px 22px;
  padding: 26px 18px 18px; min-height: 300px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: radial-gradient(180px 160px at 50% 18%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%), linear-gradient(180deg, rgba(36, 27, 48, .9), rgba(15, 11, 22, .95));
  box-shadow: var(--shadow-s); transition: transform var(--t-mid), box-shadow var(--t-mid), border-color var(--t-mid);
}
:root[data-theme="parchment"] .portal { background: radial-gradient(180px 160px at 50% 18%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%), linear-gradient(180deg, #FFFDF8, #F3E8D3); }
.portal:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 14px 34px rgba(0, 0, 0, .4); }
.portal .emblem { width: 92px; height: 92px; margin: 4px auto 14px; color: var(--accent); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 50%, transparent)); }
.portal .p-no { font-family: var(--serif); font-size: .9rem; color: var(--accent); letter-spacing: .2em; text-align: center; }
.portal h3 { text-align: center; font-size: 1.45rem; margin: 2px 0 6px; }
.portal p { font-size: .84rem; color: var(--text-2); text-align: center; line-height: 1.45; margin: 0 0 12px; }
.portal .p-foot { margin-top: auto; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.portal.soon { filter: saturate(.75); }
.portal.soon .emblem { opacity: .65; }

.academy-hero { --accent: var(--gold); position: relative; overflow: hidden; border-radius: 26px; padding: 26px 22px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: radial-gradient(420px 300px at 85% 10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%), linear-gradient(160deg, #241A31, #120D1B); }
:root[data-theme="parchment"] .academy-hero { background: radial-gradient(420px 300px at 85% 10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%), linear-gradient(160deg, #FFFDF8, #F2E7D2); }
.academy-hero .emblem { position: absolute; right: 14px; top: 14px; width: 110px; height: 110px; color: var(--accent); opacity: .5; }
.academy-hero h1 { max-width: 80%; }

.level-card { --accent: var(--gold); display: flex; gap: 16px; align-items: center; }
.level-no { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 16px; display: grid; place-items: center; font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.level-card.done .level-no { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); border-color: rgba(147, 208, 180, .45); }
.level-card.locked { opacity: .6; }

/* ---------------- sala lekcji (tryb skupienia) ---------------- */

.focusbar { position: sticky; top: 0; z-index: 45; padding: env(safe-area-inset-top) 12px 0; background: linear-gradient(to bottom, rgba(11, 9, 18, .95), rgba(11, 9, 18, .82)); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
:root[data-theme="parchment"] .focusbar { background: rgba(241, 231, 212, .94); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .focusbar { background: rgba(241, 231, 212, .94); } }
.focusbar .fb-row { display: flex; align-items: center; gap: 10px; height: 58px; max-width: 820px; margin: 0 auto; }
.focusbar .fb-step { margin-left: auto; font-size: .85rem; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.focusbar .progress { max-width: 820px; margin: 0 auto 10px; }
.stages { display: flex; gap: 6px; max-width: 820px; margin: 0 auto 10px; }
.stages i { flex: 1; height: 4px; border-radius: 99px; background: rgba(213, 184, 122, .15); }
.stages i.done { background: var(--gold-d); }
.stages i.on { background: var(--gold-l); box-shadow: 0 0 10px rgba(213, 184, 122, .5); }

.stage-head { margin: 18px 0 16px; }
.stage-head .eyebrow { margin-bottom: .35rem; }
.reading { font-size: 1.06rem; line-height: 1.72; max-width: 720px; }
.reading p { margin-bottom: 1em; }
.reading ul { margin: 0 0 1em; padding-left: 1.2em; }
.reading li { margin-bottom: .35em; }
.reading li::marker { color: var(--gold); }

.tblock { margin: 0 0 18px; padding: 20px; border-radius: 20px; border: 1px solid var(--line); background: rgba(23, 18, 32, .55); }
:root[data-theme="parchment"] .tblock { background: var(--surface); }
.tblock .tb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tblock h3 { margin: 0; font-size: 1.35rem; }
.tblock .tb-src { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--text-3); }
.tblock .tb-src button { background: none; border: 1px dashed var(--line-2); color: var(--text-2); border-radius: 8px; padding: 3px 9px; font-size: .78rem; min-height: 30px; }
.tblock .tb-src button:hover { border-color: var(--gold); color: var(--gold-l); }
.tblock.definition { border-left: 3px solid var(--gold); }
.tblock.definition .term { font-family: var(--serif); font-size: 1.5rem; font-style: italic; color: var(--gold-l); }
.tblock.callout.method { border-color: rgba(191, 169, 214, .35); background: rgba(191, 169, 214, .06); }
.tblock.callout.safety { border-color: rgba(233, 177, 184, .4); background: rgba(233, 177, 184, .06); }
.tblock.callout.info { border-color: rgba(157, 184, 224, .35); }
.timeline { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--gold), rgba(185, 154, 91, .1)); }
.timeline li { position: relative; padding: 0 0 14px 32px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold-l); }
.timeline .tl-date { font-family: var(--serif); font-weight: 700; color: var(--gold-l); font-size: 1.05rem; display: block; }
.tbl-wrap { overflow-x: auto; margin: 4px -4px 0; padding: 0 4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 420px; }
table.tbl th { text-align: left; font-weight: 650; color: var(--gold-l); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
table.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
table.tbl tr:last-child td { border-bottom: 0; }

.objectives { list-style: none; padding: 0; margin: 0; }
.objectives li { display: flex; gap: 10px; padding: 7px 0; }
.objectives li svg { width: 18px; height: 18px; color: var(--gold-l); flex: 0 0 auto; margin-top: 4px; }

.nav-row { display: flex; gap: 10px; justify-content: space-between; margin-top: 26px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; }
.nav-row .btn.primary { flex: 1 1 auto; max-width: 340px; margin-left: auto; }

/* odkrywanie i zadania */
.opt {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2);
  background: rgba(23, 18, 32, .5); color: var(--text); margin-bottom: 10px; min-height: 52px; line-height: 1.45; transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
:root[data-theme="parchment"] .opt { background: var(--surface); }
.opt:hover { border-color: var(--gold); }
.opt .opt-k { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: .85rem; border: 1px solid var(--line-2); color: var(--gold-l); }
.opt.sel { border-color: var(--gold); background: rgba(185, 154, 91, .13); }
.opt.sel .opt-k { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.opt.right { border-color: var(--success); background: rgba(147, 208, 180, .1); }
.opt.right .opt-k { background: var(--success); color: var(--bg); border-color: var(--success); }
.opt.wrong { border-color: var(--error); background: rgba(233, 177, 184, .08); }
.opt.wrong .opt-k { background: var(--error); color: var(--bg); border-color: var(--error); }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 6px; padding: 14px 16px; border-radius: 14px; font-size: .95rem; line-height: 1.55; border: 1px solid var(--line); background: rgba(213, 184, 122, .06); animation: rise .3s both; }
.feedback.ok { border-color: rgba(147, 208, 180, .45); background: rgba(147, 208, 180, .08); }
.feedback.no { border-color: rgba(233, 177, 184, .45); background: rgba(233, 177, 184, .07); }
.feedback b { display: block; margin-bottom: 2px; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: flex; flex-direction: column; gap: 8px; }
.mitem { padding: 12px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(23, 18, 32, .5); text-align: left; min-height: 52px; font-size: .92rem; line-height: 1.35; color: var(--text); transition: all var(--t-fast); }
:root[data-theme="parchment"] .mitem { background: var(--surface); }
.mitem:hover { border-color: var(--gold); }
.mitem.sel { border-color: var(--gold-l); background: rgba(185, 154, 91, .16); box-shadow: 0 0 0 2px rgba(213, 184, 122, .25); }
.mitem.paired { border-color: rgba(147, 208, 180, .5); background: rgba(147, 208, 180, .08); color: var(--text-2); }
.mitem.bad { border-color: var(--error); animation: shake .35s; }
.mitem .tag { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 6px; background: var(--success); color: var(--bg); font-size: .72rem; font-weight: 700; margin-right: 6px; padding: 0 5px; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.order-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(23, 18, 32, .5); }
:root[data-theme="parchment"] .order-item { background: var(--surface); }
.order-item .oi-n { font-family: var(--serif); font-weight: 700; color: var(--gold-l); width: 22px; text-align: center; }
.order-item .oi-t { flex: 1 1 auto; line-height: 1.4; }
.order-item .oi-l { font-size: .78rem; color: var(--success); display: block; }
.order-item .icon-btn { width: 40px; height: 40px; }
.order-item.ok { border-color: rgba(147, 208, 180, .5); }
.order-item.no { border-color: rgba(233, 177, 184, .5); }

.classify-item { padding: 14px; border-radius: 14px; border: 1px solid var(--line-2); margin-bottom: 10px; background: rgba(23, 18, 32, .45); }
:root[data-theme="parchment"] .classify-item { background: var(--surface); }
.classify-item .ci-t { margin-bottom: 10px; line-height: 1.45; }
.classify-item .ci-why { margin-top: 8px; font-size: .86rem; color: var(--text-2); }
.classify-item.ok { border-color: rgba(147, 208, 180, .5); }
.classify-item.no { border-color: rgba(233, 177, 184, .5); }

.flip { perspective: 1000px; min-height: 150px; }
.flip button { width: 100%; height: 100%; min-height: 150px; border: 0; padding: 0; background: none; position: relative; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2, .7, .2, 1); }
.flip.on button { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; border: 1px solid var(--line-2); padding: 16px; display: flex; flex-direction: column; justify-content: center; text-align: left; background: rgba(23, 18, 32, .6); }
:root[data-theme="parchment"] .flip .face { background: var(--surface); }
.flip .face.back { transform: rotateY(180deg); background: linear-gradient(160deg, rgba(74, 44, 94, .5), rgba(23, 18, 32, .8)); border-color: var(--gold); }
:root[data-theme="parchment"] .flip .face.back { background: #F6EDDC; }
.flip .face h4 { margin: 0 0 6px; font-family: var(--serif); font-size: 1.2rem; }

/* warsztat */
.wblock { margin-bottom: 22px; }
.wblock > .wb-label { font-weight: 650; font-size: 1.02rem; margin-bottom: 8px; display: block; }
.wtable { display: flex; flex-direction: column; gap: 12px; }
.wrow { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: rgba(23, 18, 32, .45); }
:root[data-theme="parchment"] .wrow { background: var(--surface); }
.wrow .wr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wrow .wr-no { font-family: var(--serif); font-weight: 700; color: var(--gold-l); font-size: 1.1rem; }
.wrow .field { margin-bottom: 10px; }
.wrow .field:last-child { margin-bottom: 0; }
.wrow.done { border-color: rgba(147, 208, 180, .4); }
@media (min-width: 900px) {
  .wrow .wr-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 12px; }
}
.autosave { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-3); }
.autosave i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; }
.autosave.saving i { background: var(--warn); }
.timer-box { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px; border-radius: 22px; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 30%, rgba(107, 71, 133, .35), transparent 70%); }
.timer-face { font-family: var(--serif); font-size: 3rem; font-weight: 600; letter-spacing: .04em; }
.breath { width: 120px; height: 120px; border-radius: 50%; border: 2px solid var(--gold); display: grid; place-items: center; animation: breath 10s ease-in-out infinite; box-shadow: 0 0 40px rgba(213, 184, 122, .25); }
.breath.paused { animation-play-state: paused; }
@keyframes breath { 0%, 100% { transform: scale(.72); } 40%, 50% { transform: scale(1); } }

.criteria { list-style: none; padding: 0; margin: 0; }
.criteria li { display: flex; gap: 10px; padding: 6px 0; color: var(--text-2); line-height: 1.45; }
.criteria li svg { width: 18px; height: 18px; color: var(--gold); flex: 0 0 auto; margin-top: 3px; }

/* nagroda */
.reward-burst { position: relative; text-align: center; padding: 30px 16px 10px; }
.reward-burst .seal { width: 150px; height: 150px; margin: 0 auto 18px; color: var(--gold-l); animation: seal .9s cubic-bezier(.2, .8, .2, 1.2) both; filter: drop-shadow(0 0 28px rgba(213, 184, 122, .45)); }
@keyframes seal { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.xp-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; background: rgba(185, 154, 91, .14); border: 1px solid var(--gold); color: var(--gold-l); font-weight: 700; font-family: var(--serif); font-size: 1.2rem; }

/* ---------------- Grimuar ---------------- */

.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 150px), 1fr)); gap: 12px; }
.book {
  --c: #6B4785; position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 168px; padding: 14px 12px 12px 18px; border-radius: 6px 14px 14px 6px;
  text-decoration: none; color: #F3EBDC; overflow: hidden; border: 1px solid rgba(0, 0, 0, .3); text-align: left;
  background: linear-gradient(90deg, rgba(0, 0, 0, .35) 0, rgba(0, 0, 0, .05) 9px, transparent 10px), linear-gradient(160deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 70%, #000 30%));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(213, 184, 122, .25); transition: transform var(--t-mid);
}
.book:hover { transform: translateY(-3px) rotate(-.4deg); color: #fff; }
.book::after { content: ''; position: absolute; inset: 9px 9px 9px 16px; border: 1px solid rgba(213, 184, 122, .45); border-radius: 4px 10px 10px 4px; pointer-events: none; }
.book .bk-ic { position: absolute; top: 16px; left: 50%; transform: translateX(-38%); width: 44px; height: 44px; color: #E8CF96; opacity: .9; }
.book .bk-t { font-family: var(--serif); font-size: 1.22rem; font-weight: 700; line-height: 1.1; position: relative; }
.book .bk-n { font-size: .74rem; opacity: .85; position: relative; }
.book.on { outline: 2px solid var(--gold-l); outline-offset: 3px; }
.entry-card { display: block; text-decoration: none; color: inherit; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: rgba(23, 18, 32, .5); transition: border-color var(--t-fast), transform var(--t-fast); }
:root[data-theme="parchment"] .entry-card { background: var(--surface); }
.entry-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.entry-card .ec-t { font-family: var(--serif); font-size: 1.22rem; font-weight: 600; line-height: 1.2; }
.entry-card .ec-m { font-size: .78rem; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.entry-card .ec-p { font-size: .9rem; color: var(--text-2); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-body { font-size: 1.02rem; line-height: 1.7; }
.entry-body .es { margin-bottom: 18px; }
.entry-body .es h4 { color: var(--gold-l); font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.entry-body .es p { white-space: pre-wrap; }
.parchment-page { background: #F6EEDD; color: #241A2C; border-radius: 6px; padding: 28px 26px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); border: 1px solid #DCC9A2; font-family: var(--serif); font-size: 1.12rem; line-height: 1.65; }
.parchment-page h2, .parchment-page h3 { color: #3B2647; }
.parchment-page .es h4 { color: #7A5B22; font-family: var(--sans); }
.parchment-page table.tbl th { color: #7A5B22; border-color: #D8C49C; }
.parchment-page table.tbl td { border-color: #E6D6B4; }
.cover-preview { width: 150px; height: 200px; border-radius: 4px 12px 12px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 14px; color: #E8CF96;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(213, 184, 122, .35); position: relative; }
.cover-preview::after { content: ''; position: absolute; inset: 10px; border: 1px solid rgba(232, 207, 150, .55); border-radius: 3px 9px 9px 3px; }
.cover-preview .mono { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.cover-preview .ct { font-family: var(--serif); font-size: 1rem; margin-top: 10px; line-height: 1.2; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; }
.swatches button.on { border-color: var(--gold-l); box-shadow: 0 0 0 3px rgba(213, 184, 122, .3); }

/* ---------------- narzędzia ---------------- */

.tool-card { display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.tool-card .tc-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--gold-l); background: radial-gradient(circle at 30% 25%, rgba(107, 71, 133, .7), rgba(46, 35, 64, .8)); border: 1px solid var(--line-2); }
:root[data-theme="parchment"] .tool-card .tc-ic { background: rgba(185, 154, 91, .14); }
.tool-card .tc-ic svg { width: 24px; height: 24px; }
.tool-card h3 { font-size: 1.2rem; margin: 0; }
.tool-card p { font-size: .86rem; color: var(--text-2); margin: 0; line-height: 1.45; }
.tool-card .tc-foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tool-card.locked { opacity: .72; }

.tarot-table { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 22px 8px; border-radius: 24px; min-height: 260px; align-items: flex-start;
  background: radial-gradient(ellipse at 50% 40%, rgba(74, 44, 94, .45), rgba(11, 9, 18, .2) 70%), repeating-linear-gradient(45deg, rgba(213, 184, 122, .03) 0 2px, transparent 2px 12px); border: 1px solid var(--line); }
.tcard-slot { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 130px; }
.tcard-slot .pos { font-size: .76rem; color: var(--gold-l); text-align: center; font-weight: 600; letter-spacing: .03em; min-height: 2.4em; }
.tcard { width: 120px; aspect-ratio: 7 / 12; border-radius: 10px; perspective: 900px; border: 0; padding: 0; background: none; }
.tcard .tc-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.tcard.up .tc-in { transform: rotateY(180deg); }
.tcard .tc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.tcard .tc-front { transform: rotateY(180deg); }
.tcard.rev .tc-front svg { transform: rotate(180deg); }
.tcard svg { width: 100%; height: 100%; display: block; }
@media (min-width: 700px) { .tcard { width: 140px; } .tcard-slot { width: 150px; } }

.lab-canvas { width: 100%; max-width: 520px; aspect-ratio: 1 / 1; border-radius: 22px; border: 1px solid var(--line); background: radial-gradient(circle at 50% 20%, rgba(107, 71, 133, .3), transparent 70%); display: block; margin: 0 auto; }
.moon-disc { width: 180px; height: 180px; margin: 0 auto; display: block; filter: drop-shadow(0 0 30px rgba(213, 220, 240, .25)); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .cd { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .78rem; border: 1px solid transparent; gap: 1px; padding: 2px; }
.cal .cd svg { width: 62%; height: auto; max-width: 30px; }
.cal .cd.today { border-color: var(--gold); background: rgba(185, 154, 91, .1); }
.cal .cd.key { color: var(--gold-l); font-weight: 700; }
.cal .ch { text-align: center; font-size: .7rem; color: var(--text-3); font-weight: 600; padding: 4px 0; }
.steps-box { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: .9rem; background: rgba(11, 9, 18, .5); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; line-height: 1.8; overflow-x: auto; }
:root[data-theme="parchment"] .steps-box { background: #fff; }
.big-num { font-family: var(--serif); font-size: 4rem; font-weight: 700; line-height: 1; color: var(--gold-l); }
.rune-glyph { font-size: 2.4rem; line-height: 1; color: var(--gold-l); font-family: 'Segoe UI Historic', 'Noto Sans Runic', var(--sans); }

/* ---------------- gabinet ---------------- */

.chamber { position: relative; border-radius: 26px; overflow: hidden; border: 1px solid var(--line-2); box-shadow: var(--glow); background: #120D1B; }
.chamber svg { display: block; width: 100%; height: auto; }
.chamber .hot { cursor: pointer; transition: filter var(--t-fast); }
.chamber .hot:hover, .chamber .hot:focus { filter: drop-shadow(0 0 10px rgba(232, 207, 150, .8)); outline: none; }

/* ---------------- certyfikat ---------------- */

.cert { position: relative; max-width: 820px; margin: 0 auto; aspect-ratio: 1.414 / 1; background: #F7F0E1; color: #2A1D33; border-radius: 6px; padding: 5% 7%; text-align: center;
  font-family: var(--serif); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.cert::before { content: ''; position: absolute; inset: 14px; border: 2px solid #B99A5B; border-radius: 2px; pointer-events: none; }
.cert::after { content: ''; position: absolute; inset: 22px; border: 1px solid rgba(185, 154, 91, .55); pointer-events: none; }
.cert .c-brand { letter-spacing: .4em; font-size: clamp(.8rem, 2vw, 1.1rem); color: #8A6A2E; }
.cert .c-title { font-size: clamp(1.4rem, 4vw, 2.6rem); margin: 2% 0; color: #3B2647; font-weight: 600; }
.cert .c-name { font-size: clamp(1.4rem, 4.5vw, 2.8rem); font-style: italic; color: #2A1D33; border-bottom: 1px solid #C9B07A; display: inline-block; padding: 0 4% 1%; margin: 1% auto 2%; }
.cert .c-body { font-family: var(--sans); font-size: clamp(.62rem, 1.5vw, .9rem); color: #4A3C52; line-height: 1.5; max-width: 80%; margin: 0 auto; }
.cert .c-meta { font-family: var(--sans); font-size: clamp(.55rem, 1.3vw, .78rem); color: #6D5F75; margin-top: 3%; display: flex; justify-content: space-around; gap: 10px; flex-wrap: wrap; }
.cert .c-seal { position: absolute; right: 8%; bottom: 10%; width: 14%; color: #B99A5B; opacity: .9; }

/* ---------------- strona powitalna ---------------- */

.welcome { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.welcome-hero { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px 40px; overflow: hidden; }
.welcome-hero .sigil { width: min(62vw, 260px); height: auto; color: var(--gold-l); filter: drop-shadow(0 0 30px rgba(213, 184, 122, .35)); margin-bottom: 18px; }
.welcome-hero .sigil .spin { transform-origin: 100px 100px; animation: slowspin 90s linear infinite; }
.welcome-hero .sigil .spin2 { transform-origin: 100px 100px; animation: slowspin 140s linear infinite reverse; }
@keyframes slowspin { to { transform: rotate(360deg); } }
.welcome-hero h1 { font-size: clamp(2.6rem, 2rem + 4vw, 4.4rem); letter-spacing: .3em; padding-left: .3em; font-weight: 500; margin: 0; }
.welcome-hero .sub { font-family: var(--sans); letter-spacing: .42em; font-size: .78rem; color: var(--gold-l); text-transform: uppercase; margin: 6px 0 22px; padding-left: .42em; }
.welcome-hero .motto { font-family: var(--serif); font-style: italic; font-size: clamp(1.3rem, 1rem + 1.2vw, 1.75rem); color: var(--text); max-width: 560px; margin: 0 0 12px; }
.welcome-hero .lede { color: var(--text-2); max-width: 560px; margin: 0 auto 26px; }
.welcome-hero .btn-row { justify-content: center; }
.stars { position: absolute; inset: 0; pointer-events: none; opacity: .7; }
.pillars { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); max-width: 1080px; margin: 0 auto; padding: 10px 16px 30px; }
.pillar { padding: 20px; border-radius: 20px; border: 1px solid var(--line); background: rgba(23, 18, 32, .55); }
:root[data-theme="parchment"] .pillar { background: var(--surface); }
.pillar svg { width: 30px; height: 30px; color: var(--gold-l); margin-bottom: 8px; }
.pillar h3 { font-size: 1.25rem; margin-bottom: .25em; }
.pillar p { color: var(--text-2); font-size: .92rem; margin: 0; }
.welcome-foot { text-align: center; color: var(--text-3); font-size: .78rem; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); line-height: 1.6; border-top: 1px solid var(--line); }
.welcome-foot a { color: var(--text-3); }
.cycle { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 4px; font-family: var(--serif); font-size: 1.05rem; color: var(--text-2); max-width: 720px; margin: 0 auto 30px; padding: 0 16px; }
.cycle span { color: var(--gold-l); }

.app-foot { text-align: center; font-size: .74rem; color: var(--text-3); padding: 20px 0 6px; line-height: 1.6; }
.app-foot a { color: var(--text-3); }

/* ---------------- druk ---------------- */

@media print {
  body { background: #fff !important; color: #111 !important; }
  .side, .bnav, .top, .focusbar, .toasts, .no-print, .nav-row { display: none !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .card, .tblock, .entry-card, .parchment-page { box-shadow: none !important; background: #fff !important; color: #111 !important; border-color: #ccc !important; }
  .cert { box-shadow: none; aspect-ratio: auto; min-height: 90vh; }
  a { color: #111; }
}

/* Emblematy w kontenerach o stałym rozmiarze (karta akademii, specjalizacje, nagrody). */
svg.x { width: 100%; height: 100%; display: block; }
.side .brand svg.sigil-s .spin, .side .brand svg.sigil-s .spin2 { animation: none; }

#main:focus { outline: none; }

/* ---------------- zdjęcia ---------------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 6px 0; }
.ph { position: relative; margin: 0; aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: rgba(11, 9, 18, .4); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.ph img.ok { opacity: 1; }
.ph img.missing { opacity: 1; font-size: .72rem; color: var(--text-3); padding: 8px; }
.ph .icon-btn { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; background: rgba(11, 9, 18, .7); color: #F3EBDC; }
.ph.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--gold-l); border-style: dashed; font-size: .82rem; font-weight: 600; text-align: center; padding: 8px; }
.ph.add svg { width: 26px; height: 26px; }
.ph.add:hover, .ph.add:focus-visible { border-color: var(--gold); background: rgba(185, 154, 91, .08); }
.parchment-page .ph { border-color: #D8C49C; }
