/* Compact shop cards retain readable Thai text and shared rune icon sizing. */
.rune-shop-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 10px;font-size:13px;color:#dfc88c;flex-shrink:0}
.rune-shop-heading button{padding:4px 10px;font-size:13px}
.rune-shop-list{flex:1;padding:0 8px 8px}
.rune-shop-section h3{font-size:14px;color:var(--rune-ink);margin:10px 0 7px}
.rune-shop-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
.rune-shop-card{display:grid;grid-template-columns:29px minmax(0,1fr);grid-template-rows:1fr auto;align-items:start;gap:4px 6px;padding:7px 6px;border:1px solid #51432e;border-radius:6px;background:#171511}
.rune-shop-card>div{min-width:0}
.rune-shop-card strong{display:block;font-size:14px;line-height:1.5;color:#f0d493}
.rune-shop-card small{display:block;font-size:13px;line-height:1.6;color:#e2d8c4}
.rune-shop-card .rune-stock-emblem{margin-top:2px}
#rune-panel .rune-stock-row>.rune-stock-emblem,#rune-panel .rune-card>.rune-stock-emblem{align-self:flex-start;margin-top:2px}
#rune-panel .rune-shop-card .rune-stock-emblem small{font-size:10px;color:#f0d493;line-height:1.1}
#rune-panel .rune-shop-card button{grid-column:2;grid-row:2;justify-self:end;align-self:end;font-size:12px;line-height:1.4;padding:2px 7px;min-height:25px;white-space:nowrap}
#rune-body:has(.rune-shop-list)>.rune-footer span{font-size:13px;line-height:1.6}
@media(max-width:420px){.rune-shop-grid{grid-template-columns:1fr}.rune-shop-card{grid-template-columns:21px minmax(0,1fr);gap:4px 7px}}
/* Approved rune artwork keeps its silhouette at native socket sizes. */
.rune-art{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
#rune-panel .rune-stock-emblem:has(.rune-art){border:0;border-radius:0;background:none;box-shadow:none}
#rune-panel .rune-socket.filled{border-color:transparent;background:none;box-shadow:none}
#rune-panel .rune-socket .rune-art{width:28px;height:28px}
#rune-panel .rune-socket small,#rune-panel .rune-stock-emblem small{z-index:1;line-height:1.1}
/* Character-sized modal: tune these two dimensions for every device together. */
#rune-panel { --rune-width:480px; --rune-height:420px; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); box-sizing:border-box; width:min(var(--rune-width),calc(100vw - 20px)); height:min(var(--rune-height),calc(100dvh - 32px)); max-height:calc(100dvh - 32px); display:flex; flex-direction:column; z-index:60; overflow:hidden; color:#e7dfcc; font-family:'Sarabun','Segoe UI',sans-serif; background:linear-gradient(165deg,#2e2a24,#161412); border:2px solid #6b5a32; border-radius:14px; box-shadow:0 0 0 1px #0a0806,0 0 0 3px #2a2418,inset 0 1px 0 #ffdc8c1a,0 10px 32px #000a; }
#rune-panel {z-index:1200;}
#rune-overlay {position:fixed;inset:0;z-index:1190;background:#0008;}
.rune-list,.rune-editor {scrollbar-width:thin;scrollbar-color:#786137 #211d17;}
.rune-list::-webkit-scrollbar,.rune-editor::-webkit-scrollbar {width:5px;}
.rune-list::-webkit-scrollbar-thumb,.rune-editor::-webkit-scrollbar-thumb {background:#786137;border-radius:4px;}
#rune-panel .player-menu-header {padding:8px 12px;border-bottom:2px solid #6b5a32;background:linear-gradient(#c9a22720,transparent);}
#rune-panel h2 {font:600 .74rem Cinzel,Georgia,serif;letter-spacing:1.2px;color:#f0d78c;margin:0;}
#rune-body {display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;}
#rune-panel button {font-family:inherit;cursor:pointer;touch-action:manipulation;color:#d8cba8;background:linear-gradient(#302a23,#191613);border:1px solid #50432e;border-radius:7px;min-height:32px;}
#rune-panel button:disabled {opacity:.4;cursor:default;}
#rune-panel button:focus-visible {outline:2px solid #f4d47c;outline-offset:-2px;}
#rune-panel button.active,#rune-panel .selected {border-color:#bc9b47;background:#45371f;}
.rune-colors {display:flex;flex-shrink:0;gap:6px;padding:6px 10px;border-bottom:1px solid #50432e;}
.rune-colors button {flex:1;font-size:12px;}
.rune-color-red {--rune-ink:#ff746b;--rune-dark:#602323;}
.rune-color-purple {--rune-ink:#d79aff;--rune-dark:#44235f;}
.rune-color-green {--rune-ink:#8de3ad;--rune-dark:#204b37;}
.rune-colors span,.rune-slot {color:var(--rune-ink)!important;}
.rune-workspace {display:grid;grid-template-columns:42% 58%;flex:1;min-height:0;}
.rune-library {display:flex;flex-direction:column;min-height:0;border-right:1px solid #50432e;}
.rune-section-title {display:flex;justify-content:space-between;gap:4px;padding:6px 8px;font-size:11px;color:#d5bc71;}
.rune-section-title span {font-size:10px;color:#b5a586;}
.rune-list {min-height:0;overflow-y:auto;padding:0 6px 6px;overscroll-behavior:contain;}
#rune-panel .rune-card {display:flex;align-items:center;gap:7px;width:100%;padding:5px;margin-bottom:4px;text-align:left;min-height:43px;}
.rune-card strong {font-size:12px;display:block;}
.rune-card small {font-size:10px;display:block;color:#b4a58b;}
.rune-card.unowned {opacity:.6;}
.rune-gem {display:grid;place-items:center;width:27px;height:29px;flex-shrink:0;border:1px solid var(--rune-ink);border-radius:6px;background:var(--rune-dark);color:var(--rune-ink);font-size:21px;}
.rune-editor {min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-bottom:5px;}
.rune-slots {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;padding:0 8px 6px;}
#rune-panel .rune-slot {position:relative;min-height:30px;padding:0;background:var(--rune-dark);font-size:17px;}
.rune-slot small {position:absolute;right:4px;bottom:0;font-size:9px;color:#fff;}
.rune-detail {padding:6px 8px;border-block:1px solid #50432e;}
.rune-detail h3 {font-size:13px;color:#edcf85;margin:0 0 5px;}
.rune-levels {display:flex;gap:4px;}
.rune-levels button {flex:1;font-size:11px;}
.rune-detail p {font-size:11px;line-height:1.5;min-height:28px;margin:6px 0;}
.rune-detail>small {display:block;font-size:10px;color:#bbad90;}
.rune-actions {display:flex;align-items:center;justify-content:space-between;gap:5px;margin-top:5px;font-size:10px;}
.rune-actions button {padding:3px 10px;font-size:11px;}
.rune-summary {padding:6px 8px;font-size:11px;}
.rune-summary summary {color:#d5bc71;cursor:pointer;}
.rune-summary p {display:flex;justify-content:space-between;gap:5px;margin:4px 0;}
.rune-summary strong {color:#91d39f;}
.rune-footer {flex-shrink:0;display:flex;gap:5px;align-items:center;padding:6px 8px;border-top:1px solid #50432e;background:#171410;}
.rune-footer span {flex:1;min-width:0;font-size:10px;color:#cdbb91;}
.rune-footer button {padding:4px 8px;font-size:11px;}
.rune-empty,.rune-locked {margin:auto;padding:20px;text-align:center;font-size:13px;}
.rune-locked h3 {color:#efd48d;font-size:17px;}
.rune-lock-symbol {display:block;width:72px;height:72px;margin:0 auto 12px;object-fit:contain;}
.rune-upgrade-heading {display:flex;align-items:center;justify-content:space-between;gap:6px;padding:6px 8px;border-bottom:1px solid #50432e;font-size:11px;color:#d5bc71;}
.rune-upgrade-heading button {padding:3px 10px;}
.rune-upgrade-stage {position:relative;display:grid;place-items:center;width:48px;height:48px;margin:4px auto;border-radius:50%;border:1px solid #66512e;background:radial-gradient(circle,#6b3c674d,transparent 70%);}
.rune-upgrade-stage img {width:40px;height:40px;object-fit:contain;}
.rune-upgrade-stage>span {position:absolute;right:0;bottom:0;font-size:24px;font-weight:bold;}
.rune-upgrade-stage.is-working {animation:rune-upgrade-charge .65s ease-in-out infinite alternate;}
.rune-upgrade-stage.is-success {color:#b3ffc3;border-color:#80db9b;animation:rune-upgrade-success .85s ease-out;box-shadow:0 0 18px #81e6a244;}
.rune-upgrade-stage.is-fail {color:#ffa7a0;border-color:#c46b65;animation:rune-upgrade-fail .5s ease-out;}
.rune-detail .rune-upgrade-result {text-align:center;color:#e9cd86;min-height:16px;margin:4px 0;}
.rune-detail .rune-upgrade-chance {min-height:0;margin:4px 0;}
.rune-upgrade-comparison {font-size:10px;margin:6px 0;color:#d5bc71;}
.rune-upgrade-materials {margin:8px 0;padding:6px;border:1px solid #50432e;border-radius:6px;font-size:11px;}
.rune-upgrade-materials p {display:flex;justify-content:space-between;gap:6px;min-height:0;margin:4px 0;}
.rune-upgrade-materials .missing {color:#f39a90;}
@keyframes rune-upgrade-charge {to{transform:scale(1.06);box-shadow:0 0 18px #c999f988;}}
@keyframes rune-upgrade-success {0%{transform:scale(.85);filter:brightness(1.3);}50%{transform:scale(1.12);}100%{transform:scale(1);filter:brightness(1);}}
@keyframes rune-upgrade-fail {20%{transform:translateX(-6px);}40%{transform:translateX(6px);}60%{transform:translateX(-3px);}80%{transform:translateX(3px);}100%{transform:translateX(0);}}
.rune-upgrade-stage {isolation:isolate;overflow:visible;background:radial-gradient(circle,#a56aff35,transparent 72%);border-color:#8c6abb;width:86px;height:86px;margin:18px auto;}
.rune-upgrade-stage img{width:70px;height:70px}
.rune-upgrade-stage img {position:relative;z-index:2;filter:drop-shadow(0 0 4px #ae79f6);}
.rune-upgrade-stage>span {z-index:4;right:-8px;bottom:-3px;text-shadow:0 1px 3px #151019;}
.rune-forge-ring,.rune-forge-halo,.rune-forge-spark {position:absolute;pointer-events:none;}
.rune-forge-ring {inset:-5px;border:1px solid #bda0f0;border-radius:50%;opacity:.55;}
.rune-forge-ring.ring-outer {inset:-10px;border:2px dotted #cba869;}
.rune-forge-ring.ring-inner {border-top-color:#fff0b8;border-bottom-color:#d8a5ff;}
.rune-forge-halo {inset:-17px;border-radius:50%;background:radial-gradient(circle,#d3a0ff55,transparent 68%);z-index:-1;opacity:.35;}
.rune-forge-spark {left:50%;top:50%;width:3px;height:3px;background:#f7d78c;border-radius:50%;opacity:0;box-shadow:0 0 4px #ffe5a0;}
.spark-0 {--dx:0px;--dy:-32px;}.spark-1 {--dx:23px;--dy:-23px;}.spark-2 {--dx:32px;--dy:0px;}.spark-3 {--dx:23px;--dy:23px;}.spark-4 {--dx:0px;--dy:32px;}.spark-5 {--dx:-23px;--dy:23px;}.spark-6 {--dx:-32px;--dy:0px;}.spark-7 {--dx:-23px;--dy:-23px;}
.is-working .ring-outer {animation:rune-forge-turn 1.7s linear infinite;}
.is-working .ring-inner {animation:rune-forge-turn 1.1s linear infinite reverse;}
.is-working .rune-forge-halo {animation:rune-forge-breathe .45s ease-in-out infinite alternate;}
.is-working .rune-forge-spark {animation:rune-forge-gather .9s ease-in infinite;}
.is-success .rune-forge-ring {border-color:#ffe4a1;animation:rune-forge-expand 1.1s ease-out both;}
.is-success .ring-inner {animation-delay:.12s;}
.is-success .rune-forge-halo {background:radial-gradient(circle,#fff2bdcc,#d59bff55 40%,transparent 70%);animation:rune-forge-bloom 1.2s ease-out both;}
.is-success .rune-forge-spark {animation:rune-forge-scatter 1.15s ease-out both;}
.is-success img {animation:rune-forge-gem 1.2s ease-out both;}
.is-working img {animation:rune-forge-gem-charge .9s ease-in-out infinite alternate;}
.is-fail .rune-forge-ring {border-color:#c98bb0;animation:rune-forge-fizzle .85s ease-out both;}
.is-fail .rune-forge-halo {background:radial-gradient(circle,#bd7c9c66,transparent 68%);animation:rune-forge-bloom .8s ease-out both;}
.is-fail .rune-forge-spark {background:#bd8aa7;animation:rune-forge-fall .85s ease-out both;}
@keyframes rune-forge-turn {to{transform:rotate(360deg);}}
@keyframes rune-forge-breathe {to{opacity:1;transform:scale(1.13);}}
@keyframes rune-forge-gather {0%{opacity:0;transform:translate(var(--dx),var(--dy));}30%{opacity:1;}100%{opacity:0;transform:translate(0,0);}}
@keyframes rune-forge-expand {0%{opacity:1;transform:scale(.8);}100%{opacity:0;transform:scale(1.65);}}
@keyframes rune-forge-bloom {0%{opacity:0;transform:scale(.6);}20%{opacity:1;}100%{opacity:0;transform:scale(1.5);}}
@keyframes rune-forge-scatter {0%{opacity:1;transform:translate(0,0) scale(1.4);}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.3);}}
@keyframes rune-forge-fizzle {0%{opacity:.9;transform:rotate(0);}100%{opacity:0;transform:rotate(-35deg) scale(.65);}}
@keyframes rune-forge-fall {0%{opacity:.8;transform:translate(calc(var(--dx) * .55),calc(var(--dy) * .55));}100%{opacity:0;transform:translate(var(--dx),calc(var(--dy) + 12px));}}
@keyframes rune-forge-gem {0%{transform:scale(.9);}30%{transform:scale(1.4);filter:drop-shadow(0 0 7px #ffe8a8);}100%{transform:scale(1);filter:drop-shadow(0 0 4px #ae79f6);}}
@keyframes rune-forge-gem-charge {to{transform:scale(1.18);filter:drop-shadow(0 0 8px #d3a0ff);}}
@media (prefers-reduced-motion:reduce) {.rune-upgrade-stage * {animation:none!important;}.is-success .rune-forge-ring {opacity:.8;}.is-fail .rune-forge-ring {opacity:.5;}}
@media (prefers-reduced-motion:reduce) {.rune-upgrade-stage {animation:none!important;}}
#rune-notice {position:fixed;inset:0;margin:auto;box-sizing:border-box;width:min(300px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow-y:auto;padding:18px;color:#eeddbb;background:#292219;border:2px solid #8e743c;border-radius:12px;font:14px 'Sarabun',sans-serif;text-align:center;}
#rune-notice::backdrop {background:#0009;}
#rune-notice button {padding:8px 24px;}
/* The rune asset uses the same desktop icon / touch text rules as the dock. */
/* Readable native UI fonts, stronger contrast and no inherited text effects. */
#rune-panel {font-family:Tahoma,'Segoe UI',sans-serif;font-size:13px;line-height:1.5;color:#f3eee4;text-shadow:none;}
#rune-panel h2 {font-family:Tahoma,'Segoe UI',sans-serif;font-size:14px;letter-spacing:.2px;}
#rune-panel button {color:#f2eadb;font-weight:500;text-shadow:none;}
#rune-panel button:disabled {opacity:1;color:#9d968a;background:#24211c;border-color:#494237;}
.rune-section-title,.rune-upgrade-heading {font-size:12px;color:#efd18b;}
.rune-section-title span,.rune-card small {font-size:12px;color:#d8d1c3;}
.rune-card strong {font-size:13px;font-weight:600;}
.rune-card.unowned {opacity:1;}
.rune-card.unowned strong,.rune-card.unowned small {color:#aaa498;}
.rune-detail h3 {font-size:14px;color:#ffe1a1;}
.rune-detail p,.rune-levels button,.rune-actions,.rune-actions button,.rune-summary,.rune-footer button,.rune-upgrade-materials {font-size:12px;}
.rune-detail>small,.rune-upgrade-materials small,.rune-upgrade-comparison,.rune-footer span {font-size:12px;color:#d8d1c3;}
.rune-footer button {padding:4px 6px;}
.rune-upgrade-materials .missing {color:#ffb0a6;}
.rune-constellation{display:grid;grid-template-columns:286px minmax(0,1fr);gap:4px;padding:0 8px;flex:1;min-height:0;overflow:hidden}
.rune-plan-area{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0}
.rune-plan{position:relative;width:286px;height:286px;flex-shrink:0;isolation:isolate;background:radial-gradient(circle,#c99c4a0a 35%,transparent 65%)}
.rune-plan svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.rune-orbit{fill:none;stroke:#9a7d3e;stroke-width:.7;opacity:.3}
.rune-link{stroke:var(--rune-ink);stroke-width:1;opacity:.06;fill:none}.rune-link.filled{opacity:.4}
#rune-panel .rune-socket{position:absolute;display:grid;place-items:center;width:28px;height:28px;min-height:0;padding:0;border-radius:50%;border:1px solid color-mix(in srgb,var(--rune-ink) 50%,#27231f);background:radial-gradient(circle,var(--rune-dark),#141311);color:var(--rune-ink);font-size:17px;box-shadow:inset 0 0 0 2px #0c0c0bd9}
#rune-panel .rune-socket.filled{border-color:#d4b16a;box-shadow:0 0 7px color-mix(in srgb,var(--rune-ink) 40%,transparent),inset 0 0 0 2px #16130f}
#rune-panel .rune-socket.selected{outline:2px solid #fff0bb;outline-offset:2px}
.rune-socket small{position:absolute;right:-2px;bottom:-3px;border-radius:3px;background:#15130e;padding:0 2px;color:#fff4d8;font-size:10px}
.rune-character{position:absolute;left:103px;top:95px;width:80px;height:96px;display:grid;place-items:center;pointer-events:none}
.rune-character img{width:72px;height:88px;object-fit:contain;border:0;background:none;box-shadow:none}
.rune-stock{display:flex;flex-direction:column;min-width:0;min-height:0;margin:5px 0 8px;border:1px solid #76613b;border-radius:9px;overflow:hidden;background:#19171355}
.rune-stock-tabs{display:flex;flex-shrink:0}
#rune-panel .rune-stock-tabs button{flex:1;min-width:0;border:0;border-radius:0;border-bottom:2px solid transparent;background:#201c16;font-size:12px;padding:4px 1px}
#rune-panel .rune-stock-tabs button.active{border-bottom-color:#d3ac58;color:#ffe1a0}
.rune-stock-list{flex:1;padding:0 5px;overflow:auto;overscroll-behavior:contain}
#rune-panel .rune-stock-row{display:flex;align-items:center;gap:5px;width:100%;padding:8px 2px;min-height:68px;text-align:left;border:0;border-radius:0;border-bottom:1px solid #55442c;background:none}
#rune-panel .rune-stock-row.selected{background:#c29c4c12}
.rune-stock-row>span:nth-child(2){flex:1;min-width:0}.rune-stock-row strong{display:block;font-size:12px;color:#f5dc9c}.rune-stock-row small{display:block;font-size:12px;color:#dfd4be;line-height:1.5}.rune-stock-row>b{color:#e9c777;font-size:15px}
.rune-stock-emblem{position:relative;display:grid;place-items:center;flex-shrink:0;width:29px;height:29px;border:1px solid #b6924e;border-radius:50%;color:var(--rune-ink);background:radial-gradient(circle,var(--rune-dark),#161410);font-size:17px}
.rune-stock-emblem small{position:absolute;bottom:-4px;right:-2px;padding:0 2px;background:#201b12;color:#fff4d8;font-size:10px}
.rune-stock-bonuses{overflow:auto;padding:7px;font-size:12px}.rune-stock-bonuses p{display:flex;justify-content:space-between;gap:5px;margin:6px 0}.rune-stock-bonuses strong{color:#aee5b8;white-space:nowrap}
.rune-energy{stroke:#ffe8a0;stroke-width:3;stroke-linecap:round;fill:none;stroke-dasharray:10 130;animation:rune-energy-flow .6s ease-out both;filter:drop-shadow(0 0 3px #eac66d)}
.rune-socket-pulse{animation:rune-socket-power .75s ease-out}.rune-character-flash img{animation:rune-character-energy .8s ease-out both}
@keyframes rune-energy-flow{from{stroke-dashoffset:130;opacity:1}to{stroke-dashoffset:0;opacity:0}}
@keyframes rune-socket-power{0%{transform:scale(.6);filter:brightness(2)}45%{transform:scale(1.25)}100%{transform:scale(1)}}
@keyframes rune-character-energy{0%,100%{filter:none}40%{filter:brightness(1.18) drop-shadow(0 0 5px #f5d385) drop-shadow(0 0 9px #dba64188)}}
@media(max-width:420px){.rune-constellation{grid-template-columns:minmax(0,1fr) 124px;padding:0 6px}.rune-plan{zoom:.7}.rune-stock-row>b{display:none}.rune-stock-emblem{width:21px;height:21px;font-size:14px}.rune-stock-row strong{font-size:11px}#rune-panel .rune-stock-tabs button{font-size:11px}}
@media(max-width:350px){.rune-constellation{grid-template-columns:minmax(0,1fr) 118px}.rune-plan{zoom:.53}.rune-footer span{display:none}}
@media(orientation:landscape) and (max-height:500px){.rune-constellation{grid-template-columns:235px minmax(0,1fr)}.rune-plan{zoom:.7}#rune-panel .rune-stock-row{min-height:59px}}
@media(prefers-reduced-motion:reduce){.rune-energy,.rune-socket-pulse,.rune-character-flash img{animation:none}}
@media (max-width:768px) and (orientation:portrait), (any-pointer:coarse) and (orientation:portrait) {
 #rune-panel {position:fixed;top:calc((100dvh - var(--portrait-control-clearance,180px))/2);width:min(380px,calc(100vw - 20px));height:min(var(--rune-height),calc(100dvh - var(--portrait-control-clearance,180px) - 24px));max-height:calc(100dvh - var(--portrait-control-clearance,180px) - 24px);}
 .rune-gem {width:22px;font-size:18px;}
}
@media (orientation:landscape) and (max-height:560px), (any-pointer:coarse) and (orientation:landscape) {
 #rune-panel {height:min(var(--rune-height),calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 88px));max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 88px);}
}
