/* ─────────────────────────────────────────────────────────────────────────────
   Hider toolbox — tabs & card system
──────────────────────────────────────────────────────────────────────────────*/

/* Card height: fill most of the toolbox row */
:root { --card-h: calc((max(200px, 18vh) - 1.5rem) * 0.98); }

#toolbox.toolbox-hider {
    overflow: visible;
    position: relative;
}

/* ── Tabs ───────────────────────────────────────────────────────────────────*/
.toolbox-tabs {
    position: absolute;
    top: 0;
    left: 1rem;
    transform: translateY(-100%);
    display: flex;
    z-index: 500;
}

.toolbox-tab {
    padding: 0.25rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1.4;
}

.toolbox-tab.active {
    background: var(--bg-surface);
    color: var(--accent-teal);
    border-color: var(--accent-teal);
}

.toolbox-tab:not(.active):hover {
    background: var(--bg-surface-3);
    color: var(--text-secondary);
}

/* ── Card layout ────────────────────────────────────────────────────────────*/
.toolbox-cards {
    display: flex;
    align-items: center;
    align-self: stretch;
    overflow: hidden;
    gap: 0.6rem;
    flex: 1;
}

/* Draw / Discard piles */
.card-pile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.card-pile-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* All cards share height; width is always 2/3 of that (4:6 ratio) */
.card-back,
.card-slot {
    height: var(--card-h);
    width: auto;
    aspect-ratio: 2 / 3;
    border-radius: 5px;
}

.card-back {
    background: var(--bg-surface-2) url("../images/druvout.png") center / contain no-repeat;
    border: 2px solid var(--accent-purple);
    cursor: pointer;
    box-shadow: 1px 2px 5px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.card-back:hover { filter: brightness(1.02); cursor: default; }

.card-recycle {
    height: var(--card-h);
    width: auto;
    aspect-ratio: 2 / 3;
    border-radius: 5px;
    background: var(--bg-surface-2);
    border: 2px dashed var(--accent-purple);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-shrink: 0;
}

.card-recycle:hover {
    background: var(--bg-surface-3);
}

.card-recycle i {
    font-size: 1.5rem;
    color: var(--accent-purple);
}

.recycle-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.deck-count {
    font-size: 0.6rem;
    color: #666;
    font-weight: 600;
}

.card-slot {
    background: rgba(26, 26, 46, 0.6);
    border: 2px dashed var(--border-light);
    flex-shrink: 0;
}

/* ── Face-up card ───────────────────────────────────────────────────────────*/
.card-face {
    position: relative;
    height: var(--card-h);
    width: auto;
    aspect-ratio: 2 / 3;
    border-radius: 5px;
    background: var(--bg-surface-2);
    border: 2px solid var(--accent-purple);
    box-shadow: 1px 2px 5px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.card-in-hand {
    background: var(--bg-surface-2);
    border: 2px solid var(--accent-purple);
}

.card-slots-grid .card-slot {
    position: relative;
}

.card-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.card-title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-purple-2);
    padding: 2px;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
}

.card-desc {
    position: absolute;
    top: 25%;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 4px 6px;
    text-align: left;
    line-height: 1.15;
    overflow: hidden;
}

/* ── Card action buttons ────────────────────────────────────────────────────*/
.card-action {
    position: absolute;
    bottom: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: 1.5px solid currentColor;
    border-radius: 5px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s;
}

.card-action:hover {
    opacity: 0.85;
}

.card-action i {
    font-size: 15px;
}

.card-action-play {
    left: calc(50% - 42px);
    color: var(--success);
}

.card-action-play:disabled {
    opacity: 0.15;
    color: #666;
    cursor: default;
}

.card-action-active {
    opacity: 0.9 !important;
    color: var(--success) !important;
    border-color: var(--success) !important;
    background: rgba(34, 197, 94, 0.08);
}

.card-action-active:hover {
    opacity: 1 !important;
    background: rgba(46, 204, 113, 0.18);
    transform: scale(1.1);
}

.card-action-discard:disabled {
    opacity: 0.15;
    cursor: default;
}

.card-action-discard {
    left: calc(50% + 10px);
    color: var(--danger);
}

.card-action-accept {
    left: calc(50% - 42px);
    color: #4a7c59;
}

.card-action-trash {
    left: calc(50% + 10px);
    color: #8b4a4a;
}

/* ── Hand slots grid ────────────────────────────────────────────────────────*/
.card-slots-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

