/* ==========================================================================
   Thanatos Dendra (Round 25): 3 trees at the bottom of the Kephalay Orchard.
   Black text with a gold glow, in its own gold-edged plot of soil.
   ========================================================================== */
.td-section {
    --td-gold: #ffd700;
    --td-glow: 0 0 3px #ffe680, 0 0 8px rgba(255, 215, 0, 0.95), 0 0 16px rgba(255, 170, 0, 0.7);
    position: relative;
    margin: 18px 0 4px;
    padding: 18px 14px 14px;
    border-radius: 16px;
    border: 2px solid rgba(255, 215, 0, 0.75);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0) 62%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0) 70%),
        rgba(28, 18, 6, 0.42);
    box-shadow: 0 0 14px rgba(255, 200, 40, 0.45), inset 0 0 24px rgba(255, 190, 40, 0.18);
    color: #000;
    text-align: center;
}
.td-head { margin-bottom: 6px; }
.td-title {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #000;
    text-shadow: var(--td-glow);
}
.td-greek {
    margin-top: 2px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #000;
    text-shadow: var(--td-glow);
}
#thanatos-dendra .td-intro {   /* (id: beats .kephalay-orchard-section p) */
    max-width: 560px;
    margin: 8px auto 4px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    color: #000;
    text-shadow: 0 0 3px #ffe680, 0 0 7px rgba(255, 215, 0, 0.9);
}
.td-trees {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 720px;
    margin: 0 auto;
}
.td-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 6px 4px 8px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #000;
    font: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}
.td-tree:hover, .td-tree:focus-visible {
    transform: translateY(-3px);
    background: rgba(255, 215, 0, 0.14);
    outline: none;
}
.td-img-wrap { display: block; width: 100%; max-width: 190px; aspect-ratio: 1; }
.td-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    transform-origin: 50% 95%;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.td-dead .td-img { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55)) saturate(0.85); }
.td-autumn .td-img {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 8px rgba(80, 200, 255, 0.55));
    animation: tdSway 4.5s ease-in-out infinite;
}
.td-fruit .td-img {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.95)) drop-shadow(0 0 20px rgba(255, 170, 0, 0.6));
    animation: tdSway 3.6s ease-in-out infinite;
}
/* Claimed today: claimed.png, no gold glow (same as a claimed orchard tree) */
.td-fruit.td-claimed .td-img { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); }
.td-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
    color: #000;
    text-shadow: var(--td-glow);
}
.td-score {
    font-size: 0.78rem;
    font-weight: 700;
    color: #000;
    text-shadow: 0 0 3px #ffe680, 0 0 6px rgba(255, 215, 0, 0.9);
}
/* average on one line, today's score under it */
.td-score > span { display: block; }
.td-score > .td-sep { display: none; }
.td-tally {
    margin-top: 6px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #000;
    text-shadow: var(--td-glow);
}
.td-all-revived {
    border-color: var(--td-gold);
    animation: tdHalo 2.6s ease-in-out infinite;
}

/* a tree that just came back to life */
.td-revive .td-img-wrap { position: relative; }
.td-revive .td-img-wrap::after {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 240, 160, 0.95), rgba(255, 200, 0, 0.55) 40%, rgba(255, 200, 0, 0) 70%);
    animation: tdBurst 1.4s ease-out forwards;
    pointer-events: none;
}
.td-revive .td-img { animation: tdRise 1.2s cubic-bezier(.2, 1.4, .4, 1); }

@keyframes tdSway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(1.4deg); } }
@keyframes tdBurst { 0% { transform: scale(0.2); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes tdRise { 0% { transform: scale(0.75, 0.6); } 60% { transform: scale(1.08, 1.1); } 100% { transform: none; } }
@keyframes tdHalo {
    0%, 100% { box-shadow: 0 0 14px rgba(255, 200, 40, 0.5), inset 0 0 24px rgba(255, 190, 40, 0.2); }
    50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.9), inset 0 0 30px rgba(255, 215, 0, 0.35); }
}

