/* ==========================================================
   Wordularity page. Builds on site.css and the shared puzzle
   styles in codeword.css (settings bar, pills, pop-ups).
   ========================================================== */

.wu {
  --wu-face: #e9f4f5;   --wu-face2: #d4e6e9;  --wu-ink: #06080f;
  --wu-sel: #ffcf6b;    --wu-sel2: #ffb238;
  --wu-irr: #b9f59a;    --wu-irr-ink: #12470a; --wu-irr-glow: rgba(120, 255, 90, .55);
  --wu-melt1: #ffb054;  --wu-melt2: #c2410c;
}
.cw-back { color: inherit; text-decoration: none; }
.cw-back::before { content: "\2190  "; }
.cw-back:hover { color: var(--cyan-hot); }

.wu-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.75rem; align-items: start; }
.wu-main { display: flex; flex-direction: column; align-items: center; }
.wu-side { display: flex; flex-direction: column; gap: 1rem; }
.wu-side .cw-card.panel { padding: 1rem 1.1rem 1.1rem; }
.wu-side .kicker { margin-bottom: .6rem; font-size: .7rem; }

/* ---------- current word ---------- */
.wu-wordbar { display: flex; align-items: center; gap: .5rem; width: 100%; max-width: 560px; margin-bottom: .7rem; }
.wu-current {
  flex: 1; min-height: 52px; display: flex; align-items: center; gap: 3px; padding: .35rem .7rem; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(4,5,10,.75);
  font-weight: 800; font-size: 1.7rem; letter-spacing: .08em; line-height: 1; color: var(--ink);
}
.wu-current .wu-ph { font-family: var(--pixel); font-size: .72rem; font-weight: 400; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.wu-current.ok { border-color: #7ce35d; color: #b9f59a; box-shadow: 0 0 16px rgba(120,255,90,.25); }
.wu-current.dup { border-color: var(--amber); color: var(--amber); }
.wu-current.bad { animation: cw-shake .3s; border-color: var(--pink); }
.wu-preview { font-family: var(--pixel); font-size: .8rem; color: var(--cyan); min-width: 3.2em; text-align: center; }
.wu-iconbtn {
  width: 46px; height: 46px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: rgba(4,5,10,.75);
  color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.wu-iconbtn:hover { color: var(--cyan-hot); border-color: var(--cyan); }
.wu-iconbtn.ok { color: var(--cyan); }

/* ---------- board ---------- */
.wu-boardwrap {
  position: relative; width: 100%; display: flex; justify-content: center;
  background: rgba(4, 6, 12, .82); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.wu-boardwrap::before, .wu-boardwrap::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--cyan); pointer-events: none; }
.wu-boardwrap::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.wu-boardwrap::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.wu-board { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; isolation: isolate; border-radius: 4px; }
.wu-board.spin { transition: transform .38s cubic-bezier(.3,.7,.3,1); }
.wu-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--pixel); font-size: .8rem; color: var(--cyan); letter-spacing: .1em; }
.wu-loading.gone { display: none; }

