/* ==========================================================================
   Styl „Pergamin i drewno” — jasny, włączany atrybutem <html data-theme="pergamin">.
   Karty z kości słoniowej i pergaminu oprawione w drewniane ramki, górny pasek
   jak drewniana listwa, tekst w kolorze tuszu. Złoto i jadeit tylko jako małe
   akcenty (przyciemnione, żeby były czytelne na jasnym tle). Kolory stron
   (--shu, --ai) i kolory heksów są wspólne z rendererem planszy — bez zmian.
   ========================================================================== */
html[data-theme="pergamin"]{
  color-scheme:light;
  --sumi:#e9dfc8;          /* pergamin — tło */
  --sumi2:#f7f1e3;         /* kość słoniowa — karta */
  --sumi3:#efe6d1;
  --sumi4:#e6d9bb;
  --line:#cdbb96;
  --line2:#a98c5f;
  --washi:#2a2016;
  --washi2:#3a2a1a;        /* nagłówki — ciemny tusz */
  --ink:#fffaf0;           /* pola formularzy */
  --text:#2b2118;
  --text2:#6f604b;
  --gold:#a8831c;
  --gold-l:#8a6a10;
  --gold-bg:rgba(168,131,28,.12);
  --jade:#2f8a6b;
  --jade-l:#1f6e53;
  --moss:#2f8a6b;
  --warn:#b8741a;
  --bad:#a3333f;
  --hover:#efe4c9;
  --shu-l:#a3281d;         /* napisy w kolorach stron — przyciemnione na jasne tło */
  --ai-l:#2b5185;
  /* prawa kolumna: karta z kości słoniowej, dziennik lekko wgłębiony w pergamin */
  --sheet:linear-gradient(180deg,#fffaf0,#f6eedb);
  --sheet-shadow:inset 0 1px 0 #fff,0 2px 0 #d7c49c,0 8px 16px -10px rgba(60,35,15,.45);
  --well:rgba(120,90,40,.07);
  --well-line:rgba(90,60,25,.12);
  --well-shadow:inset 0 1px 2px rgba(60,35,15,.2);
  --stat:linear-gradient(180deg,#fffaf0,#f1e7cf);
  --stat-line:#c9b58c;
  --stat-up:#e3f1ea;
  --stat-up-v:#1f6e53;
  --card:linear-gradient(180deg,#fffaf0,#f2e8d2);
  --card-hover:#fffdf6;
  --wood:#7b5230;
  --wood-d:#4a2e17;
  --wood-l:#a8754a;
  --grain:repeating-linear-gradient(92deg,rgba(0,0,0,.07) 0 2px,transparent 2px 7px,rgba(255,255,255,.05) 7px 8px,transparent 8px 13px);
  --frame:0 0 0 1px var(--wood-d),0 0 0 5px var(--wood),0 0 0 6px var(--wood-d),0 8px 18px -8px rgba(60,35,15,.55);
  --paper:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .15 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23f)'/%3E%3C/svg%3E");
  --shadow:0 6px 16px -10px rgba(60,35,15,.5);
}
html[data-theme="pergamin"] body{background:var(--paper),radial-gradient(ellipse at 50% 20%,#f3ead6,#ddd0b2 90%) fixed;background-color:var(--sumi);color:var(--text)}
html[data-theme="pergamin"] ::selection{background:rgba(47,138,107,.25)}
html[data-theme="pergamin"] *{scrollbar-color:#b59b72 transparent}
html[data-theme="pergamin"] ::-webkit-scrollbar-thumb{background:#b59b72;background-clip:padding-box}
html[data-theme="pergamin"] a{color:var(--jade-l)}

/* ——— kontrolki ——— */
html[data-theme="pergamin"] button{background:linear-gradient(180deg,#fdf9ef,#efe5cd);color:var(--text);border:1px solid #b99f74;border-radius:7px;
  box-shadow:0 1px 0 rgba(255,255,255,.8) inset,0 2px 0 #c7b089}
html[data-theme="pergamin"] button:hover:not(:disabled){background:linear-gradient(180deg,#fffdf6,#f4ead3);border-color:var(--wood-l)}
html[data-theme="pergamin"] button:active:not(:disabled){transform:translateY(1px);box-shadow:0 1px 0 #c7b089,inset 0 1px 2px rgba(60,35,15,.2)}
html[data-theme="pergamin"] button:disabled{opacity:.45;box-shadow:none}
html[data-theme="pergamin"] button.pri{background:linear-gradient(180deg,#e9c964,#c79b2a);color:#2a1d04;border-color:#9a7616;font-weight:700;
  box-shadow:0 1px 0 rgba(255,255,255,.55) inset,0 2px 0 #7f5f10,0 6px 14px -8px rgba(168,131,28,.8)}
html[data-theme="pergamin"] button.pri:hover:not(:disabled){background:linear-gradient(180deg,#f0d677,#d0a633)}
html[data-theme="pergamin"] button.on{background:linear-gradient(180deg,#4fae8c,#2f8a6b);color:#fff;border-color:#1f6e53;
  box-shadow:0 1px 0 rgba(255,255,255,.3) inset,0 2px 0 #1a5a44;text-shadow:0 1px 0 rgba(0,0,0,.2)}
html[data-theme="pergamin"] button.on:hover:not(:disabled){background:linear-gradient(180deg,#5bbb98,#349675)}
html[data-theme="pergamin"] button.danger{background:linear-gradient(180deg,#c2545e,#a3333f);color:#fff;border-color:#7d222c;box-shadow:0 2px 0 #6a1b24}
html[data-theme="pergamin"] input,html[data-theme="pergamin"] select,html[data-theme="pergamin"] textarea{background:var(--ink);color:var(--text);border-color:#b99f74;box-shadow:inset 0 1px 2px rgba(60,35,15,.15)}
html[data-theme="pergamin"] input:focus,html[data-theme="pergamin"] select:focus,html[data-theme="pergamin"] textarea:focus{border-color:var(--jade);box-shadow:0 0 0 3px rgba(47,138,107,.18)}
html[data-theme="pergamin"] button:focus-visible,html[data-theme="pergamin"] input:focus-visible,
html[data-theme="pergamin"] select:focus-visible,html[data-theme="pergamin"] summary:focus-visible{outline-color:var(--jade)}
html[data-theme="pergamin"] input[type=checkbox],html[data-theme="pergamin"] input[type=radio],html[data-theme="pergamin"] input[type=range]{accent-color:var(--jade)}
html[data-theme="pergamin"] textarea#jsonbox{background:var(--ink)!important;color:var(--text)!important;border-color:#b99f74!important}
html[data-theme="pergamin"] .tg[aria-pressed="true"],html[data-theme="pergamin"] button.tg-on,
html[data-theme="pergamin"] .viewtoggle button[aria-pressed="true"],html[data-theme="pergamin"] .themepick button[aria-pressed="true"]{
  background:linear-gradient(180deg,#e2f1ea,#cfe7dc);border-color:var(--jade);color:var(--jade-l);box-shadow:inset 0 1px 2px rgba(31,110,83,.25)}
html[data-theme="pergamin"] .viewswitch button.on{background:linear-gradient(180deg,#e9c964,#c79b2a);color:#2a1d04;border-color:#9a7616}

/* ——— górny pasek: drewniana listwa ——— */
html[data-theme="pergamin"] #topbar{background:var(--grain),linear-gradient(180deg,#8a5e38,#6a4426);border-bottom:1px solid var(--wood-d);color:#f6ecd6;
  box-shadow:inset 0 1px 0 rgba(255,235,200,.25),0 2px 0 #3a2410,0 8px 16px -8px rgba(60,35,15,.6)}
html[data-theme="pergamin"] #topbar button{background:linear-gradient(180deg,#f8f0dd,#e6d6b2);border-color:#3a2410;box-shadow:0 2px 0 #3a2410}
html[data-theme="pergamin"] #topbar .viewtoggle button[aria-pressed="true"]{background:linear-gradient(180deg,#d9efe5,#bfe0d1);color:#16543f}
html[data-theme="pergamin"] .brandtxt small{color:#e5d3ae}
html[data-theme="pergamin"] .seal{box-shadow:0 0 0 1px #3a2410,0 1px 0 rgba(255,255,255,.3) inset}
html[data-theme="pergamin"] .step{color:#ecdcba}
html[data-theme="pergamin"] .step::before{background:#5a3a20;border-color:#c9a878;color:#f6ecd6}
html[data-theme="pergamin"] .step.done{color:#bfe8d6}
html[data-theme="pergamin"] .step.done::before{background:#2f8a6b;border-color:#bfe8d6;color:#fff}
html[data-theme="pergamin"] .step.cur{color:#fff4d2;background:rgba(243,210,122,.18);box-shadow:inset 0 0 0 1px rgba(243,210,122,.7)}
html[data-theme="pergamin"] .step.cur::before{background:#e9c964;border-color:#fff1c2;color:#2a1d04}
html[data-theme="pergamin"] .step.back:hover{background:rgba(255,255,255,.1);color:#fff}
html[data-theme="pergamin"] #topbar .pill{background:rgba(250,242,224,.92);border-color:#3a2410;color:var(--text)}
html[data-theme="pergamin"] #topbar .pill.budget{color:#6e520c}
html[data-theme="pergamin"] #topbar .pill.A{background:#f6dcd6;color:#8f2a1f}
html[data-theme="pergamin"] #topbar .pill.O{background:#d9e5f3;color:#2b5185}

/* ——— karty z kości słoniowej w drewnianych ramkach ——— */
html[data-theme="pergamin"] #stage{background:none}
html[data-theme="pergamin"] .panel{background:var(--paper),linear-gradient(180deg,#fbf6ea,#f3ead6);border:none;border-radius:8px;
  padding:15px 17px;margin:6px 6px 20px;box-shadow:var(--frame)}
html[data-theme="pergamin"] .panel > h2{color:var(--washi2);border-bottom:1px solid #d8c7a2;background:linear-gradient(var(--jade),var(--jade)) 0 3px/3px 14px no-repeat;font-size:15.5px}
html[data-theme="pergamin"] .panel > h2 > span{color:var(--text2)}
html[data-theme="pergamin"] .panel > h2 .money,html[data-theme="pergamin"] .money,html[data-theme="pergamin"] .chk .cc{color:var(--gold-l)}
html[data-theme="pergamin"] .panel.sticky{box-shadow:var(--frame),0 12px 20px -10px rgba(60,35,15,.45)}
html[data-theme="pergamin"] .col2,html[data-theme="pergamin"] .col3{gap:18px}
html[data-theme="pergamin"] .hint,html[data-theme="pergamin"] .smallcaps,html[data-theme="pergamin"] .note{color:var(--text2)}
html[data-theme="pergamin"] .err{color:#a3333f}
html[data-theme="pergamin"] .okmsg{color:#1f6e53}
html[data-theme="pergamin"] .warnbox{background:#fbf0cf;border-color:#c9a34a;color:var(--text)}
html[data-theme="pergamin"] .warnbox b{color:#7a5a08}
html[data-theme="pergamin"] table.tbl th{color:var(--text2);border-bottom-color:#c9b58c}
html[data-theme="pergamin"] table.tbl td{border-bottom-color:#e4d7b9}
html[data-theme="pergamin"] table.tbl tr:hover td{background:#f1e6cc}
html[data-theme="pergamin"] .budgetbar{background:#e2d5b6;box-shadow:inset 0 1px 2px rgba(60,35,15,.25)}
html[data-theme="pergamin"] .budgetbar i{background:linear-gradient(90deg,#2f8a6b,#c79b2a)}
html[data-theme="pergamin"] .chk:hover{background:#f1e6cc}
html[data-theme="pergamin"] .chk.on{background:#e3f1ea;border-color:#8cc3ad}
html[data-theme="pergamin"] .tag{background:#fbf6ea;border-color:#c9b58c;color:var(--text)}
html[data-theme="pergamin"] .tag.sk{border-color:#c9a34a;color:#6e520c;background:#fbf0cf}
html[data-theme="pergamin"] .tag.tr{border-color:#7fa6c0;color:#2b5185;background:#e8f0f6}
html[data-theme="pergamin"] .tag.bo{border-color:#8cc3ad;color:#1f6e53;background:#e3f1ea}
html[data-theme="pergamin"] .mapedit{background:rgba(255,255,255,.4);border-color:#c9b58c}
html[data-theme="pergamin"] .screenfoot{background:linear-gradient(180deg,rgba(233,223,200,.85),#e9dfc8 45%);border-top:2px solid var(--wood)}
html[data-theme="pergamin"] .dicebox{background:#fffaf0}
html[data-theme="pergamin"] .big{color:#7a5a08}
html[data-theme="pergamin"] [style*="#ffd166"]{color:#8a6300!important}
html[data-theme="pergamin"] [style*="#e08a8a"]{color:#a3333f!important}

/* ——— prawa kolumna i pasek składu ——— */
html[data-theme="pergamin"] #rail{background:var(--paper),#efe6d0;border-left:6px solid var(--wood);box-shadow:inset 1px 0 0 var(--wood-d)}
html[data-theme="pergamin"] #strip{background:var(--paper),#e6dbc0;border-top:6px solid var(--wood);box-shadow:inset 0 1px 0 var(--wood-d)}
html[data-theme="pergamin"] #build-footer{background:#e6dbc0;border-top-color:var(--line)}
html[data-theme="pergamin"] #inspector .iname,html[data-theme="pergamin"] #unitpop .iname{color:var(--washi2)}
html[data-theme="pergamin"] #inspector .ihead,html[data-theme="pergamin"] #unitpop .ihead{border-bottom-color:#d3c29d}
html[data-theme="pergamin"] .statgrid{box-shadow:0 1px 0 #d7c49c}
html[data-theme="pergamin"] #log .hit{color:#8a6300}
html[data-theme="pergamin"] #log .kill{color:#a3281d}
html[data-theme="pergamin"] #log .ok{color:#1f6e53}
html[data-theme="pergamin"] #log .bad{color:#a3333f}
html[data-theme="pergamin"] #log .rnd{color:#7a5a08;--rnd-line:rgba(168,131,28,.55)}
html[data-theme="pergamin"] .ucard{border:1px solid #c9b58c;box-shadow:0 2px 0 #cdb78d}
html[data-theme="pergamin"] .ucard .n{color:var(--washi)}
html[data-theme="pergamin"] .ucard:hover{border-color:var(--wood-l);box-shadow:0 4px 10px -4px rgba(60,35,15,.4)}
html[data-theme="pergamin"] .ucard.sel{border-color:var(--jade);box-shadow:0 0 0 1px var(--jade),0 0 0 4px rgba(47,138,107,.2)}
html[data-theme="pergamin"] .uchip{box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 0 0 1px rgba(60,35,15,.45)}
html[data-theme="pergamin"] .hpbar{background:#e2d5b6}
html[data-theme="pergamin"] .hpbar i{background:linear-gradient(90deg,#2f8a6b,#4fae8c)}
html[data-theme="pergamin"] .striphead{color:var(--text2)}
html[data-theme="pergamin"] .striphead span b{color:var(--washi)!important}

/* ——— armie, modyfikatory, przełącznik stron ——— */
html[data-theme="pergamin"] .sidetab.act{background:linear-gradient(180deg,#fffdf6,#f4ead3);border-color:var(--wood);box-shadow:inset 0 0 0 1px rgba(123,82,48,.35),0 2px 0 #c7b089}
html[data-theme="pergamin"] .sidetab i.ok{color:#1f6e53}html[data-theme="pergamin"] .sidetab i.bad{color:#a3333f}
html[data-theme="pergamin"] .modgroup{background:#fffaf0;border-color:#d3c29d}
html[data-theme="pergamin"] .modgroup h3{color:var(--washi2);border-bottom-color:#d8c7a2}
html[data-theme="pergamin"] .modgroup h3 span{color:var(--jade-l)}
html[data-theme="pergamin"] .modgroup .chk .cc{background:#fbf0cf;border-color:#c9a34a;color:#6e520c}
html[data-theme="pergamin"] .genopt.on span{color:rgba(255,255,255,.9)}
html[data-theme="pergamin"] .genresult{background:#e3f1ea;border-color:#8cc3ad}
html[data-theme="pergamin"] .army-json-editor{background:#fffaf0}

/* ——— bitwa ——— */
html[data-theme="pergamin"] #turnflag{background:#fbf6ea;border-color:#c9b58c;box-shadow:var(--shadow)}
html[data-theme="pergamin"] #turnflag.A{background:linear-gradient(90deg,#f7ddd6,#fbf6ea 70%)}
html[data-theme="pergamin"] #turnflag.O{background:linear-gradient(90deg,#dde7f4,#fbf6ea 70%)}
html[data-theme="pergamin"] #turnflag.A .who{color:#a3281d}html[data-theme="pergamin"] #turnflag.O .who{color:#2b5185}
html[data-theme="pergamin"] #turnflag .mon{box-shadow:0 0 0 2px #fff,0 0 0 3px #c9b58c}
html[data-theme="pergamin"] #boardwrap,html[data-theme="pergamin"] .online-board-wrap{background:var(--paper),#efe5cc;border:10px solid var(--wood);border-radius:10px;
  box-shadow:inset 0 0 0 1px var(--wood-d),inset 0 2px 10px rgba(60,35,15,.35),0 0 0 1px var(--wood-d),0 10px 22px -10px rgba(60,35,15,.6)}
html[data-theme="pergamin"] .hxlbl{fill:#5e5440}
html[data-theme="pergamin"] .upiece .body{filter:drop-shadow(0 1.2px 0 rgba(40,25,10,.45))}
html[data-theme="pergamin"] .legend i{border-color:rgba(60,35,15,.35)}
html[data-theme="pergamin"] .online-unit-panel,html[data-theme="pergamin"] .online-last-action{background:#fbf6ea}

/* ——— okna, wybór trybu, samouczek ——— */
html[data-theme="pergamin"] #overlay{background:rgba(58,38,20,.55)}
html[data-theme="pergamin"] #ovbox{background:var(--paper),linear-gradient(180deg,#fbf6ea,#f1e7cf);border:none;border-radius:10px;color:var(--text);
  box-shadow:var(--frame),0 30px 70px -20px rgba(40,25,10,.7)}
html[data-theme="pergamin"] #ovbox > h2{color:var(--washi2);border-bottom-color:#d3c29d}
html[data-theme="pergamin"] .modegate{background:
    linear-gradient(180deg,rgba(233,223,200,.35),rgba(233,223,200,.9) 60%,#e9dfc8),
    url(../../samurai-duel.webp) center 30%/cover no-repeat,var(--sumi)}
html[data-theme="pergamin"] .modebox{background:var(--paper),linear-gradient(180deg,rgba(251,246,234,.97),rgba(241,231,207,.97));border:none;border-radius:12px;
  box-shadow:0 0 0 1px var(--wood-d),0 0 0 9px var(--wood),0 0 0 10px var(--wood-d),0 30px 70px -20px rgba(40,25,10,.8)}
html[data-theme="pergamin"] .modebrand{color:var(--washi2)}
html[data-theme="pergamin"] .modebrand b{color:#a3281d}
html[data-theme="pergamin"] .modelead{color:var(--text2)}
html[data-theme="pergamin"] .modecard{background:linear-gradient(180deg,#fffaf0,#f2e8d2);border:1px solid #c9b58c;box-shadow:0 3px 0 #cdb78d}
html[data-theme="pergamin"] .modecard strong{color:var(--washi2)}
html[data-theme="pergamin"] .modecard span{color:var(--text2)}
html[data-theme="pergamin"] .modecard:hover:not(:disabled){border-color:var(--jade);background:#fffdf6;box-shadow:0 6px 14px -6px rgba(60,35,15,.45)}
html[data-theme="pergamin"] .modecard.pri{background:linear-gradient(180deg,#fdf3d6,#f3e2b3);border-color:#b8902a;box-shadow:0 3px 0 #b8902a}
html[data-theme="pergamin"] .modecard.pri strong{color:#6e520c}
html[data-theme="pergamin"] .modecard.pri span{color:var(--text)}
html[data-theme="pergamin"] .modecard:not(.pri) .modeglyph{background:linear-gradient(145deg,#4fae8c,#2f8a6b);color:#fff!important;box-shadow:0 0 0 1px #1f6e53}
html[data-theme="pergamin"] .modestatus{background:#fbf6ea;border-color:#c9b58c;border-left-color:var(--jade)}
html[data-theme="pergamin"] .duelcode{color:#6e520c;background:#fbf0cf;border-color:#c9a34a}
html[data-theme="pergamin"] .historylist li{background:#fbf6ea}
html[data-theme="pergamin"] .themepick{color:var(--text2)}
html[data-theme="pergamin"] .tutorial-bar{background:var(--paper),#f3ead6;border-top:6px solid var(--wood)}
html[data-theme="pergamin"] .tuthead b{color:var(--jade-l)}
html[data-theme="pergamin"] .tuttip{background:#fbf0cf;border-color:#c9a34a}
html[data-theme="pergamin"] .tutpill{background:#fbf0cf;color:#6e520c;border-color:#c9a34a}
html[data-theme="pergamin"] .tut-hl{outline-color:var(--jade);box-shadow:0 0 0 6px rgba(47,138,107,.18)}
html[data-theme="pergamin"] .modecard.pri{font-weight:400}

/* ——— znak: na drewnianej listwie inkrustacja z kości słoniowej wpuszczona w drewno, „bitwa” złoceniem; na papierze tuszem ——— */
html[data-theme="pergamin"]{--wm-font:"WM Pergamin",var(--serif);--wm-weight:400}
html[data-theme="pergamin"] .wordmark{letter-spacing:.05em}
html[data-theme="pergamin"] #topbar .wordmark .wm1{background:none;color:#fbf0d8;text-shadow:0 -1px 0 rgba(40,20,5,.7),0 1px 0 rgba(255,228,185,.22)}
html[data-theme="pergamin"] #topbar .wordmark .wm-dash{color:#e2c89a;text-shadow:0 -1px 0 rgba(40,20,5,.6)}
html[data-theme="pergamin"] #topbar .wordmark .wm2{color:#f5d680;text-shadow:0 1px 0 #3a2410,0 0 6px rgba(243,210,122,.35)}
html[data-theme="pergamin"] .modebox .wordmark .wm1{background:none;color:#3a2a1a}
html[data-theme="pergamin"] .modebox .wordmark .wm-dash{color:#8a6a4a}
html[data-theme="pergamin"] .modebox .wordmark .wm2{color:#a3281d}
