/* WeWordle: turn-based 1v1 Wordle on the shared WPG shell. */
.wpg-page--wewordle { --red: #ef4444; --blu: #3b82f6; }
.wpg-app--wewordle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.wpg-app--wewordle.ww-s-game, .wpg-app--wewordle.ww-s-end { justify-content: flex-start; }
.wpg-app--wewordle [hidden] { display: none !important; }

/* ---------- cards / menus ---------- */
.ww-card {
    width: 100%; max-width: 470px; padding: 20px 20px 18px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-1);
    display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.ww-card--center { align-items: center; text-align: center; padding: 28px 20px 22px; }
.ww-card--pre { padding: 34px 20px 30px; }
.ww-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ww-title { font-weight: 900; font-size: 20px; line-height: 1.2; color: var(--ink); letter-spacing: -.2px; }
.ww-sub { font-size: 14.5px; line-height: 1.45; color: var(--ink-soft); }
.ww-center { text-align: center; }
.ww-label { margin-top: 4px; font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-soft); }
.wpg-app--wewordle .ww-in {
    width: 100% !important; height: auto !important; margin: 0 !important;
    border: 2px solid var(--tile-line) !important; border-radius: 12px !important; padding: 11px 14px !important;
    font: inherit !important; font-size: 16px !important; font-weight: 700 !important;
    background: var(--tile-bg) !important; color: var(--ink) !important; outline: none; box-shadow: none !important;
    user-select: text; -webkit-user-select: text;
}
.wpg-app--wewordle .ww-in:focus { border-color: var(--accent) !important; }
.ww-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.ww-opt .ww-label { margin: 0; }
.ww-seg { flex-wrap: wrap; justify-content: center; }
.ww-seg button { min-width: 44px; }
.ww-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.ww-card .ww-actions .ww-go { flex: 1 1 100%; padding-top: 13px; padding-bottom: 13px; font-size: 16px; }
.ww-card .ww-actions .wpg-btn--ghost.ww-go { font-size: 15px; padding-top: 11px; padding-bottom: 11px; }
.wpg-app--wewordle .wpg-btn.is-off { pointer-events: none; opacity: .8; }

.ww-link {
    border: 0 !important; background: none !important; padding: 0 !important; margin: 0;
    font: inherit; font-weight: 800; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.ww-link:hover { text-decoration-thickness: 2px; }
.ww-foot { font-size: 14px; color: var(--ink-soft); text-align: center; padding: 2px 8px 0; }
.ww-net { font-size: 13px; font-weight: 700; color: #c2410c; text-align: center; }

.ww-online i {
    width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: 0 0 auto;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); animation: ww-ping 1.8s ease-out infinite;
}
@keyframes ww-ping { 70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.ww-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ww-pills .wpg-pill svg { width: 15px; height: 15px; }
.ww-spin { display: flex; justify-content: center; padding: 4px 0 6px; }
.ww-spin .wpg-spinner { width: 42px; height: 42px; border-width: 4px; }
.ww-big-ico {
    width: 58px; height: 58px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink-soft);
}
.ww-big-ico svg { width: 30px; height: 30px; }
.ww-big-ico--accent { background: var(--accent-soft); color: var(--accent); }
.ww-linkbox {
    padding: 11px 14px; border-radius: 12px; border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--tile-line));
    background: var(--accent-soft); font-weight: 700; font-size: 14px; color: var(--ink);
    word-break: break-all; user-select: all; -webkit-user-select: all; text-align: center;
}
.ww-wait { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 0 0; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.ww-wait .wpg-spinner { width: 20px; height: 20px; border-width: 3px; }
.ww-count { font-weight: 900; font-size: 64px; line-height: 1; color: var(--accent); margin-top: 8px; }
.ww-count.is-pop { animation: ww-pop .9s var(--ease); }
@keyframes ww-pop { 0% { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }

/* ---------- game ---------- */
.ww-game { width: 100%; max-width: 470px; display: flex; flex-direction: column; align-items: stretch; }
.ww-players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.ww-pl {
    --c: var(--blu);
    display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 10px; border-radius: 14px;
    border: 2px solid transparent; background: color-mix(in srgb, var(--c) 7%, var(--surface));
    transition: border-color .2s, background .2s, box-shadow .2s, opacity .2s; opacity: .72;
}
.ww-pl--red { --c: var(--red); }
.ww-pl--blu { --c: var(--blu); }
.ww-pl:not(.is-me) { flex-direction: row-reverse; text-align: right; }
.ww-pl.is-active { opacity: 1; border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 25%, transparent); }
.ww-pl__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: 0 0 auto; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.ww-pl__txt { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.2; }
.ww-pl__name { font-weight: 800; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ww-pl__txt small { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ww-pl__txt small:empty { display: none; }
.ww-pl__sec { font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--c); flex: 0 0 auto; }
.ww-pl__sec:empty { display: none; }
.ww-pl.is-low .ww-pl__sec { color: #dc2626; animation: ww-blink .5s steps(2) infinite alternate; }
@keyframes ww-blink { to { opacity: .45; } }
.ww-vs { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 11px; color: var(--ink-soft); background: color-mix(in srgb, var(--ink) 6%, transparent); }

.ww-timer { --c: var(--blu); height: 6px; margin: 10px 2px 2px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); overflow: hidden; }
.ww-timer--red { --c: var(--red); }
.ww-timer i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--c); }

