/* ==========================================================================
   Game: Word Crossing
   Self-contained — every class is prefixed .wc-. Dark dusk-green "stage" in
   both site themes; crossword cells + a swipeable letter wheel.
   ========================================================================== */

.wc {
  --wc-bg: #10202a;
  --wc-card: rgba(255, 255, 255, .06);
  --wc-card-hover: rgba(255, 255, 255, .11);
  --wc-line: rgba(255, 255, 255, .13);
  --wc-text: #fff;
  --wc-sub: rgba(255, 255, 255, .72);
  --wc-mint: #3ddc97;
  --wc-mint-deep: #1a9e6a;
  --wc-bad: #ff5c8a;
  --wc-coin: #ffc53d;
  --wc-cell: rgba(255, 255, 255, .12);
  --wc-accent: var(--hot);

  position: relative;
  margin: 10px 0 40px;
  padding: 36px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(100% 70% at 100% 0%, rgba(61, 220, 151, .22), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(91, 61, 245, .42), transparent 60%),
    var(--wc-bg);
  color: var(--wc-text);
  isolation: isolate;
  min-height: 560px;
}
:root[data-theme="dark"] .wc { border: 1px solid var(--line); }

/* crossword motif (decorative) */
.wc::before {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  z-index: -1;
  width: 260px;
  height: 260px;
  opacity: .1;
  background:
    linear-gradient(var(--wc-mint) 0 0) 0 80px / 260px 52px no-repeat,
    linear-gradient(var(--wc-mint) 0 0) 156px 0 / 52px 260px no-repeat;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 48px, transparent 48px 52px), repeating-linear-gradient(#000 0 48px, transparent 48px 52px);
  -webkit-mask-composite: source-in;
  mask: repeating-linear-gradient(90deg, #000 0 48px, transparent 48px 52px), repeating-linear-gradient(#000 0 48px, transparent 48px 52px);
  mask-composite: intersect;
}

.wc[data-wc-mode="play"]::before, .wc[data-wc-mode="result"]::before { display: none; }

.wc-screen[hidden] { display: none !important; }
.wc-screen { animation: wc-fade .35s var(--ease); }
@keyframes wc-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.wc-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.wc-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px;
  border: 1px solid var(--wc-line); border-radius: var(--radius-pill);
  background: transparent; color: var(--wc-text);
  font: 600 .875rem/1.2 var(--font); cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
}
.wc-ghost:hover:not(:disabled) { background: var(--wc-card-hover); }
.wc-ghost:disabled { opacity: .35; cursor: default; }
.wc-ghost--danger { color: var(--wc-sub); }
.wc-ghost--danger.is-confirm { border-color: var(--wc-bad); color: var(--wc-bad); }
.wc-ghost--sm { min-height: 38px; padding: 6px 18px; font-size: .82rem; }
.wc-ghost--go:not(:disabled) { border-color: transparent; background: var(--wc-mint); color: #06281d; }
.wc-ghost .wc-ico--off { display: none; }
.wc-ghost.is-off .wc-ico--on { display: none; }
.wc-ghost.is-off .wc-ico--off { display: block; }

.wc-icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0;
  border: 1px solid var(--wc-line); border-radius: 50%; background: var(--wc-card); color: var(--wc-text);
  cursor: pointer; transition: background-color .2s var(--ease);
}
.wc-icon-btn:hover { background: var(--wc-card-hover); }
.wc .btn-pill { min-height: 46px; padding: 11px 24px; }
.wc .btn-pill:not(.btn-pill--hot) { background: var(--brand-soft); color: var(--night); }
.wc button:focus-visible { outline: 3px solid var(--wc-accent); outline-offset: 2px; }

/* ==========================================================================
   Home
   ========================================================================== */
.wc-home__head { display: flex; align-items: flex-start; gap: 22px; max-width: 760px; }
.wc-logo {
  position: relative; flex: none; width: 76px; height: 76px; border-radius: 20px;
  background: linear-gradient(145deg, var(--wc-mint), var(--wc-mint-deep));
  box-shadow: 0 12px 30px rgba(26, 158, 106, .4);
}
.wc-logo__ring { position: absolute; inset: 12px; border: 2px dashed rgba(6, 40, 29, .45); border-radius: 50%; animation: wc-spin 14s linear infinite; }
.wc-logo span:not(.wc-logo__ring) {
  position: absolute; display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; color: #06281d; font-size: .7rem; font-weight: 800;
}
.wc-logo span:nth-child(2) { left: 28px; top: 8px; }
.wc-logo span:nth-child(3) { left: 48px; top: 28px; }
.wc-logo span:nth-child(4) { left: 28px; top: 48px; }
.wc-logo span:nth-child(5) { left: 8px; top: 28px; }
@keyframes wc-spin { to { transform: rotate(360deg); } }

