/* AI 단어 합치기 — 무한 연금술 챌린지 (wordcraft)
   짙은 남색·보라 유리질 스테이지 + 금색 포인트. 사이트 라이트/다크 어디서나 같게 보인다.
   ★규칙 안내 박스(.wc-guide)만 사이트 스타일을 쓰되 전역 .answer_shadow 의 가운데 정렬·1.1em 을 눌러 준다★ */

#wc-game {
    --wc-bg:      #0d1026;
    --wc-bg2:     #171334;
    --wc-panel:   #1b1c44;
    --wc-line:    #ffffff1f;
    --wc-line2:   #8f8fd633;
    --wc-ink:     #eceaff;
    --wc-dim:     #a9a6d4;
    --wc-gold:    #ffd479;
    --wc-gold2:   #f5a623;
    --wc-violet:  #8b7bff;
    --wc-cyan:    #6fe3ff;
    --wc-red:     #ff6b6b;
    --wc-green:   #7ee0b0;
    --wc-chip:    linear-gradient(160deg, #2b2a60, #1d1c46);
    --wc-radius:  16px;

    position: relative;
    width: 100%;
    margin: 0 auto;
    border: 1px solid #38357a;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(120% 80% at 12% 0%, #2a2260 0%, transparent 58%),
        radial-gradient(110% 90% at 92% 8%, #16305e 0%, transparent 55%),
        linear-gradient(180deg, var(--wc-bg2), var(--wc-bg));
    color: var(--wc-ink);
    box-shadow: 0 18px 45px rgba(10, 12, 40, .35);
    -webkit-user-select: none;
    user-select: none;
}
#wc-game, #wc-game * { box-sizing: border-box; }
#wc-game [hidden] { display: none !important; }
#wc-game button { font-family: inherit; color: inherit; }
#wc-game button:focus-visible,
#wc-game input:focus-visible { outline: 3px solid var(--wc-cyan); outline-offset: 2px; }
#wc-game h2 { margin: 0 0 10px; font-size: 1.16rem; font-weight: 900; line-height: 1.4; color: var(--wc-ink); }
#wc-game p { margin: 0; }

/* ── 탭 ───────────────────────────────────────────── */
.wc-tabs { display: flex; gap: 6px; padding: 10px 10px 0; }
.wc-tab {
    flex: 1 1 0; min-width: 0; min-height: 46px; padding: 0 8px;
    border: 1px solid var(--wc-line2); border-bottom: 0;
    border-radius: 12px 12px 0 0;
    background: #ffffff08; color: var(--wc-dim);
    font-size: .92rem; font-weight: 800; cursor: pointer;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.wc-tab.on { background: linear-gradient(180deg, #33306e, #242254); color: var(--wc-gold); border-color: #6f68c4; }

/* ── 챌린지 HUD ───────────────────────────────────── */
.wc-hud { padding: 10px 10px 0; }
.wc-hud-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; align-items: stretch; }
.wc-hud-cell {
    min-width: 0; padding: 7px 4px; text-align: center;
    border-radius: 10px; background: #ffffff0a; border: 1px solid var(--wc-line);
}
.wc-hud-cell small { display: block; font-size: .6rem; font-weight: 700; color: var(--wc-dim); letter-spacing: .02em; }
.wc-hud-cell strong {
    display: block; margin-top: 2px; font-size: 1.02rem; font-weight: 900; line-height: 1.3;
    font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.wc-hud-cell em { display: block; font-style: normal; font-size: .6rem; color: var(--wc-dim); }
.wc-hud-cell.wc-goal { grid-column: span 2; background: linear-gradient(160deg, #3a2f66, #241f4d); border-color: #7a6ad0; }
.wc-hud-cell.wc-goal strong { color: var(--wc-gold); font-size: 1.05rem; }
.wc-hud-cell.wc-scorebox strong { color: var(--wc-gold); }
#wc-time.warn { color: var(--wc-red); animation: wcWarn .55s ease-in-out infinite alternate; }
@keyframes wcWarn { from { opacity: 1; transform: scale(1); } to { opacity: .5; transform: scale(1.1); } }

.wc-track { margin: 8px 2px 0; height: 6px; border-radius: 4px; background: #0a0a1f; overflow: hidden; }
#wc-progress { display: block; height: 100%; width: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--wc-violet), var(--wc-cyan), var(--wc-gold)); transition: width .2s linear; }

.wc-hud-btns { display: flex; gap: 6px; margin-top: 8px; }
.wc-hud-btns button {
    flex: 1 1 0; min-width: 0; min-height: 46px; padding: 4px 6px;
    border-radius: 10px; border: 1px solid var(--wc-line2);
    background: linear-gradient(160deg, #2a2860, #1d1b42);
    font-size: .84rem; font-weight: 800; cursor: pointer; touch-action: manipulation;
}
.wc-hud-btns button small { display: block; margin-top: 2px; font-size: .6rem; font-weight: 600; opacity: .68; }
.wc-hud-btns button:disabled { opacity: .4; cursor: default; }
#wc-hint { color: var(--wc-gold); }
#wc-giveup { flex: 0 0 34%; background: linear-gradient(160deg, #3d2440, #27182c); border-color: #b87fae55; }
.wc-hintmsg {
    margin-top: 8px; padding: 8px 12px; border-radius: 10px;
    border: 1px solid #ffd47955; background: #ffd4790f; color: var(--wc-gold);
    font-size: .82rem; font-weight: 700; line-height: 1.5;
}

/* ── 자유 탐험 정보줄 ─────────────────────────────── */
.wc-freebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 10px 0; }
.wc-fstat { flex: 1 1 200px; min-width: 0; font-size: .8rem; font-weight: 800; color: var(--wc-cyan); }
.wc-ribbon { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; font-size: .7rem; color: var(--wc-dim); }
.wc-ribbon-t { font-weight: 800; color: var(--wc-gold); }
.wc-ribbon-i { padding: 3px 8px; border-radius: 999px; background: #ffffff0d; border: 1px solid var(--wc-line); }
.wc-ribbon-i b { color: var(--wc-ink); }
.wc-ribbon-i em, .wc-ribbon-i i { font-style: normal; opacity: .7; }
.wc-ghostbtn {
    min-height: 36px; padding: 0 12px; border-radius: 9px;
    border: 1px solid var(--wc-line2); background: #ffffff0a; color: var(--wc-dim);
    font-size: .74rem; font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.wc-ghostbtn:hover { color: var(--wc-ink); }

/* ── 작업대 레이아웃 ──────────────────────────────── */
.wc-work { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 10px; }
.wc-canvas-wrap { min-width: 0; }
.wc-canvas {
    position: relative; min-height: 46vh; padding: 12px;
    border: 1px dashed #7a6ad066; border-radius: var(--wc-radius);
    background: radial-gradient(120% 90% at 50% 0%, #241f52 0%, #12122c 100%);
    overflow: hidden;
}
.wc-canvas-empty {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 86%; text-align: center; font-size: .82rem; line-height: 1.7; color: var(--wc-dim);
}
.wc-canvas-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
#wc-sel-info { flex: 1 1 auto; min-width: 0; font-size: .76rem; font-weight: 700; color: var(--wc-cyan); }

.wc-side {
    min-width: 0; display: flex; flex-direction: column;
    border: 1px solid var(--wc-line); border-radius: var(--wc-radius);
    background: #ffffff07; padding: 10px;
}
.wc-side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wc-search { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; margin: 0; padding: 0 10px; min-height: 40px; border-radius: 9px; border: 1px solid var(--wc-line2); background: #0c0c22; color: var(--wc-dim); }
.wc-search input { flex: 1 1 auto; min-width: 0; height: 36px; border: 0; background: none; color: var(--wc-ink); font-size: .86rem; outline: none; }
.wc-search input::-webkit-search-cancel-button { filter: invert(.7); }
.wc-count { flex: 0 0 auto; padding: 4px 9px; border-radius: 999px; background: #ffd4791a; color: var(--wc-gold); font-size: .74rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.wc-list { max-height: 240px; overflow-y: auto; overflow-x: hidden; align-content: flex-start; }
.wc-list-empty { margin-top: 10px; text-align: center; font-size: .78rem; color: var(--wc-dim); }

/* ── 원소 칩 ──────────────────────────────────────── */
.wc-chips { display: flex; flex-wrap: wrap; gap: 7px; position: relative; }
.wc-rowwrap { position: relative; display: inline-flex; }
.wc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; max-width: 100%; padding: 0 12px;
    border: 1px solid var(--wc-line2); border-radius: 11px;
    background: var(--wc-chip); color: var(--wc-ink);
    font-size: .88rem; font-weight: 800; line-height: 1.2;
    cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 0 #0b0b20;
    transition: transform .1s ease, box-shadow .1s ease, border-color .1s ease;
}
.wc-chip:active { transform: translateY(1px); box-shadow: none; }
.wc-chip .wc-emo { font-size: 1.1rem; line-height: 1; }
.wc-chip .wc-w { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.wc-chip.base { border-color: #6fe3ff77; background: linear-gradient(160deg, #1f3a63, #182a4c); }
.wc-chip.sel { border-color: var(--wc-gold); box-shadow: 0 0 0 3px #ffd4793d, 0 2px 0 #0b0b20; transform: translateY(-2px); }
.wc-chip.hot { border-color: var(--wc-green); box-shadow: 0 0 0 3px #7ee0b040; }
.wc-chip.tried { opacity: .52; }
.wc-chip.isnew { border-color: var(--wc-cyan); box-shadow: 0 0 0 2px #6fe3ff2e, 0 2px 0 #0b0b20; }
.wc-chip.first { border-color: var(--wc-gold); background: linear-gradient(160deg, #4a3a1c, #2c2413); box-shadow: 0 0 0 2px #ffd4792e, 0 2px 0 #0b0b20; }
.wc-chip.dragging { opacity: .35; }
.wc-chip.pop { animation: wcPop .22s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes wcPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wc-chip .wc-new {
    margin-left: 2px; padding: 1px 5px; border-radius: 999px;
    background: var(--wc-gold); color: #2a1d00;
    font-size: .56rem; font-style: normal; font-weight: 900; letter-spacing: .04em;
    animation: wcBlink 1.1s ease-in-out infinite alternate;
}
@keyframes wcBlink { from { opacity: .45; } to { opacity: 1; } }
.wc-why {
    position: absolute; right: -4px; top: -6px; z-index: 2;
    width: 22px; height: 22px; padding: 0; border-radius: 50%;
    border: 1px solid var(--wc-line2); background: #0c0c22; color: var(--wc-dim);
    font-size: .68rem; font-weight: 900; line-height: 1; cursor: pointer;
}
.wc-why:hover { color: var(--wc-gold); border-color: var(--wc-gold); }

/* ── 연금술 중 ────────────────────────────────────── */
.wc-brews { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.wc-brew {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 8px 10px; border-radius: 11px;
    border: 1px solid #7a6ad077; background: #ffffff0d;
    font-size: .82rem; font-weight: 800;
}
.wc-brew-plus { color: var(--wc-gold); font-weight: 900; }
.wc-brew-state { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--wc-dim); font-weight: 700; }
.wc-brew-state b { color: var(--wc-gold); }
.wc-brew.done { border-color: var(--wc-green); }
.wc-brew.fail { border-color: var(--wc-red); opacity: .6; }
.wc-brew.same { animation: wcShake .42s ease; border-color: #b0aacf; }
@keyframes wcShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
/* ★높이 고정 CSS 점 — 문자열 점("...") 애니메이션은 줄이 무너지므로 쓰지 않는다★ */
.wc-dots { display: inline-flex; align-items: center; gap: 3px; width: 22px; height: 12px; font-style: normal; }
.wc-dots > i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--wc-gold); opacity: .3; animation: wcDot 1.05s infinite; }
.wc-dots > i:nth-child(2) { animation-delay: .18s; }
.wc-dots > i:nth-child(3) { animation-delay: .36s; }
@keyframes wcDot { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

/* ── 드래그 고스트 ────────────────────────────────── */
/* ★pointer-events:none 필수 — 고스트가 포인터를 가리면 elementFromPoint 가 드롭 대상을 못 찾는다★ */
.wc-ghostlayer {
    position: fixed; z-index: 999; left: 0; top: 0; pointer-events: none;
    transform: translate(-50%, -50%);
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0 12px; border-radius: 11px;
    border: 1px solid var(--wc-gold); background: #2b2a60ee; color: var(--wc-ink);
    font-size: .88rem; font-weight: 800; box-shadow: 0 8px 22px #0008;
}
.wc-ghostlayer .wc-emo { font-size: 1.1rem; }

/* ── 토스트 ───────────────────────────────────────── */
.wc-toast {
    position: absolute; left: 50%; bottom: 14px; z-index: 30;
    display: flex; align-items: center; gap: 8px;
    max-width: 92%; padding: 10px 16px; border-radius: 999px;
    background: #0c0c22ee; border: 1px solid var(--wc-line2); color: var(--wc-ink);
    font-size: .78rem; font-weight: 700; text-align: center;
    opacity: 0; pointer-events: none; transform: translate(-50%, 10px);
    transition: opacity .18s, transform .18s;
}
.wc-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.wc-toast.warn { border-color: #ff6b6b88; color: #ffd9d9; }
.wc-toast.gold { border-color: var(--wc-gold); color: var(--wc-gold); box-shadow: 0 0 0 3px #ffd4791f, 0 10px 26px #0007; }
.wc-toast-btn {
    flex: 0 0 auto; min-height: 30px; padding: 0 10px; border-radius: 999px;
    border: 1px solid var(--wc-gold); background: none; color: var(--wc-gold);
    font-size: .72rem; font-weight: 900; cursor: pointer;
}

/* ── 조합법 팝오버 ────────────────────────────────── */
.wc-pop {
    position: absolute; z-index: 40; max-width: 260px; padding: 10px 30px 10px 12px;
    border-radius: 12px; border: 1px solid var(--wc-gold); background: #17163add;
    backdrop-filter: blur(4px);
    box-shadow: 0 10px 28px #0007;
}
.wc-pop b { display: block; font-size: .74rem; color: var(--wc-dim); font-weight: 700; }
.wc-pop span { display: block; margin-top: 4px; font-size: .95rem; font-weight: 900; color: var(--wc-gold); }
.wc-pop-x { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border: 0; background: none; color: var(--wc-dim); font-size: .8rem; cursor: pointer; }

/* ── 오버레이 패널 ────────────────────────────────── */
.wc-overlay {
    position: absolute; inset: 0; z-index: 50;
    display: none; align-items: center; justify-content: center; padding: 18px;
    background: linear-gradient(180deg, #0d1026bb, #0d1026f2 45%);
}
.wc-overlay.on { display: flex; }
.wc-panel {
    width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; text-align: center;
    padding: 22px 18px; border: 1px solid #7a6ad077; border-radius: 18px;
    background: linear-gradient(155deg, #262357f2, #14142ef7);
    box-shadow: 0 16px 45px #04051266;
}
.wc-panel-sm { max-width: 340px; }
.wc-eyebrow { display: block; margin-bottom: 8px; font-size: .66rem; font-weight: 900; letter-spacing: .14em; color: var(--wc-cyan); }
.wc-rules { margin: 0 0 14px; padding: 0; list-style: none; text-align: left; }
.wc-rules li { position: relative; padding: 5px 0 5px 20px; font-size: .84rem; line-height: 1.6; color: #d8d5f5; }
.wc-rules li::before { content: '⚗️'; position: absolute; left: 0; top: 5px; font-size: .78rem; }
.wc-nickrow { display: block; margin: 0 0 12px; text-align: left; font-size: .74rem; font-weight: 700; color: var(--wc-dim); }
.wc-nickrow small { font-weight: 600; opacity: .8; }
.wc-nickrow input {
    display: block; width: 100%; margin-top: 5px; height: 42px; padding: 0 12px;
    border-radius: 10px; border: 1px solid var(--wc-line2); background: #0c0c22; color: var(--wc-ink);
    font-size: .92rem; outline: none;
}
.wc-best { margin-bottom: 10px; font-size: .8rem; font-weight: 800; color: var(--wc-gold); min-height: 1em; }
.wc-primary, .wc-secondary {
    display: block; width: 100%; min-height: 52px; margin-top: 8px; padding: 0 14px;
    border-radius: 12px; font-size: 1rem; font-weight: 900; cursor: pointer; touch-action: manipulation;
}
.wc-primary { border: 0; background: linear-gradient(160deg, var(--wc-gold), var(--wc-gold2)); color: #2a1d00; box-shadow: 0 4px 0 #8a5c00; }
.wc-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #8a5c00; }
.wc-primary:disabled { opacity: .6; cursor: default; }
.wc-secondary { border: 1px solid var(--wc-line2); background: #ffffff0d; color: var(--wc-ink); }
.wc-panel > small { display: block; margin-top: 10px; font-size: .68rem; color: var(--wc-dim); }
#wc-clear-panel p { font-size: .92rem; font-weight: 800; color: var(--wc-gold); }
#wc-newrecord { display: inline-block; margin-bottom: 8px; padding: 4px 12px; border-radius: 999px; background: var(--wc-gold); color: #2a1d00; font-size: .72rem; font-weight: 900; }
#wc-final { display: inline-block; font-size: 3.1rem; font-weight: 900; line-height: 1.1; color: var(--wc-gold); font-variant-numeric: tabular-nums; }
.wc-final-unit { font-size: 1rem; font-weight: 800; color: var(--wc-dim); }
#wc-grade { margin-top: 4px; font-size: 1.12rem; font-weight: 900; }
#wc-reason { margin-top: 6px; font-size: .84rem; color: var(--wc-dim); }
#wc-detail { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 12px 0 4px; }
#wc-detail span { padding: 6px 11px; border-radius: 999px; background: #ffffff0d; border: 1px solid var(--wc-line); font-size: .74rem; color: var(--wc-dim); }
#wc-detail b { color: var(--wc-ink); font-size: .9rem; }

/* 조합 2개가 동시에 돌 때 */
#wc-game.busy .wc-chip { cursor: progress; }

/* ── 반응형 ───────────────────────────────────────── */
@media (min-width: 820px) {
    .wc-work { grid-template-columns: minmax(0, 1fr) 260px; }
    .wc-canvas { min-height: 420px; }
    .wc-list { max-height: 420px; }
    .wc-hud-grid { gap: 6px; }
    .wc-hud-cell strong { font-size: 1.12rem; }
    #wc-game h2 { font-size: 1.3rem; }
}
@media (min-width: 1280px) {
    .wc-work { grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; padding: 14px; }
    .wc-canvas { min-height: 460px; }
    .wc-list { max-height: 460px; }
}
@media (max-width: 480px) {
    .wc-hud-grid { grid-template-columns: repeat(3, 1fr); }
    .wc-hud-cell.wc-goal { grid-column: span 3; order: -1; }
    .wc-chip { padding: 0 10px; font-size: .84rem; }
    .wc-chip .wc-w { max-width: 7.2em; }
    .wc-canvas { padding: 10px; }
}
@media (max-width: 360px) {
    .wc-tab { font-size: .84rem; }
    .wc-chip { min-height: 44px; padding: 0 9px; font-size: .8rem; gap: 4px; }
    .wc-chip .wc-w { max-width: 6em; }
    .wc-hud-cell strong { font-size: .92rem; }
    .wc-panel { padding: 18px 13px; }
    #wc-final { font-size: 2.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    #wc-game *, #wc-game *::before, #wc-game *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ── 규칙 안내 박스 (사이트 공통 .answer_shadow 위에 얹는다) ── */
.wc-guide { text-align: left; line-height: 1.7; margin-top: 16px; }
.wc-guide p { font-size: .9rem; }
.wc-guide h3 { font-size: 1rem; }
.wc-guide small { font-size: .8rem; }