.ww-scroll { overflow-y: auto; overscroll-behavior: contain; margin: 10px 0 6px; padding: 2px 0; scrollbar-width: thin; }
.ww-board { padding: 0 18px; }
.ww-row { position: relative; }
.ww-row::before {
    content: ''; position: absolute; left: -14px; top: 18%; bottom: 18%; width: 5px; border-radius: 999px;
    background: transparent;
}
.ww-row--red::before { background: var(--red); }
.ww-row--blu::before { background: var(--blu); }
.ww-row--input.is-mine .wpg-tile-l { border-color: color-mix(in srgb, var(--accent) 35%, var(--tile-line)); }
.ww-row--input.is-mine .wpg-tile-l.is-filled { border-color: color-mix(in srgb, var(--ink) 50%, var(--tile-line)); }
.ww-row--input.is-wait .wpg-tile-l { border-style: dashed; animation: ww-wait 1.6s ease-in-out infinite; }
.ww-row--input.is-wait .wpg-tile-l:nth-child(2) { animation-delay: .12s; }
.ww-row--input.is-wait .wpg-tile-l:nth-child(3) { animation-delay: .24s; }
.ww-row--input.is-wait .wpg-tile-l:nth-child(4) { animation-delay: .36s; }
.ww-row--input.is-wait .wpg-tile-l:nth-child(5) { animation-delay: .48s; }
@keyframes ww-wait { 50% { opacity: .45; } }
.wpg-tile-l.ww-ghost { color: color-mix(in srgb, var(--ok) 70%, transparent); border-color: color-mix(in srgb, var(--ok) 55%, var(--tile-line)); border-style: dashed; }

.ww-status { margin: 4px 0 8px; font-size: 15px; }
.ww-status.is-mine { color: var(--accent); }
.ww-status.is-win { color: var(--ok); font-size: 16px; }
.ww-status.is-lose { color: #dc2626; font-size: 16px; }
.ww-tools { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.ww-tools:empty { display: none; }
.ww-endbar { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 2px; }
.ww-endbar .ww-actions { margin: 0; }
.ww-offer { font-weight: 800; font-size: 14px; color: var(--accent); text-align: center; }
.ww-pulse { animation: ww-pulse 1.4s ease-in-out infinite; }
@keyframes ww-pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent); } }
.ww-mini-spin { width: 16px !important; height: 16px !important; border-width: 2px !important; }

.wpg-app--wewordle .wpg-kb { width: 100%; margin-top: 12px; transition: opacity .2s; }
.wpg-app--wewordle .wpg-kb.is-wait { opacity: .5; }

/* ---------- end modal / stats ---------- */
.ww-end { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ww-end .wpg-modal__big { margin: 0; }
.ww-end__lbl { font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-soft); }
.ww-end .wpg-modal__answer { display: flex; gap: 5px; justify-content: center; }
.ww-end__moves { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.ww-end__slot { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; margin-top: 4px; }
.ww-end__slot .ww-actions { margin: 0; }
.ww-end__ad { width: 100%; margin-top: 16px; display: flex; justify-content: center; }
.ww-end__ad:empty { margin: 0; }
.ww-stats { display: flex; flex-direction: column; gap: 6px; }
.ww-stats .ww-label:not(:first-child) { margin-top: 14px; }

.wpg-tool.is-off { opacity: .55; }

@media (max-width: 520px) {
    .wpg-app--wewordle { padding: 10px 8px 12px; gap: 10px; }
    .ww-card { padding: 16px 14px 14px; border-radius: 16px; }
    .ww-title { font-size: 18px; }
    .ww-opt { flex-direction: column; align-items: stretch; }
    .ww-opt .ww-seg { align-self: center; }
    .ww-pl { padding: 6px 8px; gap: 6px; }
    .ww-pl__name { font-size: 13.5px; }
    .ww-vs { width: 26px; height: 26px; font-size: 10px; }
    .ww-scroll { margin: 8px 0 4px; }
}