/* ---- tree popup: gold parchment, black text ---- */
.td-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.72);
    animation: fadeIn 0.2s ease;
}
.td-modal-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);   /* the visible screen on phones, not behind the browser bars */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 18px 20px 20px;
    border-radius: 18px;
    border: 3px solid #ffd700;
    background: linear-gradient(160deg, #fff3b8 0%, #f2cf5c 55%, #d9a92c 100%);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.75), 0 12px 30px rgba(0, 0, 0, 0.5);
    color: #000;
    text-align: center;
}
.td-modal-close {
    position: absolute;
    top: 6px;
    right: 10px;
    border: none;
    background: none;
    font-size: 1.9rem;
    line-height: 1;
    color: #000;
    cursor: pointer;
}
.td-modal-img { width: min(150px, 22vh); height: min(150px, 22vh); object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35)); }
.td-modal-kicker { font-size: 0.8rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.td-modal-title { margin: 2px 0 10px; font-size: 1.25rem; color: #000; }
.td-modal-scores { display: flex; justify-content: center; gap: 12px; margin-bottom: 10px; }
.td-modal-scores div {
    display: flex;
    flex-direction: column;
    min-width: 110px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.25);
}
.td-modal-scores span { font-size: 0.75rem; font-weight: 700; }
.td-modal-scores b { font-size: 1.4rem; }
.td-modal-msg { margin: 0 0 14px; font-weight: 600; line-height: 1.4; }
.td-modal-go {
    padding: 11px 22px;
    border: 2px solid #000;
    border-radius: 999px;
    background: #000;
    color: #ffd700;
    font: inherit;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}
.td-modal-go:hover:not([disabled]) { transform: translateY(-2px); }
.td-modal-go[disabled] { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

/* Phones: the orchard is narrow, so each tree gets its own row (tree, then its words) */
@media (max-width: 600px) {
    .td-section { margin: 14px -12px 2px; padding: 12px 8px 10px; }
    .td-title { font-size: 1.2rem; letter-spacing: 0.5px; }
    .td-greek { font-size: 0.78rem; }
    #thanatos-dendra .td-intro { font-size: 0.78rem; margin-bottom: 6px; }
    .td-trees { grid-template-columns: 1fr; gap: 2px; }
    .td-tree {
        display: grid;
        grid-template-columns: 84px minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: 8px;
        row-gap: 2px;
        align-items: center;
        padding: 4px 6px;
        text-align: left;
    }
    .td-img-wrap { grid-row: 1 / span 2; width: 84px; }
    .td-name { align-self: end; font-size: 0.85rem; }
    .td-score { align-self: start; font-size: 0.74rem; }
    .td-tally { font-size: 0.82rem; }
}
@media (prefers-reduced-motion: reduce) {
    .td-img, .td-revive .td-img, .td-all-revived { animation: none !important; }
    .td-revive .td-img-wrap::after { display: none; }
}

/* ---- Prestige rule + coins (Round 25) ---- */
#thanatos-dendra .td-rule {
    margin: 2px auto 6px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #000;
    text-shadow: var(--td-glow);
}
.td-tree { position: relative; }
/* A fruit tree that hasn't paid out yet glows; once claimed it shows claimed.png */
.td-ready .td-img { animation: tdSway 3.6s ease-in-out infinite, tdReady 1.6s ease-in-out infinite; }
@keyframes tdReady {
    0%, 100% { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 18px rgba(255, 170, 0, 0.5)); }
    50% { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 16px rgba(255, 230, 80, 1)) drop-shadow(0 0 30px rgba(255, 190, 0, 0.85)); }
}
@media (max-width: 600px) {
    #thanatos-dendra .td-rule { font-size: 0.76rem; }
}
@media (prefers-reduced-motion: reduce) {
    .td-ready .td-img { animation: none !important; }
}
