/* ล่ามคาถา (หอทำนาย ช่วง E) — token สีเดียวกับ oracle-ai */
.spell-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:18px;padding:16px 4px}
.spell-grid>div{min-width:0}
.spell-result>*{min-width:0}
.spell-explain,.spell-block li{overflow-wrap:anywhere}
.spell-grid h2{display:flex;align-items:center;gap:8px;margin:0 0 4px;font-size:18px}
.spell-grid h2 .icon{color:#f5c451}
.spell-input textarea{width:100%;min-height:150px;resize:vertical;border-radius:10px;border:1px solid var(--line);background:rgba(2,14,20,.7);color:var(--text);font:inherit;font-size:14px;line-height:1.6;padding:12px}
.spell-input textarea:focus,.spell-result input:focus,.spell-json textarea:focus{outline:2px solid var(--accent);outline-offset:1px}
.spell-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:10px}
.spell-row label{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);white-space:nowrap}
.spell-row select{height:36px;border-radius:9px;border:1px solid var(--line);background:rgba(2,14,20,.7);color:var(--text);font:inherit;padding:0 10px}
#spellEngineBox select{height:34px;max-width:230px}
.spell-ai{font-size:12px;padding:3px 10px;border-radius:999px;border:1px solid var(--line);color:var(--muted)}
.spell-ai[data-kind=ok]{border-color:rgba(34,227,155,.5);color:#22e39b}
.spell-ai[data-kind=warn]{border-color:rgba(245,196,81,.5);color:#f5c451}
.spell-cast{height:42px;display:inline-flex;align-items:center;gap:8px;padding:0 18px;border-radius:999px;border:1px solid #f5c451;background:linear-gradient(135deg,rgba(245,196,81,.25),rgba(245,196,81,.08));color:#f5c451;font:inherit;font-size:14px;font-weight:700;cursor:pointer}
.spell-cast:disabled{opacity:.45;cursor:not-allowed}
.spell-templates{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.spell-chip{height:32px;padding:0 12px;border-radius:999px;border:1px solid var(--line);background:rgba(7,30,39,.75);color:var(--text);font:inherit;font-size:12px;cursor:pointer}
.spell-chip:hover,.spell-chip:focus-visible{border-color:var(--accent);color:var(--accent);outline:none}
.spell-status{min-height:20px;margin:10px 0 0;font-size:13px;color:var(--muted)}
.spell-status[data-kind=error]{color:#ff4d61}.spell-status[data-kind=ok]{color:#22e39b}.spell-status[data-kind=wait]{color:#f5c451}
.spell-mine{margin-top:16px;border-top:1px solid var(--line);padding-top:12px}
.spell-mine h3{display:flex;justify-content:space-between;margin:0 0 8px;font-size:14px}
.spell-mine ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.spell-mine li{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:9px;border:1px solid var(--line);background:rgba(7,30,39,.6);font-size:13px}
.spell-mine li.spell-none{color:var(--muted);justify-content:flex-start}
.spell-del{height:30px;padding:0 10px;border-radius:8px;border:1px solid rgba(255,77,97,.45);background:transparent;color:#ff4d61;font:inherit;font-size:12px;cursor:pointer;white-space:nowrap}
.spell-result{display:flex;flex-direction:column;gap:12px;padding:14px;border-radius:12px;border:1px solid var(--line);background:rgba(7,30,39,.55)}
.spell-empty{color:var(--muted);font-size:13px;line-height:1.7;padding:14px;border:1px dashed var(--line);border-radius:12px}
.spell-result input{height:38px;width:100%;border-radius:9px;border:1px solid var(--line);background:rgba(2,14,20,.7);color:var(--text);font:inherit;font-size:14px;font-weight:600;padding:0 12px}
.spell-explain{margin:0;font-size:13px;line-height:1.7}
.spell-block h4{margin:0 0 6px;font-size:12px;color:var(--muted);font-weight:600}
.spell-block ul{margin:0;padding-left:18px;font-size:13px;line-height:1.7}
.spell-block.rules ul{font-family:"Space Mono",monospace;font-size:12px;word-break:break-word}
.spell-block.ask h4{color:#f5c451}
.spell-json summary{cursor:pointer;font-size:12px;color:var(--muted)}
.spell-json textarea{width:100%;min-height:180px;margin-top:6px;border-radius:9px;border:1px solid var(--line);background:rgba(2,14,20,.85);color:var(--text);font:12px/1.5 "Space Mono",monospace;padding:10px}
.spell-json p{margin:4px 0 0;font-size:12px;color:#ff4d61}
.spell-actions{display:flex;gap:8px;flex-wrap:wrap}
.spell-actions button{height:40px;display:inline-flex;align-items:center;gap:6px;padding:0 16px;border-radius:999px;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.spell-actions button:disabled{opacity:.45;cursor:not-allowed}
.spell-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.spell-stat{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-radius:9px;border:1px solid var(--line);background:rgba(2,14,20,.55)}
.spell-stat span{font-size:11px;color:var(--muted)}.spell-stat strong{font-size:16px}
.spell-stat.up strong,.spell-trades .up{color:#22e39b}.spell-stat.down strong,.spell-trades .down{color:#ff4d61}
.spell-note{margin:0;font-size:12px;color:#f5c451;line-height:1.6}
.spell-trades{width:100%;border-collapse:collapse;font-size:12px;table-layout:fixed;min-width:0}
.spell-trades th:nth-child(1){width:30%}.spell-trades th:nth-child(2){width:12%}.spell-trades th:nth-child(3){width:22%}.spell-trades th:nth-child(4){width:18%}
.spell-trades th,.spell-trades td{text-align:left;padding:5px 6px;border-bottom:1px solid var(--line);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.spell-trades th{color:var(--muted);font-weight:600}
.spell-trades-wrap{max-height:260px;overflow-y:auto;overflow-x:hidden}
@media (max-width:860px){.spell-grid{grid-template-columns:1fr}.spell-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (prefers-reduced-motion:reduce){.spell-cast,.spell-chip{transition:none}}
