/* =====================================================================
   PvZH Vault: Deck Duel 2
   Flat surfaces, one accent per side: cyan = you, coral = opponent.
   ===================================================================== */

#gamesView {
    --dd-bg: #12181b;
    --dd-surface: #1b2126;
    --dd-raised: #232a30;
    --dd-line: rgba(255, 255, 255, 0.08);
    --dd-text: #f3f6f8;
    --dd-muted: #9aa5ad;
    --dd-me: #19c3e6;
    --dd-opp: #ff7a5c;
    --dd-tie: #6f7a82;
    --dd-gold: #ffd34e;
    color: var(--dd-text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

#gamesView [hidden] { display: none !important; }

.dd {
    max-width: 560px;
    margin: 0 auto;
    padding: 12px 2px 40px;
}

.dd h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.dd h3 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 800;
}

.dd p { margin: 0; }
.dd-muted { color: var(--dd-muted); font-size: 13px; line-height: 1.45; }

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


/* ---------------- Buttons (reset site-wide button styles) ---------------- */

#gamesView button {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#gamesView button:focus-visible,
#gamesView summary:focus-visible,
#gamesView input:focus-visible {
    outline: 2px solid var(--dd-me);
    outline-offset: 2px;
}

#gamesView .dd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 12px;
    background: var(--dd-me);
    color: #061318;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    transition: transform 0.12s, opacity 0.15s;
}

#gamesView .dd-btn:active { transform: scale(0.97); }
#gamesView .dd-btn:disabled {
    background: var(--dd-raised);
    color: var(--dd-muted);
    cursor: default;
    transform: none;
}

#gamesView .dd-btn-ghost {
    background: var(--dd-raised);
    color: var(--dd-text);
}

#gamesView .dd-btn-small {
    min-height: 38px;
    padding: 0 16px;
    font-size: 14px;
}

#gamesView .dd-btn-wide { width: 100%; margin-top: 14px; }

#gamesView .dd-link {
    color: var(--dd-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 4px;
}

#gamesView .dd-icon-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: var(--dd-muted);
}

#gamesView .dd-icon-btn:active { background: var(--dd-raised); }

#gamesView .dd-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 40px;
    margin: 0 0 12px -6px;
    padding: 0 10px 0 4px;
    color: #8ee4f5;
    font-size: 15px;
    font-weight: 700;
}

.dd-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

#gamesView .dd-row .dd-btn { flex: 1; }

.dd-notice {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 122, 92, 0.12);
    color: #ffb4a3;
    font-size: 13px;
    font-weight: 600;
}


/* ---------------- Inputs ---------------- */

.dd-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.dd-field {
    display: flex;
    flex: 1 1 200px;
    flex-direction: column;
    gap: 5px;
}

.dd-field span {
    color: var(--dd-muted);
    font-size: 12px;
    font-weight: 600;
}

#gamesView .dd-field input {
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: var(--dd-raised);
    color: var(--dd-text);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    outline: none;
}

#gamesView .dd-field input:focus {
    border-color: rgba(25, 195, 230, 0.7);
}


/* ---------------- Home ---------------- */

.dd-hero { padding: 6px 0 18px; text-align: center; }

.dd-hero h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dd-hero-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
}

.dd-hero-icon svg {
    width: 100%;
    height: 100%;
}

/* Only the fallback icon needs stroke styling; a copied icon keeps its own. */
.dd-hero-icon .dd-ico {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.dd-hero p {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 8px;
    color: var(--dd-muted);
    font-size: 15px;
    line-height: 1.45;
}

.dd-daily {
    margin-bottom: 26px;
    padding: 16px;
    border: 1px solid rgba(255, 211, 78, 0.28);
    border-radius: 18px;
    background: var(--dd-surface);
}

.dd-daily-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.dd-daily-num {
    color: var(--dd-gold);
    font-size: 13px;
    font-weight: 800;
}

.dd-daily-main {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
}

.dd-daily-main strong { display: block; font-size: 18px; font-weight: 800; }
.dd-daily-main span { display: block; margin-top: 3px; color: var(--dd-muted); font-size: 13px; line-height: 1.4; }

.dd-daily-result { margin-top: 14px !important; font-size: 15px; }
.dd-daily-result strong { font-size: 17px; }
#ddDailyRank { margin-top: 4px; }

.dd-avatar {
    width: 48px;
    height: 48px;
    flex: none;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    background: var(--dd-raised);
}

.dd-avatar-lg { width: 60px; height: 60px; }

.dd-section { margin-bottom: 26px; }

.dd-bots {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--dd-line);
}