.wc-kicker {
  display: inline-block; margin-bottom: 8px; padding: 4px 12px; border-radius: var(--radius-pill);
  background: rgba(61, 220, 151, .15); color: var(--wc-mint);
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.wc-title { margin: 0 0 8px; font-size: clamp(2rem, 4.4vw, 3rem); letter-spacing: -.035em; line-height: 1.05; }
.wc-lead { margin: 0; color: var(--wc-sub); }

.wc-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 28px 0 26px; }
.wc-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.wc-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--wc-line); border-radius: var(--radius-pill); background: var(--wc-card); }
.wc-chip__label { color: var(--wc-sub); font-size: .78rem; font-weight: 500; }
.wc-chip strong { color: var(--wc-accent); font-size: 1rem; }
.wc-coin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe28a, var(--wc-coin) 55%, #d38a00); box-shadow: inset 0 0 0 2px rgba(150, 90, 0, .35); }
.wc-toolbar__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.wc-subtitle { margin: 0 0 14px; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; color: var(--wc-sub); }

.wc-stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.wc-stage { padding: 16px; border: 1px solid var(--wc-line); border-radius: var(--radius-md); background: var(--wc-card); }
.wc-stage.is-cleared { border-color: rgba(61, 220, 151, .45); }
.wc-stage.is-locked { opacity: .55; }
.wc-stage__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.wc-stage__num { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--wc-mint); color: #06281d; font-size: 1.1rem; font-weight: 700; }
.wc-stage.is-locked .wc-stage__num { background: rgba(255, 255, 255, .14); color: var(--wc-text); }
.wc-stage__info { flex: 1; min-width: 0; }
.wc-stage__name { margin: 0; font-size: 1rem; font-weight: 700; color: var(--wc-text); }
.wc-stage__blurb { margin: 2px 0 0; color: var(--wc-sub); font-size: .8rem; line-height: 1.4; }
.wc-stage__stars { flex: none; white-space: nowrap; }
.wc-stage__levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.wc-lvl {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  padding: 10px 2px 8px; border: 1px solid var(--wc-line); border-radius: 12px;
  background: rgba(255, 255, 255, .04); color: var(--wc-text); font-family: var(--font); cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease);
}
.wc-lvl:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(61, 220, 151, .6); background: var(--wc-card-hover); }
.wc-lvl:disabled { cursor: not-allowed; opacity: .55; }
.wc-lvl.is-done { border-color: rgba(61, 220, 151, .45); }
.wc-lvl.is-next { border-color: var(--hot); box-shadow: 0 0 0 1px var(--hot) inset; }
.wc-lvl__n { font-size: 1.05rem; font-weight: 800; }
.wc-lvl__stars .wc-star { font-size: .7rem; }
.wc-star { color: rgba(255, 255, 255, .22); font-size: 1.05rem; line-height: 1; }
.wc-star.is-on { color: var(--hot); text-shadow: 0 0 12px rgba(255, 216, 77, .5); }
.wc-noscript { margin: 16px 0 0; padding: 14px 18px; border-radius: var(--radius-sm); background: rgba(255, 92, 138, .15); }

/* ==========================================================================
   Play
   ========================================================================== */
.wc-play { position: relative; }
.wc-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 20px; }
.wc-hud__stage { padding: 6px 14px; border-radius: var(--radius-pill); background: rgba(61, 220, 151, .15); color: var(--wc-mint); font-size: .8rem; font-weight: 700; }
.wc-hud__stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-left: auto; }
.wc-stat { display: flex; flex-direction: column; line-height: 1.2; }
.wc-stat__label { color: var(--wc-sub); font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.wc-stat strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.wc-stat__coins { color: var(--wc-coin); }

.wc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 32px; align-items: center; }