/* ── Drawn cards overlay ────────────────────────────────────────────────────*/
.drawn-cards-overlay {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-bottom: 8px;
    pointer-events: none;
    z-index: 500;
}

.drawn-cards-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    pointer-events: auto;
}

.drawn-cards-overlay .drawn-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: auto;
}

.drawn-cards-overlay .card-face {
    cursor: default;
}

@keyframes card-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.drawn-card.shake .card-face {
    animation: card-shake 0.4s ease-in-out;
    border-color: var(--accent-purple) !important;
}

.draw-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    pointer-events: auto;
}

/* ── Hider answer overlay ───────────────────────────────────────────────────*/
.hider-answer-overlay {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 8px;
    pointer-events: none;
    z-index: 510;
}

.hider-answer-box {
    background: var(--bg-surface);
    border: 2px solid var(--accent-purple);
    border-radius: 8px;
    box-shadow: 2px 4px 14px rgba(0,0,0,0.4);
    padding: 12px 16px;
    max-width: 300px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hider-answer-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-purple);
}

.hider-answer-header i {
    margin-right: 4px;
}

.hider-answer-text {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-primary);
    text-align: center;
}

.hider-answer-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple-2);
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 100px;
}

.hider-answer-buttons {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* ── Keep info badge ────────────────────────────────────────────────────────*/
.keep-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(123, 45, 142, 0.85);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 100px;
    pointer-events: auto;
}

.keep-info strong {
    font-weight: 800;
}

.reshuffle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(123, 45, 142, 0.1);
    border: 1.5px solid #a855f7;
    border-radius: 6px;
    color: #c084fc;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.reshuffle-btn:hover {
    background: rgba(123, 45, 142, 0.22);
    color: #d8b4fe;
}

.reshuffle-btn i {
    font-size: 0.8rem;
}

/* Discard pile top card (face-up) */
.card-discard-top {
    cursor: default;
}

/* ── Played card animation (slides up from toolbox area) ───────────────────*/
.played-card-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: auto;
}

.played-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 220px;
    padding: 20px 16px 16px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    text-align: center;
    pointer-events: none;
}

/* Type-based color themes */
.played-card--instant {
    background: linear-gradient(135deg, #7b2d8e 0%, #a855c7 100%);
    border: 2px solid #c084d2;
}

.played-card--response {
    background: linear-gradient(135deg, #1e6f9f 0%, #3498db 100%);
    border: 2px solid #6eb5e6;
}

.played-card--end {
    background: linear-gradient(135deg, #2d6a4f 0%, #52b788 100%);
    border: 2px solid #95d5b2;
}

.played-card-icon {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2px;
}

.played-card-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.played-card-inner {
    background: var(--bg-surface-2);
    border-radius: 6px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
}

.played-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.played-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.played-card-type {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
}

/* Vue transition — card slides up from bottom and fades in */
.card-played-enter-active {
    transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-played-leave-active {
    transition: opacity 0.3s ease, transform 0.25s ease;
}

.card-played-enter-from {
    opacity: 0;
    transform: translateY(60px) scale(0.9);
}

.card-played-leave-to {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
}

/* ── Clue Answer Popup (shows question + answer for 5 s) ───────────────────*/
.clue-answer-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.clue-answer-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(420px, 90vw);
    padding: 24px 20px 20px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 2px solid var(--accent-teal);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
    text-align: center;
    pointer-events: none;
    gap: 12px;
}

.clue-answer-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-teal);
}

.clue-answer-question {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 8px 0;
}

.clue-answer-result {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-weight: 800;
    padding: 8px 24px;
    border-radius: 100px;
    letter-spacing: 0.04em;
}

.clue-answer-true {
    color: #28a745;
    background: rgba(40, 167, 69, 0.12);
    border: 2px solid rgba(40, 167, 69, 0.35);
}

.clue-answer-false {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.12);
    border: 2px solid rgba(220, 53, 69, 0.35);
}

/* Vue transition — fade & slight scale */
.clue-answer-enter-active {
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.clue-answer-leave-active {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.clue-answer-enter-from {
    opacity: 0;
    transform: scale(0.9);
}

.clue-answer-leave-to {
    opacity: 0;
    transform: scale(0.95);
}

/* When Mirror Mirror is active, un-flip the played card so seekers can read it */
#app.app-mirror .played-card {
    transform: scaleX(-1);
}