.dd-bot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--dd-line);
}

.dd-bot-copy { flex: 1; min-width: 0; }
.dd-bot-copy strong { display: block; font-size: 15px; font-weight: 800; }
.dd-bot-copy em { margin-left: 4px; color: var(--dd-muted); font-size: 12px; font-style: normal; font-weight: 600; }
.dd-bot-copy span { display: block; margin-top: 2px; color: var(--dd-muted); font-size: 13px; }

.dd-bot-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dd-bot-side small { color: var(--dd-muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

.dd-rooms { margin-top: 16px; }
.dd-rooms-title { margin-bottom: 6px !important; color: var(--dd-me); font-size: 13px; font-weight: 700; }

.dd-room {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--dd-line);
    font-size: 14px;
    font-weight: 600;
}

.dd-challenge {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(25, 195, 230, 0.1);
    border: 1px solid rgba(25, 195, 230, 0.35);
}

.dd-challenge strong { display: block; font-size: 16px; font-weight: 800; }
.dd-challenge span { display: block; margin-top: 3px; color: #bfe9f3; font-size: 13px; line-height: 1.4; }
.dd-challenge-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
#gamesView .dd-challenge-actions .dd-btn { flex: 1; }

.dd-how {
    border-top: 1px solid var(--dd-line);
    padding-top: 12px;
}

#gamesView .dd-how summary,
#gamesView 
.dd-how ul { margin: 12px 0; padding: 0; list-style: none; }
.dd-how li { display: flex; gap: 10px; padding: 8px 0; }
.dd-how li strong { display: block; font-size: 14px; }
.dd-how li span { display: block; color: var(--dd-muted); font-size: 13px; line-height: 1.4; }
.dd-how .dd-ico { margin-top: 1px; color: var(--dd-muted); }


/* ---------------- Match: build a deck, card by card ---------------- */

/* Mobile focus mode: hide the site header during a match. */
@media (max-width: 768px) {
    body.pvz-duel-focus > header { display: none !important; }
    body.pvz-duel-focus main { padding-top: 0 !important; }
}

.dd-match { padding-top: env(safe-area-inset-top, 0px); }

.dd-top {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    margin-bottom: 6px;
}

.dd-top-title { text-align: center; font-size: 16px; font-weight: 800; }

.dd-board { display: flex; flex-direction: column; gap: 12px; }

/* --- Deck card: same look as the deck feed --- */

.dd-dc {
    position: relative;
    padding: 12px 12px 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    background: #1b2126;
}

.dd-dc::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 96px;
    pointer-events: none;
    background: radial-gradient(110% 100% at 0% 0%, var(--dc-tint), transparent 70%);
}

.dd-dc--plant { --dc-tint: rgba(94, 224, 126, 0.16); }
.dd-dc--zombie { --dc-tint: rgba(192, 132, 252, 0.18); }

.dd-dc.is-me { border-color: rgba(25, 195, 230, 0.35); }

.dd-dc-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}


.dd-dc-avatars {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    width: 52px;
    height: 52px;
}
.dd-dc-avatars.two { width: 64px; }

