* { box-sizing: border-box; }
html, body { width: 100vw; max-width: 100vw; overflow-x: hidden; }
body { margin: 0; background: #171310; color: #e8dcc0; font: 15px/1.5 system-ui, "Microsoft YaHei", sans-serif; }
header { padding: 10px 14px; border-bottom: 1px solid #3a2f24; font-size: 14px; color: #cfc0a0; }
header b { color: #e7c887; }
main { width: 100vw; padding: 12px; max-width: 560px; margin: 0 auto; overflow-x: hidden; }
#enemy { border: 1px solid #3a2f24; border-radius: 10px; padding: 10px 12px; background: #201a14; }
.ename { font-size: 17px; color: #e7c887; }
.field { margin: 4px 0; font-size: 13px; color: #d98c6a; }
.hp { position: relative; height: 22px; margin-top: 8px; border-radius: 6px; background: #3a1d16; overflow: hidden; }
.hp i { display: block; height: 100%; background: #c0392b; }
.hp span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 22px; color: #fff; }
#preview { min-height: 22px; color: #cfc0a0; font-size: 13px; }
#hand { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 3px; width: 100%; }
.card { position: relative; width: 100%; min-width: 0; max-width: none; aspect-ratio: 210 / 290; padding: 0; border: 0;
  background: url("assets/ui/tavern_box_01.png") center / 100% 100% no-repeat; color: #2b2118; cursor: pointer; }
.card b { position: absolute; left: 9%; top: 5%; font-size: clamp(13px, 4vw, 22px); line-height: 1; }
.card .el { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); width: 42%; height: auto; pointer-events: none; }
.card.meme .el { filter: grayscale(1) brightness(.7); }
.card.on { transform: translateY(-8px); filter: drop-shadow(0 0 4px #e7c887); }
.row { display: flex; gap: 10px; margin: 14px 0; }
button { padding: 10px 18px; border-radius: 8px; border: 1px solid #7a6432; background: #d9b061; color: #241a10; font-size: 15px; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button.ghost { background: transparent; color: #cfc0a0; }
#log { font-size: 13px; color: #b6a687; display: grid; gap: 3px; }
#shop { display: none; position: fixed; inset: 0; background:#0d0b09; padding: 24px; overflow: auto; }
#shop { display: none; position: fixed; inset: 0; background: #100c09; padding: 14px; overflow: auto; }
#shop.on { display: block; }
.goldbar { display: flex; align-items: center; gap: 8px; background: #e8dcc0; color: #3a2a18; border: 3px solid #6b4a22; border-radius: 14px; padding: 8px 12px; font-weight: 600; }
.goldbar .coin { color: #b8862b; }
.goldbar .gear { margin-left: auto; font-size: 18px; }
.panel { margin-top: 12px; background: #2a3a3a; border: 3px solid #7a5a2e; border-radius: 16px; padding: 10px; }
.ptitle { background: #8fc3c0; color: #20302e; border: 2px solid #5d8b88; border-radius: 8px; text-align: center; font-weight: 700; padding: 6px; letter-spacing: 1px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 10px; }
.tile { background: #efe3c6; border: 3px solid #b78b4a; border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; gap: 2px; align-items: center; color: #3a2a18; font-size: 13px; }
.tile.sel { border-color: #f0c96a; box-shadow: 0 0 0 3px rgba(240, 201, 106, .45); }
.tile .tname { font-style: normal; font-weight: 700; font-size: 14px; }
.tile em { font-style: normal; font-size: 12px; color: #6b5a44; }
.tile u { text-decoration: none; color: #8a5a1a; font-weight: 700; }
.tile.small { padding: 8px 4px; }
.desc { min-height:150px; background: #efe3c6; color: #3a2a18; border-radius: 12px; padding: 12px; min-height: 96px; }
.desc h4 { margin: 0 0 6px; font-size: 16px; color: #7a4a10; }
.desc p { margin: 0; font-size: 13.5px; }
.desc .hint { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #b9a583; font-size: 12px; color: #8a7350; }
.equipbar { display: flex; gap: 8px; justify-content: center; margin-top: 10px; position: relative; padding-bottom: 14px; }
.eslot { width: 52px; height: 52px; border: 2px solid #6b5a3c; border-radius: 8px; background: #3a2f24; color: #8a7350; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.equipbar em { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #a58f66; font-style: normal; }
.foot { display: flex; gap: 10px; justify-content: space-between; margin-top: 8px; color: #d9c9a4; font-size: 12.5px; }
.bottom { display: flex; gap: 10px; margin-top: 14px; }
.big { flex: 1; padding: 14px; border-radius: 12px; font-size: 17px; font-weight: 700; border: 3px solid; }
.big.ok { background: #9ec97a; border-color: #5f8a3f; color: #243a12; }
.big.no { background: #9cc6cd; border-color: #4f7f89; color: #163036; }
.arrow { width: 54px; padding: 14px 0; border-radius: 12px; background: #e7c887; border: 3px solid #8a6a2a; font-size: 18px; }
#dead { display: none; position: fixed; inset: 0; background: rgba(10, 8, 6, .94); align-items: center; justify-content: center; }
#dead.on { display: flex; }
#dead > div { text-align: center; }
#settings { display: none; position: fixed; inset: 0; background: rgba(10, 8, 6, .92); z-index: 20; padding: 20px; }
#settings.on { display: flex; align-items: center; justify-content: center; }
.sbox { background: #2a3a3a; border: 3px solid #7a5a2e; border-radius: 16px; padding: 18px; width: 280px; }
.sbox h3 { margin: 0 0 12px; color: #e7c887; text-align: center; }
.srow { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; color: #e8dcc0; }
.mini { padding: 4px 14px; font-size: 13px; }
.gear { background: transparent; border: 0; font-size: 18px; padding: 0 4px; color: #3a2a18; }
button.on { outline: 2px solid #f0c96a; }
.card.swapfirst { box-shadow: 0 0 0 3px #7fd3ff; }
.next { flex: 1; background: #e7c887; border: 3px solid #8a6a2a; border-radius: 12px; font-size: 16px; font-weight: 700; }
.tiles .card { flex: none; width: 100%; max-width: none; }
.card.mini b { font-size: 15px; }

.card.mini .tag { font-size: 9px; color: #8a5a1a; }


.mimg { display:block; width:96px; height:96px; object-fit:contain; margin:0 auto 6px; image-rendering:pixelated; filter:drop-shadow(0 3px 6px #0008); }
.sortrow { gap:6px; }
.sortlab { font-size:13px; opacity:.7; margin-right:2px; }

/* ---- battle redesign ---- */
#board { margin-bottom: 8px; }
.bpanel { position: relative; border-radius: 16px; background: linear-gradient(#2a2018, #1b1510);
  border: 2px solid #6b5330; padding: 10px 12px 12px; }
.bhead { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; color: #f0dfb8; }
#bhpnum { font-size: 13px; color: #ffb3a7; }
.hpbar { height: 12px; border-radius: 8px; background: #43201c; overflow: hidden; margin: 6px 0 8px; }
.hpbar i { display: block; height: 100%; background: linear-gradient(#ff6b5a, #d83a2a); transition: width .2s; }
#enemy { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mimg { width: 132px; height: 132px; }
.field { font-size: 12.5px; color: #e8b9a0; background: #3a211a; border: 1px solid #7a4634;
  border-radius: 8px; padding: 3px 8px; text-align: center; }
#playzone { display: flex; gap: 10px; align-items: stretch; margin: 10px 0 4px; }
.score { flex: 1; background: #171310; border: 2px solid #5a4526; border-radius: 12px; padding: 8px 10px;
  min-height: 74px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.sline { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stype { color: #cbb583; font-size: 13px; }
.sbig { color: #ffd479; font-weight: 800; font-size: 19px; }
.sline.small { display: block; color: #9c8a6c; font-size: 11.5px; }
.stotal { color: #7ee08a; font-weight: 800; font-size: 22px; text-align: right; }
.slots { display: flex; gap: 5px; align-items: center; }
.slot { width: 42px; height: 58px; border-radius: 8px; border: 1.5px dashed #5a4a30; display: flex;
  flex-direction: column; align-items: center; justify-content: center; background: #171310; }
.slot.empty { opacity: .5; }
.slot.filled { border-style: solid; border-color: #b89a5a; background: #f3e7c8; color: #2b2118; }
.slot b { font-size: 16px; }
.slot img { width: 22px; height: 22px; margin-top: 2px; }
#handwrap { margin-top: 6px; }
.toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.toolbar .tl { font-size: 13px; color: #b9a37a; }
.toolbar #play { margin-left: auto; }
.foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px; color: #b9a37a; }
.foot b { color: #ffd479; }
.hsep { display: inline-block; width: 8px; }
.card .el { top: 80% !important; }

#enemy { border: 0 !important; background: none !important; padding: 0 !important; }
#hud { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; font-size: 13px; overflow: hidden; }
#hud button.mini { margin-left: auto; }
.card .el { position: absolute; left: 50%; top: 80%; width: 44%; transform: translate(-50%, -50%); }

.score { min-width: 128px; max-width: 152px; }
.sline { gap: 6px; }
.sbig { font-size: 18px; }
.stotal { font-size: 21px; margin-top: 2px; }
.slots { flex: 1; justify-content: flex-start; }
.slot { width: 46px; height: 64px; }
.slot img { width: 24px; height: 24px; }

.score { min-width: 146px; max-width: 152px; }
.sline { flex-wrap: nowrap; }
.sbig { white-space: nowrap; }
.slot { width: 36px; height: 52px; }
.slot img { width: 20px; height: 20px; }
.slots { gap: 4px; }

.equipbar5 { display: flex; gap: 6px; margin: 8px 0 2px; }
.eslot5 { flex: 1; min-width: 0; height: 40px; border-radius: 8px; border: 1.5px dashed #5a4a30;
  background: #171310; color: #9c8a6c; font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.eslot5.sel { border-style: solid; border-color: #ffd479; color: #ffd479; }
.card .el { width: 40% !important; }

.eslot5 { height: 46px; font-size: 10.5px; line-height: 1.15; white-space: normal; padding: 2px; }

#slots { display: none; }
.card .el { width: 36% !important; top: 78% !important; }
#score { width: 100%; }
.sform2 { font-size: 12.5px; color: #cdbb9a; }
.hact { display: inline-flex; gap: 6px; margin-left: auto; }
#hud { display: flex; flex-wrap: wrap; gap: 4px; }
#bag { display: none; position: fixed; inset: 0; background: #0d0b09; padding: 20px; overflow: auto; z-index: 50; }
#bag.on { display: block; }
#bag h3 { color: #e7c887; margin-bottom: 10px; }
.bagrow { border: 1px solid #4a3d28; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; color: #d9c9a8; font-size: 13px; }
.bagrow b { color: #e7c887; }

.sline { display: block; }
.sform2 { display: block; margin-top: 2px; }
.stotal { margin-top: 6px; font-size: 14px; }
.stotal b { font-size: 26px; color: #6ddf6d; display: block; margin-top: 2px; }
.foot { display: flex; gap: 10px; font-size: 12px; flex-wrap: wrap; }
.eslot5 { height: 52px; font-size: 9.5px; line-height: 1.1; }

.bagdeck { margin-top: 6px; background: #241a12; border: 2px solid #6b5a3c; border-radius: 10px; padding: 10px; }
.dhead { display: flex; align-items: center; justify-content: space-between; color: #cfe9e6; font-weight: 700; margin-bottom: 8px; }
.dsum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.dchip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: #e6d6b4; }
.dchip img { width: 16px; height: 16px; }
.dchip.rk { border: 1px solid #8a7448; border-radius: 4px; padding: 0 4px; }
.drow { display: flex; gap: 3px; margin-bottom: 4px; }
.dcard { flex: 1; min-width: 0; aspect-ratio: 5/7; border-radius: 5px; border: 1px solid #8a7448; background: #efe3c6;
  color: #3a2c1c; font-size: 10px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 2px; position: relative; }
.dcard img { width: 55%; position: absolute; bottom: 6%; left: 50%; transform: translateX(-50%); }
.dcard.off { opacity: .28; filter: grayscale(1); }

.soneline { font-size: 12.2px; line-height: 1.5; color: #e6d6b4; white-space: nowrap; overflow: hidden; }
.soneline b { color: #6ddf6d; font-size: 20px; margin-left: 2px; }
.card .mk { position: absolute; right: 2px; top: 2px; font-size: 9px; color: #3b2a1c; font-style: normal; line-height: 1.2; }
.card.deco { box-shadow: inset 0 0 0 2px #ffd479; }
.pickhand { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 6px; }
.dmk { position: absolute; top: 1px; right: 2px; font-size: 8px; color: #b3541e; font-style: normal; }

.score { max-width: none !important; width: 100%; }

.card .mk { display: block; z-index: 3; }

.htab { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.htab th { color: #9a8a6a; font-weight: 600; text-align: left; padding: 4px 2px; }
.htab td { padding: 4px 2px; border-top: 1px solid #3a2f22; }
.tile.used { opacity: .45; }

.logbox { margin-top: 6px; background: #1a1512; border: 1px solid #3a2f22; border-radius: 8px; padding: 6px 10px; font-size: 12px; color: #cbb894; cursor: pointer; }
.logbox .logall { display: none; margin-top: 4px; color: #9c8a68; }
.logbox.open .logall { display: block; }
.loglast { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { padding: 6px 10px; }
.bagtabs { display: flex; gap: 6px; margin-bottom: 8px; }
.bagtab { flex: 1; padding: 8px 0; border-radius: 8px; border: 2px solid #6b5a3c; background: #241d16; color: #d8c39a; font-weight: 700; }
.bagtab.on { background: #e7c887; color: #2a2116; }

#sortRank:not(.on), #sortSuit:not(.on) { opacity: .55; }

#bag.on { display: block; position: fixed; inset: 0; background: #0f0c09; padding: 18px; overflow: auto; z-index: 60; }
.bagcontent { background: #1a1512; border: 1px solid #3a2f22; border-radius: 10px; padding: 10px; }

.baghead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; position: sticky; top: 0; background: #0f0c09; padding: 4px 0; z-index: 2; }
.pickhand { grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
.pickhand .card { width: 100%; }
.score { padding: 2px 10px !important; }

.ov { display: none; position: fixed; inset: 0; background: rgba(8,6,4,.9); z-index: 70; padding: 24px; overflow: auto; }
.ov.on { display: flex; align-items: center; justify-content: center; }
.ovbox { width: 100%; max-width: 420px; background: #1a1512; border: 2px solid #6b5a3c; border-radius: 14px; padding: 18px; text-align: center; }
.ovbox h3 { color: #e7c887; margin: 0 0 10px; font-size: 22px; }
.vwin { color: #ffd479 !important; font-size: 30px !important; letter-spacing: 6px; }
.ibody img { width: 120px; height: 120px; object-fit: contain; }
.iname { font-size: 20px; color: #f1dfb8; margin: 6px 0; }
.irow { color: #c8b691; font-size: 14px; margin: 4px 0; }
#lastplay { display: flex; gap: 6px; padding: 6px 12px; min-height: 6px; }
#lastplay .card { width: 34px; flex: none; }
.floatdmg { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); font-size: 34px; font-weight: 900; color: #ffd479; text-shadow: 0 2px 0 #6b3a00, 0 0 12px #ffb400; animation: fdmg .9s ease-out forwards; pointer-events: none; }
@keyframes fdmg { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 30% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1); } }

#board { position: relative; }
.floatdmg { top: 45%; }
#lastplay .card { width: 40px; }

.pickhand { grid-template-columns: repeat(var(--pn, 5), minmax(0, 1fr)) !important; gap: 6px !important; }
.pkcell { position: relative; }
.pkcell .card { width: 100%; }
.pk { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); font-size: 9px; color: #9c8a6a; font-style: normal; white-space: nowrap; }
.pk.on { color: #ffd479; }

.tiles:has(.pickhand) { display: block; }
.pickhand { width: 100% !important; row-gap: 18px !important; }
.pkcell .card { max-width: 96px; margin: 0 auto; }

.pickhand { margin-bottom: 24px !important; }

.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 6px; }
.good { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px 26px; border-radius: 10px; border: 3px solid #8a6a2a;
  background: linear-gradient(#f6ead0, #e8d6ae); color: #3a2a14; }
.good.sel { border-color: #ffd479; box-shadow: 0 0 0 2px #ffd479 inset; }
.good.used { filter: grayscale(1); opacity: .6; }
.gicon { font-size: 26px; line-height: 1; }
.gname { font-size: 14px; }
.gtier { font-style: normal; font-size: 12px; color: #6b5433; }
.gprice { position: absolute; bottom: 4px; font-size: 12px; color: #8a5a10; text-decoration: none; }
.own { font-size: 13px; color: #6b5433; margin-bottom: 4px; }
.bottom { display: flex; gap: 8px; align-items: center; }
.bottom #next { margin-left: auto; }

#refresh { white-space: nowrap; width: auto; padding: 0 14px; }

.mstrip { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.mcell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mcell img { display: block; width: 100%; height: auto; }
.mcell em { font-style: normal; font-size: 11px; color: #c9b48c; }
.mcell.side { width: 46px; opacity: .4; filter: grayscale(.6); }
.mcell.center { width: 96px; }
.mcell.center { cursor: pointer; }
#refresh:disabled { opacity: .45; }
.bottom #refresh { flex: 0 0 auto; }
.bottom .big { flex: 1; }

.tiles:has(.shelf) { display: block !important; }

.mcell.done { opacity: .18; filter: grayscale(1); }
.wavenum { text-align: center; font-size: 12px; color: #c9b48c; margin-bottom: 2px; }

.mportrait { display:block; margin:8px auto; background:none; border:3px solid transparent; border-radius:14px; padding:6px; }
.mportrait img { width:128px; height:128px; object-fit:contain; display:block; }
.mportrait.sel { border-color:#e7c887; box-shadow:0 0 14px rgba(231,200,135,.6); }
.itip { color:#c9b48c; font-size:13px; margin-top:6px; }

.tapstart { text-align: center; color: #e7c887; font-size: 13px; margin-top: 6px; }
#enemy { cursor: pointer; }

#start .ovbox { text-align: center; }
.sportrait { width: 150px; height: 150px; margin: 6px auto 10px; border-radius: 10px; border: 2px solid #6b5a3c; background: #241d17 url(assets/cards/card_1001.png) center/72% no-repeat; }
.srow { display: flex; justify-content: space-between; font-size: 14px; color: #d9c9a8; padding: 5px 2px; border-bottom: 1px dashed #4a3c2c; }
.srow b { color: #f0e0c0; }
.sbtns { display: flex; gap: 10px; margin-top: 14px; }
.sbtns button { flex: 1; padding: 12px; border-radius: 10px; border: 2px solid; font-size: 16px; font-weight: 700; }
#startGo { background: #9fd3d0; border-color: #4f8f8b; color: #14312f; }
#startRestart { background: #d8a06a; border-color: #8a5a2a; color: #2b1a0a; }
#startCont { background: #9fd3d0; border-color: #4f8f8b; color: #14312f; }

.mstrip.three { position: relative; height: 300px; }
.mstrip.three .mcell { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.mstrip.three .mcell img { object-fit: contain; }
.mstrip.three .pos0 { left: 8%; bottom: 18px; }
.mstrip.three .pos1 { left: 50%; top: 6px; transform: translateX(-50%); }
.mstrip.three .pos2 { right: 8%; bottom: 18px; }
.mstrip.three .pos0 img, .mstrip.three .pos2 img { width: 64px; height: 64px; opacity: .85; }
.mstrip.three .pos1 img { width: 132px; height: 132px; }
.mstrip.three .mcell em { font-style: normal; font-size: 11px; color: #d9c9a3; }
.mstrip.three .pos1 em { font-size: 12px; color: #e7c887; }
.mstrip.three .dead { opacity: .28; filter: grayscale(1); }
.mstrip.three .mprog { position: absolute; right: 6px; top: 4px; font-size: 12px; color: #9fb7b3; }
.mstrip.three .tapstart { position: absolute; left: 0; right: 0; bottom: -4px; }

.mstrip.three { display: flex; flex-direction: column; gap: 4px; height: auto; }
.mstrip.three .mrow { display: flex; align-items: flex-end; justify-content: space-between; }
.mstrip.three .mrow.top { justify-content: center; }
.mstrip.three .mcell { position: static; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.mstrip.three .mprog { position: static; align-self: flex-end; font-size: 12px; color: #9fb7b3; }
.mstrip.three .tapstart { position: static; }

.mstrip.one{display:flex;flex-direction:column;align-items:center;gap:4px;margin:6px 0 2px}
.mstrip.one .msolo{width:132px;height:132px;object-fit:contain;display:block}
.mstrip.one .msname{font-style:normal;font-size:12px;color:#e7c887}
.mstrip.one .tapstart{position:static;margin-top:2px;font-size:12px;color:#d9c9a3}

#score .idle{color:#8f8268;font-size:12px}
#score{min-height:44px}

body.shopmode .bhead, body.shopmode .hpbar { display:none }
body.shopmode #hand { pointer-events:none; opacity:.5 }
#enemy.shopmode .equipbar, #enemy.shopmode .foot { display:none }
#enemy.shopmode .panel { background:transparent; border:0; padding:0; box-shadow:none }
#enemy.shopmode .ptitle { margin-bottom:8px }

#enemy.shopmode.shelf .desc{display:none}
#enemy.shopmode .ptitle{width:auto;max-width:92%;margin:0 auto 8px;text-align:center;white-space:nowrap;padding:8px 22px}

#shop:not(.on) { pointer-events:none; }
#settings:not(.on), #bag:not(.on), #dead:not(.on), #victory:not(.on) { pointer-events:none; }
#enemy.shopmode { position:relative; z-index:1; }
#enemy.shopmode .panel, #enemy.shopmode .panel * { pointer-events:auto; }

#enemy.shopmode .desc { min-height:150px; }

body.shopmode.cardpick #hand { pointer-events:auto; opacity:1; }
body.shopmode.cardpick #hand .card.on { outline:3px solid #8fc3c0; outline-offset:-3px; }

#refresh, #pickok, #pickcancel { min-width:104px; height:44px; padding:0 14px; font-size:15px; border-radius:12px; }
body.shopmode .toolbar { gap:10px; }

#shop { position:fixed; inset:0; z-index:40; display:none; overflow:auto; background:#0a0e0e; padding:10px 12px 24px; }
#shop.on { display:block; }
#shop .shopmid { margin-top:10px; }
#shop .hand { display:grid; grid-template-columns:repeat(var(--n,8),minmax(0,1fr)); gap:3px; }
#shop .foot { display:flex; justify-content:space-between; color:#c8b691; font-size:12px; margin-top:6px; }
#shop .bottom { display:flex; gap:10px; margin-top:10px; }
#shop .bottom button { flex:1; height:44px; }

#shop .shopHand { min-height:0; margin:8px 0 14px; align-items:start; }
#shop .equipbar5 { margin-top:4px; }

.dlegend { margin:8px 0 4px; font-size:11px; color:#9b8f74; }
.dlist { border-top:1px dashed #4b4335; margin-top:6px; padding-top:6px; font-size:12px; color:#d9cba9; }
.dlist b { display:block; margin-bottom:4px; color:#e7c887; }
.dline { display:flex; gap:8px; padding:3px 0; border-bottom:1px dotted #3d372b; }
.dline.empty { color:#8f8268; }
.duid { color:#c8a15a; min-width:44px; }
.drs { min-width:52px; }
.dmks { color:#ffd479; }

.drow { overflow-x:auto; padding-bottom:3px; }
.dcard { flex:0 0 calc((100% - 24px) / 9); min-width:31px; }
.stools { display:flex; gap:8px; align-items:center; margin:8px 0 2px; font-size:12px; color:#9b8f74; }
.stools .mini { min-width:64px; }

#shop .stools { position:relative; z-index:2; margin:10px 0 2px; }
#shop .foot { position:relative; margin-top:14px; }
#shop .shopHand { position:relative; z-index:1; }

.toast { position:fixed; left:50%; bottom:24%; transform:translateX(-50%); background:rgba(20,26,24,.95);
  color:#ffe9b8; border:2px solid #b78b4a; border-radius:10px; padding:10px 18px; font-size:15px; z-index:99; }

.drow { display:grid; grid-auto-flow:column; grid-auto-columns:var(--handw,44px); gap:4px; align-items:end; margin-bottom:6px; overflow-x:auto; padding-bottom:3px; }
.drow .card { width:var(--handw,44px); min-width:var(--handw,44px); height:auto; pointer-events:none; }



.card.f4 { background-image: url(assets/ui/tavern_box_04.png); }
.card.f5 { background-image: url(assets/ui/tavern_box_05.png); }
.card b { left: 14%; top: 10%; }
.card.s-fire b { color: #b23a2e; }
.card.s-water b { color: #2f6f9e; }
.card.s-wood b { color: #4d7a34; }
.card.s-light b { color: #ae8816; }
.card.s-dark b { color: #6b4a86; }
.card.s-atk b { color: #3a3a3c; }

.card .mk { right: 12%; top: 14%; display: flex; align-items: center; gap: 1px; height: 13px; max-width: 84%; overflow: hidden; white-space: nowrap; }
.card .mk img { width: 11px; height: 11px; display: block; }
.card .mk i { font-style: normal; font-size: 8px; line-height: 11px; color: #5a3f24; }

.cdetail{position:fixed;inset:0;z-index:60;background:rgba(0,0,0,.62);display:flex;align-items:center;justify-content:center;padding:18px}
.cdetail .box{background:#f3e7c8;color:#2b2118;border:2px solid #8c6a2f;border-radius:12px;padding:14px 16px;max-width:320px;width:100%;font-size:13px;line-height:1.55}
.cdetail h3{margin:0 0 6px;font-size:17px}
.cdetail .row{display:flex;justify-content:space-between;gap:10px;border-top:1px dashed #c9b183;padding:5px 0}
.cdetail .row span:last-child{color:#6b4a17;text-align:right}

.card .ench { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46%; opacity: 1; pointer-events: none; }
.card.ench .el { width: 42% !important; }

/* final element icon geometry */
.card .el { top: auto !important; bottom: 9% !important; left: 50% !important; transform: translateX(-50%) !important; width: 63% !important; }
.card.ench .el { top: auto !important; bottom: 7% !important; transform: translateX(-50%) !important; width: 42% !important; }

.card.ec { background-size: 100% 100% !important; background-repeat: no-repeat; }

.card.plate { background-size: 100% 100% !important; background-repeat: no-repeat; }