.wu-tile {
  position: absolute; border-radius: 7px; cursor: pointer; line-height: 1;
  background: linear-gradient(150deg, var(--wu-face), var(--wu-face2)); color: var(--wu-ink);
  box-shadow: 0 3px 0 #8fb0b6, 0 6px 14px rgba(0,0,0,.5);
  transition: top .3s cubic-bezier(.3,1.25,.5,1), left .3s cubic-bezier(.3,1.25,.5,1), background .2s, transform .15s, opacity .25s;
}
.wu-board.still .wu-tile { transition: none !important; }
.wu-tile .ch { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--tfs); padding-bottom: 4%; }
.wu-tile .ch small { font-size: .62em; margin-left: .02em; }
.wu-tile .val { position: absolute; right: 6%; bottom: 6%; font-size: var(--vfs); font-weight: 700; color: #6a7c84; }
.wu-tile.theme .val { color: var(--pink); }
.wu-tile.sel { background: linear-gradient(150deg, #fff1c4, var(--wu-sel)); transform: scale(1.04); }
.wu-tile.sel.last { background: linear-gradient(150deg, #ffe08a, var(--wu-sel2)); }
.wu-tile.hint { animation: wu-hint 1s ease-in-out infinite; }
@keyframes wu-hint { 50% { box-shadow: 0 0 0 4px var(--cyan), 0 0 22px var(--cyan); } }
.wu-tile.irr { background: linear-gradient(150deg, #e3ffd2, var(--wu-irr)); color: var(--wu-irr-ink); animation: wu-glow 2.2s ease-in-out infinite; }
.wu-tile.irr .val { color: #3d7a2a; }
.wu-tile.irr.sel { background: linear-gradient(150deg, #fff1c4, var(--wu-sel)); }
@keyframes wu-glow { 50% { box-shadow: 0 3px 0 #5e9b45, 0 0 18px var(--wu-irr-glow); } }
.wu-tile.fixed { background: radial-gradient(circle at 35% 30%, #ffe0a8, var(--wu-melt1) 45%, var(--wu-melt2)); color: #2a0b00; box-shadow: 0 3px 0 #7a2a06, 0 0 18px rgba(255,140,40,.55); animation: wu-melt 2.6s ease-in-out infinite; }
.wu-tile.fixed .val { color: #5a1a02; }
@keyframes wu-melt { 50% { box-shadow: 0 3px 0 #7a2a06, 0 0 26px rgba(255,140,40,.85), 0 0 10px var(--wu-irr-glow); } }
.wu-tile.void { background: transparent; box-shadow: inset 0 0 18px rgba(0,0,0,.9); cursor: default; animation: none; pointer-events: none; }
.wu-tile.void .ch, .wu-tile.void .val { opacity: 0; transition: opacity .4s; }
.wu-tile.boom { animation: wu-boom .38s ease-out forwards; pointer-events: none; }
@keyframes wu-boom { 0% { transform: scale(1); } 35% { transform: scale(1.25); background: #fff; box-shadow: 0 0 30px #fff, 0 0 60px var(--cyan); } 100% { transform: scale(.2); opacity: 0; } }
.wu-tile.pop { animation: wu-pop .35s ease-out; }
@keyframes wu-pop { 40% { transform: scale(1.12); box-shadow: 0 0 22px rgba(120,255,90,.7); } }
.wu-tile.swap { animation: wu-swap .45s ease-in-out; }
@keyframes wu-swap { 50% { transform: scale(.6) rotate(12deg); opacity: .4; } }

.wu-trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; overflow: visible; }
.wu-trail polyline { fill: none; stroke: rgba(255, 178, 56, .75); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.wu-sing { position: absolute; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); --w: 0px; opacity: 0; transition: width .6s ease, opacity .6s; mix-blend-mode: screen; }
.wu-sing.on { opacity: 1; }

/* ---------- controls ---------- */
.wu-controls { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; margin-top: .2rem; }
.wu-controls .btn { min-width: 3.4rem; justify-content: center; }
.wu-controls .btn:disabled { opacity: .38; cursor: default; box-shadow: none; }
.wu-controls #rotL, .wu-controls #rotR { font-size: 1.15rem; padding-top: .45rem; padding-bottom: .45rem; }
.wu-nuke:not(:disabled) { background: linear-gradient(135deg, #ffb054, #c2410c); border-color: #ffb054; color: #1a0600; animation: wu-ready 1.4s ease-in-out infinite; }
@keyframes wu-ready { 50% { box-shadow: 0 0 22px rgba(255,150,50,.8); } }

/* ---------- side panels ---------- */
.wu-scorehead { display: flex; justify-content: space-between; align-items: baseline; }
.wu-scorehead span { font-family: var(--pixel); font-size: .78rem; color: var(--cyan-hot); }
.wu-bar { height: 12px; border: 1px solid var(--line-strong); border-radius: 2px; overflow: hidden; background: rgba(4,5,10,.7); }
.wu-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--cyan-hot)); box-shadow: 0 0 12px rgba(160,225,225,.6); transition: width .4s; }
.wu-bar.won span { background: linear-gradient(90deg, #ffb238, var(--amber)); }
.wu-nexus { display: flex; flex-direction: column; gap: .55rem; }
.wu-nx { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.wu-nx .boxes { display: flex; gap: 3px; flex-wrap: wrap; }
.wu-nx .boxes span {
  width: 26px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong);
  border-radius: 2px; font-weight: 800; font-size: 1.05rem; color: var(--cyan-hot); background: rgba(4,5,10,.6); line-height: 1;
}
.wu-nx .boxes span.new { animation: wu-reveal .6s ease-out; }
@keyframes wu-reveal { 0% { background: var(--cyan); color: var(--bg); transform: scale(1.2); } }
.wu-nx.solved .boxes span { border-color: #ffb054; color: #ffd8a8; box-shadow: 0 0 8px rgba(255,150,50,.35); }
.wu-nx.done .boxes span { border-color: var(--line); color: var(--muted); box-shadow: none; }
.wu-nx button { font-family: var(--pixel); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line-strong); background: transparent; color: var(--cyan); padding: .35rem .5rem; border-radius: 2px; cursor: pointer; }
.wu-nx button:hover { border-color: var(--cyan); color: var(--cyan-hot); }
.wu-nx .tag { font-family: var(--pixel); font-size: .6rem; letter-spacing: .08em; color: #ffb054; text-transform: uppercase; }
.wu-nx.done .tag { color: var(--muted); }
.wu-small { margin: .7rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.wu-fusion { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; color: #c6d6db; font-size: .95rem; }
.wu-fusion .dots { display: flex; gap: 4px; }
.wu-fusion .dots i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--cyan); }
.wu-fusion .dots i.on { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.wu-fusion .charges { font-family: var(--pixel); font-size: .66rem; color: var(--amber); letter-spacing: .06em; text-transform: uppercase; }
.wu-found { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 220px; overflow-y: auto; padding-right: 2px; }
.wu-found span { font-size: .88rem; font-weight: 700; letter-spacing: .04em; border: 1px solid var(--line); border-radius: 2px; padding: .18rem .4rem; color: var(--ink); text-transform: uppercase; }
.wu-found span i { font-style: normal; font-family: var(--pixel); font-size: .58rem; color: var(--cyan); margin-left: .3rem; }
.wu-found span.theme { border-color: rgba(255,215,239,.45); }
.wu-found span.theme i { color: var(--pink); }
.wu-found span.fresh { animation: wu-reveal .6s ease-out; }
#timer.low { color: var(--pink); border-color: var(--pink); }
#timer.sing { color: #c7a6ff; border-color: #8b6bd6; }

.wu-info { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.1rem; margin-top: 2rem; align-items: start; }
.wu-rules { margin: 0; padding-left: 1.1rem; color: #c6d6db; font-size: .96rem; line-height: 1.5; display: flex; flex-direction: column; gap: .5rem; }
.wu-rules b { color: var(--cyan-hot); }
.wu-letters { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0 .4rem; }
.wu-letters button { min-width: 64px; padding: .6rem .5rem; border-radius: var(--radius); border: 1px solid var(--line-strong); background: rgba(4,5,10,.8); color: var(--ink); cursor: pointer; font-weight: 800; font-size: 1.5rem; line-height: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.wu-letters button small { font-family: var(--pixel); font-size: .6rem; font-weight: 400; color: var(--cyan); letter-spacing: .06em; }
.wu-letters button:hover:not(:disabled) { border-color: #ffb054; box-shadow: 0 0 16px rgba(255,150,50,.45); }
.wu-letters button:disabled { opacity: .35; cursor: default; }
.wu-guess { width: 100%; font: inherit; font-size: 1.4rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: .6rem .8rem; border-radius: var(--radius); border: 1px solid var(--line-strong); background: rgba(4,5,10,.85); color: var(--ink); margin: .4rem 0 0; }
.wu-guess:focus { outline: 2px solid var(--cyan); }

@media (max-width: 900px) {
  .wu-layout { grid-template-columns: 1fr; gap: 1.1rem; }
  .wu-info { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cw-game .wrap { width: calc(100% - 1rem); }
  .wu-boardwrap { padding: 8px; }
  .wu-current { font-size: 1.4rem; min-height: 46px; }
  .wu-iconbtn { width: 42px; height: 42px; }
  .wu-tile { border-radius: 6px; }
  .wu-controls .btn { flex: 1 1 18%; min-width: 0; padding-left: .3rem; padding-right: .3rem; }
}