.dd-dc-avatars img {
    width: 52px;
    height: 52px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    background: #12171b;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.dd-dc-avatars.two img { width: 42px; height: 42px; }
.dd-dc-avatars.two img + img { margin-left: -20px; }

.dd-dc-unknown {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 26px;
    font-weight: 800;
}

.dd-dc-title { flex: 1; min-width: 0; }

.dd-dc-title strong {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dd-dc-meta {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.dd-dc-hero { color: #e3e8ec; font-weight: 600; }
.dd-dc-by { margin-left: 6px; color: #9aa5ad; }

.dd-dc-grade {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--g);
    font-size: 19px;
    font-weight: 900;
    transition: color 0.3s;
}
.dd-dc-grade.is-bump { animation: ddBump 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes ddBump { 40% { transform: scale(1.3); } }

.dd-dc-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
    aspect-ratio: 5 / 2.12;
}

.dd-dc-cell { position: relative; min-width: 0; min-height: 0; }

.dd-dc-cell.is-empty {
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.18);
    font-size: clamp(18px, 5vw, 26px);
    font-weight: 900;
    line-height: 1;
}

.dd-dc-cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.dd-dc-cell b {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 15px;
}

.dd-dc-cell.is-new img { animation: ddLand 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes ddLand { from { transform: scale(0.35); opacity: 0.3; } }

/* Bot speech bubble: hangs from the opponent's portrait. */
.dd-bubble {
    position: absolute;
    top: 70px;
    left: 12px;
    z-index: 3;
    max-width: min(78%, 320px);
    padding: 9px 13px;
    border-radius: 14px;
    background: #f3f6f8;
    color: #12181b;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.dd-bubble::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 20px;
    border: 8px solid transparent;
    border-top: 0;
    border-bottom-color: #f3f6f8;
}

.dd-bubble.is-new { animation: ddBubbleIn 0.35s cubic-bezier(0.2, 1.5, 0.4, 1); }
.dd-bubble.is-out { opacity: 0; transform: translateY(-4px); }

@keyframes ddBubbleIn { from { opacity: 0; transform: translateY(6px) scale(0.9); } }

/* --- The pick --- */

.dd-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    margin-top: 4px;
}

.dd-turn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    font-weight: 800;
}
.dd-turn.is-me { color: var(--dd-me); }
.dd-turn.is-opp { color: #c9d1d6; font-size: 16px; }

.dd-turn-pic {
    width: 30px;
    height: 30px;
    border: 2px solid var(--dd-opp);
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
}

.dd-dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.dd-dots b {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: ddBlink 1.2s ease-in-out infinite;
}
.dd-dots b:nth-child(2) { animation-delay: 0.2s; }
.dd-dots b:nth-child(3) { animation-delay: 0.4s; }

@keyframes ddBlink { 50% { opacity: 0.2; } }

.dd-status-action { min-width: 0; }
.dd-hint { color: var(--dd-muted); font-size: 13px; font-weight: 600; }

#gamesView .dd-status .dd-confirm {
    display: block;
    max-width: 62vw;
    min-height: 42px;
    padding: 0 16px;
    overflow: hidden;
    font-size: 14px;
    line-height: 42px;
    white-space: nowrap;
    text-overflow: ellipsis;
    animation: ddPop 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes ddPop { from { transform: scale(0.85); opacity: 0; } }

.dd-offer { display: flex; flex-direction: column; gap: 12px; }

.dd-group-label {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    color: var(--dd-muted);
    font-size: 12px;
    font-weight: 700;
}
.dd-group-label i {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--c);
}

.dd-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

/* Offered cards look like deck cells: just the art. */
#gamesView .dd-card {
    position: relative;
    display: block;
    aspect-ratio: 1;
    min-width: 0;
    transition: transform 0.2s cubic-bezier(0.2, 1.4, 0.4, 1);
}

#gamesView .dd-card > img:first-child {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
    transition: opacity 0.2s, filter 0.2s;
}

#gamesView .dd-card.is-selected {
    z-index: 1;
    transform: translateY(-6px) scale(1.1);
}
#gamesView .dd-card.is-selected > img:first-child {
    filter: drop-shadow(0 0 5px rgba(25, 195, 230, 0.95)) drop-shadow(0 0 14px rgba(25, 195, 230, 0.55));
}

#gamesView .dd-card.is-opp-choosing { transform: scale(1.1); }
#gamesView .dd-card.is-opp-choosing > img:first-child {
    filter: drop-shadow(0 0 5px rgba(255, 122, 92, 0.95)) drop-shadow(0 0 14px rgba(255, 122, 92, 0.55));
}

.is-opp-turn .dd-card:not(.is-taken) > img:first-child { opacity: 0.85; }

.dd-card.is-taken > img:first-child { opacity: 0.18; filter: grayscale(1); }
.dd-card.is-illegal > img:first-child { opacity: 0.3; filter: grayscale(0.6); }

.dd-offer.is-dealing .dd-card {
    animation: ddDeal 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both;
    animation-delay: calc(var(--i) * 35ms);
}
@keyframes ddDeal { from { opacity: 0; transform: translateY(16px) scale(0.8); } }

.dd-fly {
    position: fixed;
    z-index: 9999;
    object-fit: contain;
    pointer-events: none;
}

/* Your deck stays in view on short phones. */
@media (max-width: 979px) {
    .dd-board > .dd-dc.is-me {
        position: sticky;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        z-index: 5;
        box-shadow: 0 -10px 28px rgba(18, 24, 27, 0.9);
    }
}