.wc-gridwrap { display: flex; justify-content: center; min-width: 0; }
.wc-grid {
  --wc-cols: 5;
  --wc-rows: 5;
  display: grid;
  grid-template-columns: repeat(var(--wc-cols), minmax(0, 1fr));
  gap: 4px;
  width: min(100%, calc(var(--wc-cols) * 52px));
}
.wc-cell { position: relative; aspect-ratio: 1; border-radius: 8px; background: var(--wc-cell); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
@supports not (aspect-ratio: 1) { .wc-cell { padding-bottom: 100%; } }
.wc-cell.is-void { background: transparent; box-shadow: none; }
.wc-cell__ch { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(.95rem, 3.6vw, 1.45rem); font-weight: 800; color: #06281d; }
.wc-cell.is-open { background: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); }
.wc-cell.is-open.is-pop { animation: wc-pop .35s var(--ease); background: var(--wc-mint); }
.wc-cell.is-hinted { background: #ffe9a8; }
.wc-cell.is-flash { animation: wc-flash .6s ease; }
@keyframes wc-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes wc-flash { 50% { transform: scale(1.1); box-shadow: 0 0 0 3px var(--hot); } }

.wc-controls { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.wc-preview {
  display: flex; align-items: center; justify-content: center;
  min-width: 120px; min-height: 48px; margin-bottom: 40px; padding: 6px 20px;
  border-radius: var(--radius-pill); background: var(--wc-mint); color: #06281d;
  font-size: 1.5rem; font-weight: 800; letter-spacing: .08em;
  transition: opacity .15s var(--ease);
}
.wc-preview.is-empty { opacity: 0; }
.wc-preview.is-shake { animation: wc-shake .4s ease; }
@keyframes wc-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.wc-toast { position: absolute; left: 50%; top: 52px; z-index: 4; transform: translateX(-50%); white-space: nowrap; pointer-events: none; margin: 0; padding: 4px 14px; border-radius: var(--radius-pill); font-size: .85rem; font-weight: 700; color: var(--night); opacity: 0; transition: opacity .2s var(--ease); }
.wc-toast.is-show { opacity: 1; }
.wc-toast.is-good { background: #fff; }
.wc-toast.is-bonus { background: var(--wc-coin); }
.wc-toast.is-bad { background: var(--wc-bad); color: #3a0716; }
.wc-toast.is-same { background: var(--brand-soft); }

.wc-wheelwrap { display: flex; align-items: flex-end; justify-content: center; gap: 10px; width: 100%; }
.wc-wheel {
  position: relative;
  flex: none;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .1), rgba(255, 255, 255, .05) 70%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .1), 0 18px 40px rgba(0, 0, 0, .3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.wc-wheel.is-spun .wc-letter { animation: wc-in .35s var(--ease); }
@keyframes wc-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.3); } }
.wc-wheel__line { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wc-wheel__line polyline { fill: none; stroke: var(--wc-mint); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.wc-letter {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font: 800 1.85rem/1 var(--font);
  transform: translate(-50%, -50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.wc-wheel.is-7 .wc-letter { width: 54px; height: 54px; font-size: 1.6rem; }
@media (hover: hover) { .wc-letter:hover { background: rgba(255, 255, 255, .08); } }
.wc-letter.is-on { background: var(--wc-mint); color: #06281d; }
.wc-shuffle {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  display: grid; place-items: center; width: 46px; height: 46px; padding: 0;
  border: 1px solid var(--wc-line); border-radius: 50%;
  background: rgba(16, 32, 42, .85); color: var(--wc-sub);
  transform: translate(-50%, -50%); cursor: pointer;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.wc-shuffle:hover { color: #fff; background: rgba(40, 60, 72, .95); }

.wc-side-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 64px; padding: 8px 4px;
  border: 1px solid var(--wc-line); border-radius: 16px;
  background: var(--wc-card); color: var(--wc-text);
  font: 600 .72rem/1.1 var(--font); cursor: pointer;
  transition: background-color .2s var(--ease), opacity .2s var(--ease);
}
.wc-side-btn:hover:not(:disabled) { background: var(--wc-card-hover); }
.wc-side-btn:disabled { opacity: .4; cursor: not-allowed; }
.wc-side-btn b { min-width: 24px; padding: 1px 6px; border-radius: 10px; background: var(--wc-coin); color: var(--night); font-size: .7rem; }
.wc-side-btn[data-wc-bonus] b { background: var(--brand-soft); }
.wc-side-btn.is-bump { animation: wc-bump .45s var(--ease); }
@keyframes wc-bump { 40% { transform: scale(1.15); } }

.wc-entry-btns { display: flex; gap: 10px; margin-top: 14px; }
.wc-bonus-panel { width: 100%; max-width: 360px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--wc-line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .05); }
.wc-bonus-panel[hidden] { display: none; }
.wc-bonus-panel__title { margin: 0 0 6px; color: var(--wc-sub); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.wc-bonus-panel__list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wc-bonus-panel__list li { padding: 3px 10px; border-radius: var(--radius-pill); background: rgba(255, 197, 61, .2); font-size: .8rem; font-weight: 700; }
.wc-bonus-panel__list li.is-empty { background: none; padding: 0; color: var(--wc-sub); font-weight: 500; }

/* pause */
.wc-play.is-paused .wc-layout { filter: blur(14px); pointer-events: none; user-select: none; }
.wc-paused { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; }
.wc-paused[hidden] { display: none; }
.wc-paused__card { max-width: 420px; padding: 28px; border: 1px solid var(--wc-line); border-radius: var(--radius-md); background: rgba(16, 32, 42, .95); box-shadow: 0 20px 50px rgba(0, 0, 0, .45); text-align: center; }
.wc-paused__title { margin: 0 0 6px; font-size: 1.6rem; }
.wc-paused__card p { margin: 0 0 20px; color: var(--wc-sub); font-size: .9rem; }
.wc-paused__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ==========================================================================
   Results
   ========================================================================== */
.wc-result { max-width: 640px; margin: 0 auto; padding: 10px 0; text-align: center; }
.wc-result__stars { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
.wc-star--big { font-size: clamp(3rem, 9vw, 4.25rem); opacity: 0; animation: wc-star-in .5s var(--ease) forwards; }
@keyframes wc-star-in { from { opacity: 0; transform: scale(.3) rotate(-30deg); } to { opacity: 1; transform: none; } }
.wc-result__title { margin: 0 0 6px; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.wc-result__new { display: inline-block; margin: 0 0 10px; padding: 4px 14px; border-radius: var(--radius-pill); background: var(--hot); color: var(--night); font-size: .8rem; font-weight: 700; }
.wc-result__new[hidden] { display: none; }
.wc-result__text { margin: 0 auto 24px; max-width: 460px; color: var(--wc-sub); }
.wc-result__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 26px; }
.wc-result__stats div { padding: 14px 8px; border: 1px solid var(--wc-line); border-radius: var(--radius-sm); background: var(--wc-card); }
.wc-result__stats dt { color: var(--wc-sub); font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.wc-result__stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wc-result__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.wc-result__actions [hidden] { display: none; }

/* ==========================================================================
   How to play
   ========================================================================== */
.wc-guide { margin: 0 0 56px; }
.wc-guide .section-head__title { margin-bottom: 22px; }
.wc-guide__item { height: 100%; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow); }
.wc-guide__item h3 { margin: 12px 0 6px; font-size: 1.05rem; }
.wc-guide__item p { margin: 0; color: var(--sub); font-size: .9rem; }
.wc-guide__num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--onbrand); font-weight: 700; }
.wc-guide__back { margin: 24px 0 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 991.98px) {
  .wc-layout { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 767.98px) {
  .wc { padding: 24px 20px; min-height: 0; }
  .wc-result__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wc-hud { margin-bottom: 14px; }
  .wc-stages { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .wc { margin-left: -4px; margin-right: -4px; padding: 22px 14px; border-radius: var(--radius-md); }
  .wc-home__head { flex-direction: column; gap: 16px; }
  .wc-logo { width: 64px; height: 64px; }
  .wc-logo span:not(.wc-logo__ring) { width: 18px; height: 18px; font-size: .62rem; }
  .wc-logo span:nth-child(2) { left: 23px; top: 6px; }
  .wc-logo span:nth-child(3) { left: 40px; top: 23px; }
  .wc-logo span:nth-child(4) { left: 23px; top: 40px; }
  .wc-logo span:nth-child(5) { left: 6px; top: 23px; }
  .wc-toolbar { flex-direction: column; align-items: stretch; }
  .wc-toolbar__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .wc-toolbar__actions .btn-pill { grid-column: 1 / -1; }
  .wc-grid { gap: 3px; width: min(100%, calc(var(--wc-cols) * 40px)); }
  .wc-hud__stats { margin-left: auto; }
  .wc-cell { border-radius: 6px; }
  .wc-wheel { width: 220px; height: 220px; }
  .wc-letter { width: 54px; height: 54px; font-size: 1.6rem; }
  .wc-wheel.is-7 .wc-letter { width: 48px; height: 48px; font-size: 1.4rem; }
  .wc-wheelwrap { gap: 6px; }
  .wc-side-btn { width: 54px; }
  .wc-preview { font-size: 1.25rem; min-height: 42px; margin-bottom: 36px; }
  .wc-toast { top: 46px; }
  .wc::before { display: none; }
}
@media (max-width: 359.98px) {
  .wc-wheel { width: 190px; height: 190px; }
  .wc-side-btn { width: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .wc-logo__ring, .wc-screen, .wc-cell.is-open.is-pop, .wc-cell.is-flash, .wc-wheel.is-spun .wc-letter, .wc-side-btn.is-bump, .wc-preview.is-shake { animation: none; }
  .wc-star--big { opacity: 1; animation: none; }
}
