/* Medieval fantasy look: tan parchment pages, dark leather bars, brass-riveted plaques with notched corners.
   Loaded after app.css, so it only changes colours, textures and shapes. The pictures (public/assets/ui/*.png) are plain editable PNGs;
   without them the same look is drawn with flat colours. --px (set by play.js) is the size of one art pixel, always a whole number of
   device pixels, so the textures never smear. */
:root {
  --bg: #cdb27c; --panel: #3f2616; --panel2: #ecdbad; --line: #7a5a2e; --gold: #8a5a10; --gold2: #5b3d1f;
  --text: #3a2814; --dim: #7b6240; --good: #2f7a3f; --bad: #a3302a; --blue: #2f5f9a; --parch: #f2e4ba;
  --common: #6b6050; --uncommon: #3a8a4a; --rare: #2f6fb0; --epic: #8a4ac8;
  --px: 2px;
  --head: Georgia, "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --notch: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
}
html, body { background: var(--bg); color: var(--text); }
html.ui-art #app { background-image: var(--ui-parchment); background-size: calc(var(--px) * 64) calc(var(--px) * 64); image-rendering: pixelated; }
html.ui-art #app { background-color: var(--bg); }
/* the page around the game is plain black (the parchment is the game itself) */
html, body, html.ui-art body { background: #000000; background-image: none; }
h1, h2, h3, .btn, .nm, .sec, .who .n { font-family: var(--head); }

/* ---- dark leather: top bar, bottom bar, menu headers ---- */
#top, #nav, #overlay .head, #overlay .chatbar, #chatpop .pop, .toast, #creator .foot .btn { --text: #f6e9c8; --dim: #d3bd90; --gold: #f2d27a; color: var(--text); }
#top, #nav, #overlay .head, #overlay .chatbar { background: #3f2616; border: 0; }
html.ui-art #top, html.ui-art #nav, html.ui-art #overlay .head, html.ui-art #overlay .chatbar { background-image: var(--ui-leather); background-size: calc(var(--px) * 32) calc(var(--px) * 32); image-rendering: pixelated; }
#top { border-bottom: 3px solid #24160b; box-shadow: 0 3px 0 #c8963a; position: relative; z-index: 2; }
#nav { border-top: 3px solid #c8963a; box-shadow: 0 -3px 0 #24160b; }
#overlay .head { border-bottom: 3px solid #24160b; box-shadow: 0 3px 0 #c8963a; }
#overlay .chatbar { border-top: 3px solid #c8963a; }
#top img { background: #6b4a2b; border: 2px solid #c8963a; border-radius: 2px; }
.bar { background: #24160b; border: 2px solid #1a0f07; border-radius: 3px; box-shadow: 0 1px 0 rgba(200,150,58,.5); }
.bar > i { border-radius: 0; }
#overlay { background: var(--bg); }
html.ui-art #overlay { background-image: var(--ui-parchment); background-size: calc(var(--px) * 64) calc(var(--px) * 64); image-rendering: pixelated; }

/* ---- plaque buttons ---- */
.btn { color: #f6e8c6; text-shadow: 0 1px 0 #24160b; letter-spacing: .3px; border: 3px solid #24160b; border-radius: 0; clip-path: var(--notch);
  background: #7a5230; box-shadow: inset 0 2px 0 #b78c5c, inset 0 -3px 0 #4a2f18; }
.btn:active { transform: translateY(1px); box-shadow: inset 0 3px 0 #4a2f18, inset 0 -2px 0 #8f6339; }
.btn.gold { color: #3a2608; text-shadow: 0 1px 0 rgba(255,240,170,.7); border-color: #3a2608; background: #dcae3c; box-shadow: inset 0 2px 0 #ffe58c, inset 0 -3px 0 #8a5f10; }
.btn.good { border-color: #10281a; background: #4e8a40; box-shadow: inset 0 2px 0 #9bd68e, inset 0 -3px 0 #2a5322; }
.btn.bad { color: #fff; border-color: #2e0c08; background: #b04232; box-shadow: inset 0 2px 0 #e69582, inset 0 -3px 0 #6a2118; }
.btn.small { padding: 5px 10px; font-size: 14px; border-width: 2px; }
.btn.on { outline: 3px solid var(--gold); outline-offset: 1px; clip-path: none; }
/* the big buttons use the riveted picture plaques */
html.ui-art .big-btn, html.ui-art .choices .btn, html.ui-art #join .btn:not(.small), html.ui-art .foot .btn, html.ui-art .compass .btn, html.ui-art #act {
  border: calc(var(--px) * 8) solid transparent; border-image-source: var(--ui-button); border-image-slice: 8 fill; border-image-width: calc(var(--px) * 8); border-image-repeat: stretch;
  background: none; box-shadow: none; clip-path: none; padding: 2px 6px; image-rendering: pixelated; }
html.ui-art .big-btn:active, html.ui-art .choices .btn:active, html.ui-art #join .btn:not(.small):active, html.ui-art .foot .btn:active, html.ui-art .compass .btn:active, html.ui-art #act:active { border-image-source: var(--ui-button-down); transform: none; box-shadow: none; }
html.ui-art .big-btn.gold, html.ui-art .choices .btn.gold, html.ui-art #join .btn.gold, html.ui-art .foot .btn.gold, html.ui-art #act.gold { border-image-source: var(--ui-button-gold); }
html.ui-art .big-btn.gold:active, html.ui-art #join .btn.gold:active, html.ui-art .foot .btn.gold:active, html.ui-art #act.gold:active { border-image-source: var(--ui-button-gold-down); }
html.ui-art .big-btn.good, html.ui-art .choices .btn.good, html.ui-art .foot .btn.good { border-image-source: var(--ui-button-good); }
html.ui-art .big-btn.good:active, html.ui-art .foot .btn.good:active { border-image-source: var(--ui-button-good-down); }
html.ui-art .big-btn.bad, html.ui-art .choices .btn.bad { border-image-source: var(--ui-button-bad); }
html.ui-art .big-btn.bad:active { border-image-source: var(--ui-button-bad-down); }
.big-btn { padding: 12px; font-size: 22px; }
#act { width: 112px; height: 112px; border-radius: 0; }
#hub-top .btn { width: 48px; height: 48px; }

/* ---- cards and panels ---- */
.card, .prev, .banner-msg { background: #ecdbad; border: 3px solid #5b3d1f; border-radius: 0; clip-path: var(--notch); box-shadow: inset 0 0 0 2px #c9a76b; color: var(--text); }
html.ui-art .card, html.ui-art .prev, html.ui-art .banner-msg { border: calc(var(--px) * 8) solid transparent; border-image-source: var(--ui-panel); border-image-slice: 8 fill; border-image-width: calc(var(--px) * 8); border-image-repeat: stretch; background: none; box-shadow: none; clip-path: none; padding: 0 2px; image-rendering: pixelated; }
.card.rare { border-color: var(--rare); } .card.uncommon { border-color: var(--uncommon); } .card.epic { border-color: var(--epic); }
.item, .stat, .kv div, .act-b, .sheet, .info, .cbt-info { background: #ecdbad; border: 2px solid #7a5a2e; border-radius: 0; clip-path: var(--notch); box-shadow: inset 0 0 0 1px #f6ebca; color: var(--text); }
.sheet { background: #dcc590; border-color: #5b3d1f; }
.info { background: #f2e4ba; }
.item.rare { border-color: var(--rare); } .item.uncommon { border-color: var(--uncommon); } .item.epic { border-color: var(--epic); }
.item.sel { outline-color: var(--gold); }
.stat.pr { border-color: #b8862a; box-shadow: inset 0 0 0 1px #e8c46a; }
.tag { background: #dcc590; border: 1px solid #8a6a3a; border-radius: 0; color: var(--dim); }
.tag.eq { color: var(--good); border-color: var(--good); } .tag.dyed { background: rgba(90,60,30,.12); }
.chip { background: #e0c994; border: 2px solid #8a6a3a; border-radius: 0; clip-path: var(--notch); color: var(--text); }
.chip.sel { background: #e2b244; color: #3a2608; border-color: #5b3d1f; }
.tabs .btn.on, .cls .btn.sel { outline: 0; }
.cls .btn.sel { background: #e6bb4b; color: #3a2608; border-color: #3a2608; }
.skills div { border-bottom: 1px dotted #b99a62; }
.bubble { background: var(--parch); color: #2a2418; border-radius: 0; clip-path: var(--notch); border: 3px solid #5b3d1f; box-shadow: inset 0 0 0 2px #c9a76b; }
.dlg .who img { background: #6b4a2b; border: 3px solid #5b3d1f; border-radius: 0; }
.turn-banner { border-radius: 0; } .turn-banner.other { background: #ecdbad; border-color: #7a5a2e; }
#xmap, #mini { border-radius: 0; }
.dot { border-color: rgba(60,40,20,.6); }
.sp-pick, .sp-i { background: #f0e0b0; border: 1px solid #8a6a3a; border-radius: 0; color: var(--text); }
.sp-row.sel .sp-pick { border-color: #b8862a; background: #e8cf84; }
.sp-ck { border-radius: 0; } .sp-text { background: #e6d29c; border-radius: 0; color: var(--text); }

/* ---- inputs ---- */
.lin, #join input, .prev input, #overlay .chatbar input { background: #f6ebca; border: 3px solid #5b3d1f; border-radius: 0; color: var(--text); box-shadow: inset 0 2px 0 rgba(90,60,30,.25); }
#overlay .chatbar input { color: #3a2814; }
#join { --text: #f6e9c8; --dim: #d8c8a0; --gold: #f2d27a; }
#join h1 { font-family: var(--head); }
#join input { color: #3a2814; }
#lobbies { background: none; }

/* ---- small round things become square plaques ---- */
#chatfab { border-radius: 0; border: 3px solid #24160b; background: #7b5330; box-shadow: inset 0 2px 0 #b78c5c; }
#nav .btn { clip-path: var(--notch); }
#dpad button { background: #7b5330; border: 3px solid #24160b; border-radius: 0; clip-path: var(--notch); color: #f6e8c6; box-shadow: inset 0 2px 0 #b78c5c, inset 0 -3px 0 #4a2f18; }
#dpad button.on { background: #d7ac41; color: #3a2608; transform: translateY(2px); box-shadow: inset 0 2px 0 #ffe58c; }
#dpad .mid { background: #3a2412; border: 3px solid #c8963a; }
#dpad .mid .knob { background: #b28244; border: 2px solid #24160b; }
#dpad .mid.on { border-color: #ffe58c; background: #422a15; }
#dpad .mid.on .knob { background: #eecf76; }

/* ---- messages ---- */
.toast, #chatpop .pop { background: #3f2616; border: 2px solid #c8963a; border-radius: 0; clip-path: var(--notch); box-shadow: 0 2px 0 #24160b; color: #f6e9c8; }
.toast.good { border-color: #6ad08a; } .toast.bad { border-color: #e86a6a; }
.cl.chat { color: var(--text); } .cl.roll { color: #6a3aa8; } .cl.log, .cl.sys { color: var(--blue); } .cl.hit, .cl.crit { color: #a8601a; } .cl.miss { color: var(--dim); } .cl.act { color: #8a3a9a; }
#chatpop .pop .cl.chat { color: #f6e9c8; } #chatpop .pop .cl.roll { color: #d8c0ff; } #chatpop .pop .cl b, .toast b { color: #f2d27a; }
.lootmini .tag { color: #8a5a10; border-color: #b8862a; }

/* ---- health is red, experience is green, the portrait is big ---- */
.bar > i { background: #db5344; }
.bar.low > i { background: #f06851; animation: lowhp 1s infinite; }
.bar.xp > i, .bar.big.xp > i { background: #6abf5c; }
@keyframes lowhp { 50% { filter: brightness(1.35); } }
#top img { width: 64px; height: 56px; }
#top { gap: 10px; }

/* the top bar keeps one fixed height, so the portrait being resized to whole pixels never moves the menus below it */
#top { height: 72px; box-sizing: border-box; }
#top img { flex: none; }

/* top bar: shorter health / XP bars so the icons can be bigger; the portrait is a whole-number scale of its 16x14 picture (the border no longer eats into it) */
#top > img:first-child { box-sizing: content-box; border: 0; width: calc(var(--px) * 16 * var(--pk, 2)); height: calc(var(--px) * 14 * var(--pk, 2)); flex: none; box-shadow: 0 0 0 var(--px) #c8963a; margin: var(--px); }   /* the frame is a shadow, so the picture itself is a whole multiple of the UI's pixel grid */
#top .who { flex: 0 1 132px; min-width: 0; }
#top > div:nth-of-type(2) { margin-left: auto; }
#top .gold { font-size: 17px; display: flex; align-items: center; justify-content: flex-start; gap: 4px; }
#top .gold .emo, #top .gold .ico { width: 26px; height: 26px; }
#top .xs { font-size: 14px; display: flex; align-items: center; justify-content: flex-start; gap: 4px; }
#top .xs .emo, #top .xs .ico { width: 24px; height: 24px; }
#top #leave-btn { display: flex; align-items: center; gap: 4px; }
#top #leave-btn .emo, #top #leave-btn .ico { width: 28px; height: 28px; }
#overlay .head .btn .emo, #overlay .head .btn .ico { width: 28px; height: 28px; }
#overlay .head h2 .emo, #overlay .head h2 .ico { width: 30px; height: 30px; vertical-align: middle; margin-right: 4px; }
#top > div:nth-of-type(2) { text-align: left !important; }   /* gold and people icons sit in one straight column */

/* combat: the chosen action (or the one waiting for a target) is red */
#cbt-ctl .btn.on, #cbt-ctl .act-b.sel { outline: 3px solid #ff5a5a; outline-offset: 1px; color: #fff; background: #b83a2c; box-shadow: inset 0 2px 0 #f09a8a, inset 0 -3px 0 #6a2118; }
#cbt-ctl .act-b.sel .d { color: #ffd6cf; }
.insp-card { width: 100%; text-align: left; line-height: 1.35; }

#dice .dice-text { background: #3f2616; border: 2px solid #c8963a; border-radius: 0; clip-path: var(--notch); box-shadow: 0 2px 0 #24160b; }
#dice .dice-math { color: #f6e9c8; font-family: var(--head); }

#dice .dice-label { color: #f2d27a; text-shadow: none; }
#dice .dice-math { text-shadow: none; }
.insp-card .atk-list { margin-top: 3px; border-top: 1px solid rgba(0,0,0,.2); padding-top: 3px; }
#dice .dice-note { color: #e8d6a8; }
#cbt-insp .insp-win { background: #f1e2b8; color: #3a2814; border: 3px solid #5b3d1f; border-radius: 0; box-shadow: 0 3px 0 #24160b; } #cbt-insp h3 { color: #6a4318; font-family: var(--head); } #cbt-insp .insp-sec { color: #7a4f1d; border-bottom-color: rgba(0,0,0,.2); } #cbt-insp .insp-blurb { color: #6a5a3e; } #cbt-insp .gold-t { color: #8a5a10; }

#dice .dice-banner { background: #3f2616; border: 3px solid #c8963a; border-radius: 0; clip-path: var(--notch); box-shadow: 0 2px 0 #24160b; font-family: var(--head); color: #f6e9c8; }
#dice .dice-banner.foe { border-color: #d0503e; } #dice .dice-banner.party { border-color: #5aa878; }
#cbt-insp .atk-t { color: #6a4f2a; }

/* equipment slots on parchment */
.eqs { background: #ecdbad; border-color: #7a5a2e; border-radius: 0; clip-path: var(--notch); box-shadow: inset 0 0 0 1px #f6ebca; color: var(--text); }
.eqs.empty { background: #e2cf9c; }