/* --- Hero reveal toast --- */

.dd-toast {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 32px);
    padding: 8px 16px 8px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: #1f262b;
    color: #f3f6f8;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    transform: translateX(-50%);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    animation: ddToastIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
    transition: opacity 0.35s, transform 0.35s;
}
.dd-toast img {
    width: 40px;
    height: 40px;
    flex: none;
    border: 2px solid #19c3e6;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
}
.dd-toast.is-opp img { border-color: #ff7a5c; }
.dd-toast.is-me strong { color: #19c3e6; }
.dd-toast.is-opp strong { color: #ff7a5c; }
.dd-toast.is-out { opacity: 0; transform: translate(-50%, -10px); }
@keyframes ddToastIn { from { opacity: 0; transform: translate(-50%, -16px) scale(0.92); } }

/* --- Desktop: the pick on the left, both decks on the right --- */

@media (min-width: 980px) {
    .dd-match { max-width: 1100px; padding-top: 18px; }

    .dd-board {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 420px;
        grid-template-areas:
            "play me"
            "play opp";
        grid-template-rows: auto 1fr;
        gap: 14px 32px;
        align-items: start;
    }

    .dd-play { grid-area: play; }
    .dd-board > .dd-dc.is-me { grid-area: me; }
    .dd-board > .dd-dc.is-opp { grid-area: opp; }

    .dd-cards { gap: 12px; }
    #gamesView .dd-status .dd-confirm { max-width: 340px; }
}


/* ---------------- Result ---------------- */

.dd-result-top { padding: 8px 0 18px; text-align: center; }
.dd-result-top h2 { margin: 4px 0 6px; font-size: 32px; }
.dd-result.is-win .dd-result-top h2 { color: var(--dd-me); }
.dd-result.is-loss .dd-result-top h2 { color: var(--dd-opp); }

/* The bot's parting line on the results screen. */
.dd-quote {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px !important;
    padding: 8px 14px 8px 8px;
    border-radius: 14px;
    background: var(--dd-surface);
    color: #e3e8ec;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}

.dd-quote-pic {
    width: 32px;
    height: 32px;
    flex: none;
    border: 2px solid var(--dd-opp);
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
}

/* Category showdown: a plain scoreboard, winner highlighted per row. */
.dd-showdown { margin-top: 4px; }

.dd-sd-head,
.dd-sd-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px 72px;
    align-items: center;
    gap: 8px;
}

.dd-sd-head { padding-bottom: 8px; font-size: 13px; font-weight: 800; }
.dd-sd-head span { text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dd-sd-head .is-me { color: var(--dd-me); }
.dd-sd-head .is-opp { color: var(--dd-opp); }

.dd-sd-row {
    padding: 10px 0;
    border-top: 1px solid var(--dd-line);
    animation: ddReveal 0.4s ease both;
    animation-delay: calc(var(--d) * 380ms + 150ms);
}

@keyframes ddReveal { from { opacity: 0; transform: translateY(6px); } }

.dd-sd-cat { display: flex; align-items: center; gap: 10px; color: var(--dd-muted); }
.dd-sd-cat .dd-ico { width: 22px; height: 22px; }
.dd-sd-cat strong { color: var(--dd-text); font-size: 16px; }

.dd-sd-val {
    display: grid;
    place-items: center;
    height: 36px;
    border-radius: 10px;
    color: var(--dd-muted);
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.dd-sd-row.is-me .dd-sd-val.is-me {
    background: rgba(25, 195, 230, 0.16);
    color: var(--dd-me);
    font-size: 18px;
    font-weight: 900;
}

.dd-sd-row.is-opp .dd-sd-val.is-opp {
    background: rgba(255, 122, 92, 0.16);
    color: var(--dd-opp);
    font-size: 18px;
    font-weight: 900;
}

.dd-sd-row.is-me .dd-sd-cat { color: var(--dd-me); }
.dd-sd-row.is-opp .dd-sd-cat { color: var(--dd-opp); }

.dd-final-decks {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.dd-panel {
    margin-top: 22px;
    padding: 16px;
    border-radius: 16px;
    background: var(--dd-surface);
}

.dd-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.dd-panel-head strong { font-size: 16px; }

.dd-rank { margin-top: 10px !important; font-size: 15px; font-weight: 800; color: var(--dd-gold); }
.dd-rank:empty { display: none; }

#ddBoard { margin-top: 10px; }

.dd-lb { display: flex; flex-direction: column; }

.dd-lb-row { border-bottom: 1px solid var(--dd-line); }
.dd-lb-row summary {
    display: grid;
    grid-template-columns: 26px 1fr auto 48px;
    align-items: center;
    gap: 8px;
    padding: 9px 4px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
}
.dd-lb-row summary::-webkit-details-marker { display: none; }
.dd-lb-row.is-me summary { border-radius: 8px; background: rgba(25, 195, 230, 0.1); }
.dd-lb-rank { color: var(--dd-muted); font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.dd-lb-name { overflow: hidden; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.dd-lb-name em { color: var(--dd-me); font-style: normal; font-size: 12px; }
.dd-lb-wl { color: var(--dd-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.dd-lb-score { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.dd-lb-gap { padding: 2px 0; color: var(--dd-muted); text-align: center; }

.dd-lb-deck {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 2px;
    padding: 4px 0 10px;
}
.dd-lb-deck span { position: relative; aspect-ratio: 1; }
.dd-lb-deck img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.dd-vs-friend strong { display: block; font-size: 17px; }
.dd-vs-friend span { display: block; margin-top: 4px; color: var(--dd-muted); font-size: 13px; }

.dd-record { margin-top: 16px !important; text-align: center; }

.dd-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 22px;
}
#gamesView .dd-actions .dd-btn:first-child,
#gamesView .dd-actions .dd-btn:nth-child(2):last-child { grid-column: 1 / -1; }
#gamesView .dd-actions .dd-btn { font-size: 14px; }


/* ---------------- Live waiting / join ---------------- */

.dd-waiting h2 { margin-bottom: 8px; }

.dd-linkbox {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--dd-raised);
    overflow-x: auto;
}
.dd-linkbox code { font-size: 13px; color: #c9d1d6; white-space: nowrap; }

.dd-pulse { display: flex; gap: 6px; justify-content: center; margin-top: 28px; }
.dd-pulse i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dd-me);
    animation: ddBlink 1.2s ease-in-out infinite;
}
.dd-pulse i:nth-child(2) { animation-delay: 0.2s; }
.dd-pulse i:nth-child(3) { animation-delay: 0.4s; }

.dd-loading { padding: 60px 0; text-align: center; color: var(--dd-muted); }


/* ---------------- Guide + Daily Duel row (desktop, above Discovery) ----------------
   Both halves are .featured-decks-container blocks, so the site's own
   .featured-decks-link styles apply to both. This only lays out the row. */

#ddTopRow {
    display: none;
    box-sizing: border-box;
    align-items: stretch;
    gap: 14px;
    width: 100%;
    max-width: 1180px;
    margin: 28px auto 4px;
}

body:has(#deckGrid .pvz-discovery-home) #ddTopRow { display: flex; }

#ddTopRow > .featured-decks-container {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    margin: 0;
}

#ddTopRow > .featured-decks-container.hidden { display: none; }

#ddTopRow .featured-decks-link.is-visible { flex: 1; }

/* Daily Duel accents: gold label/hover, opponent avatar before the arrow. */
.dd-daily-link .featured-guide-label { color: #ffd34e; }
.dd-daily-link:hover { border-color: rgba(255, 211, 78, 0.45); }
.dd-daily-link:hover .featured-guide-arrow { stroke: #ffd34e; }

.dd-daily-link .dd-daily-avatar {
    flex: none;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
}

@media (max-width: 768px) {
    #ddTopRow,
    body:has(#deckGrid .pvz-discovery-home) #ddTopRow { display: none; }
}

/* Desktop: the guide never shows in the header while the vault is loading
   (#loadingIndicator loses .hidden only when app.js finishes), nor in the
   frame between Discovery rendering and the guide moving into the row. */
@media (min-width: 769px) {
    body:has(#loadingIndicator:not(.hidden)) header .featured-decks-container,
    body:has(#deckGrid .pvz-discovery-home) header .featured-decks-container {
        display: none !important;
    }
}


/* ---------------- Desktop ---------------- */

@media (min-width: 769px) {
    .dd { padding-top: 24px; }
}

@media (min-width: 720px) {
    .dd-result { max-width: 860px; }
    .dd-final-decks { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    #gamesView *,
    #gamesView *::before {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}
