@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Source+Sans+Pro:wght@300;400&display=swap');

:root {
    --bg-color: #0d0d0d;
    --card-bg: #1e1e1e;
    --gold: #c5a059;
    --gold-bright: #e5c17d;
    --text-color: #e0d5c1;
    --accent: #4a0404;
    /* Deep Burgundy */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Source Sans Pro', sans-serif;
    height: 100vh;
    height: 100dvh;
    /* Dynamic Viewport Height for mobile browsers */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a1510 0%, #0d0d0d 100%);
}

header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    position: relative;
}

.footer-corner-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: transparent;
    color: var(--gold);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
}

.footer-corner-btn:hover {
    background: var(--gold);
    color: var(--bg-color);
}

.donate-btn {
    left: 1.5rem;
    font-size: 1rem;
}

.info-btn {
    right: 1.5rem;
    font-size: 1.2rem;
    font-family: 'Source Sans Pro', sans-serif;
    font-style: normal;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--gold);
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.venue-tag {
    font-size: 0.9rem;
    color: var(--gold-bright);
    opacity: 0.7;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.venue-tag.interactive {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(197, 160, 89, 0.3);
}

.venue-tag.interactive:hover {
    opacity: 1;
    text-shadow: 0 0 10px rgba(229, 193, 125, 0.5);
    text-decoration-color: var(--gold-bright);
}

main {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    margin-bottom: 100px;
    padding: 0 10px;
    gap: 15px;
    padding-bottom: 80px;
    /* Shift card up visuals */
}

/* Ensure content doesn't get hidden behind fixed footer on small screens */
@media (max-height: 700px) {
    main {
        padding-bottom: 120px;
        /* More space for sticky footers */
    }

    .menu-selector {
        bottom: 80px;
        /* Push menu up slightly */
    }
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--gold);
    font-size: 3rem;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.3s;
    user-select: none;
    z-index: 10;
}

.nav-btn:hover {
    opacity: 1;
    text-shadow: 0 0 10px var(--gold);
}

@media (max-width: 400px) {
    .nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .prev-btn {
        left: 5px;
    }

    .next-btn {
        right: 5px;
    }

    main {
        padding: 0;
    }
}

.card-container {
    width: 85%;
    max-width: 350px;
    height: 70%;
    max-height: 500px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.card-container.is-flipped {
    transform: rotateY(180deg);
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(197, 160, 89, 0.3);
    border: 4px solid var(--gold);
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.flip-icon {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 0.8rem;
    opacity: 0.4;
    color: var(--gold);
    transition: opacity 0.3s;
    pointer-events: none;
}

.card:hover .flip-icon {
    opacity: 1;
}

.card-front {
    z-index: 2;
    transform: rotateY(0deg);
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    /* Ensure opaque background for back face */
}

.card-category {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: var(--gold);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.question-recap {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 0.9rem;
    line-height: 1.2;
    margin-bottom: 2.5rem;
    opacity: 0.7;
    font-style: italic;
    max-height: 3.6em;
    /* Show approx 3 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    width: 100%;
}

.card-prompt {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    line-height: 1.4;
    color: var(--text-color);
}

.back-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 0.7rem;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--gold);
    color: var(--bg-color);
}

.back-content {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
}

footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
    background: #000;
    /* border-top: 2px solid var(--gold); */
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.8);
}

.menu-selector {
    position: fixed;
    bottom: 85px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 110;
}

.action-btn {
    background: none;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

/* Only apply hover effects on devices that support hovering */
@media (hover: hover) {
    .action-btn:hover {
        background: rgba(197, 160, 89, 0.2);
        box-shadow: 0 0 10px rgba(197, 160, 89, 0.2);
    }
}

.action-btn:active {
    transform: scale(0.95);
    background: var(--gold);
    color: var(--bg-color);
}

.action-btn.active {
    background: var(--gold);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(197, 160, 89, 0.4);
}

.cheers-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* Animations */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

@keyframes slideOutLeft {
    to {
        transform: translateX(-150%) rotate(-10deg);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(150%) rotate(10deg);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-150%) rotate(-10deg);
        opacity: 0;
    }

    to {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(150%) rotate(10deg);
        opacity: 0;
    }

    to {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}

.slide-out-left {
    animation: slideOutLeft 0.4s forwards;
}

.slide-out-right {
    animation: slideOutRight 0.4s forwards;
}

.slide-in-left {
    animation: slideInLeft 0.4s forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s forwards;
}

.cheered {
    animation: shake 0.5s;
}

/* Vote Animations */
.card-glow-gold {
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.6), inset 0 0 20px rgba(197, 160, 89, 0.3) !important;
    border-color: #ffd700 !important;
    transition: all 0.5s ease;
}

.card-glow-holo {
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5), inset 0 0 30px rgba(255, 0, 255, 0.3) !important;
    border: 4px solid transparent !important;
    background-image: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%),
        linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    animation: holoPulse 2s infinite;
}

@keyframes holoPulse {
    0% {
        filter: hue-rotate(0deg);
    }

    50% {
        filter: hue-rotate(180deg);
    }

    100% {
        filter: hue-rotate(360deg);
    }
}

.particle {
    position: fixed;
    pointer-events: none;
    animation: floatUp 1.5s ease-out forwards;
    z-index: 1000;
    font-size: 1.5rem;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-150px) scale(1.5);
        opacity: 0;
    }
}

/* Info Overlay */
.info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.info-overlay.active {
    display: flex;
    opacity: 1;
}

.info-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    max-width: 400px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 1);
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 2rem;
    cursor: pointer;
}

.info-content h2 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    text-align: center;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section h3 {
    color: var(--gold-bright);
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.info-section p {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.9;
}

.info-section.about {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(197, 160, 89, 0.2);
    font-style: italic;
    text-align: center;
}

.venue-login-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-bottom: 10px;
}

.venue-login-btn:hover {
    background: var(--gold);
    color: var(--bg-color);
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.3);
}

/* Private Table Section */
.private-table-section {
    border-top: 1px solid rgba(197, 160, 89, 0.2);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    text-align: center;
}

.table-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.join-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: stretch;
}

.table-code-input {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0.8rem;
    border-radius: 4px;
    width: 100px;
    text-align: center;
    text-transform: uppercase;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 2px;
}

.table-code-input::placeholder {
    color: rgba(197, 160, 89, 0.5);
    letter-spacing: normal;
}

.join-btn {
    margin-bottom: 0;
    flex: 1;
}

.current-table-display {
    display: none;
    margin-top: 15px;
    background: rgba(197, 160, 89, 0.1);
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed var(--gold);
}

.table-code-display {
    color: var(--gold);
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 3px;
    display: block;
    margin: 5px 0;
}

.leave-table-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 10px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.leave-table-btn:hover {
    opacity: 1;
}

/* Admin Controls */
.admin-controls {
    position: absolute;
    top: 15px;
    left: 15px;
}

.admin-icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.admin-icon-btn:hover {
    opacity: 1;
}

.admin-login-form {
    background: rgba(197, 160, 89, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px dashed var(--gold);
}

.admin-input {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.admin-textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--gold);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
    width: 100%;
    min-height: 80px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-top: 0.5rem;
}

.editable-text.editing {
    display: none;
}

/* Truth/Dare Choices */
.td-choices {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    margin-top: 1rem;
    z-index: 10;
}

.td-choices.active {
    display: flex;
}

.td-btn {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
    padding: 0.8rem 0;
    font-size: 1.1rem;
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    border-radius: 8px;
    letter-spacing: 2px;
}

.td-btn:hover {
    background: var(--gold);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(197, 160, 89, 0.4);
}

.td-divider {
    font-size: 0.8rem;
    color: var(--gold-bright);
    opacity: 0.6;
    letter-spacing: 2px;
}

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1rem;
        margin: 0;
    }

    .venue-tag {
        margin-top: 0;
        display: inline-block;
        margin-left: 10px;
    }

    main {
        margin-bottom: 60px;
        padding-bottom: 10px;
    }

    .menu-selector {
        bottom: 55px;
        padding: 2px;
    }

    .card-container {
        height: 70%;
        width: 60%;
        max-width: 500px;
        max-height: none;
    }

    .card {
        padding: 1rem 2rem;
    }

    .card-prompt {
        font-size: 1.2rem;
    }

    .card-category {
        margin-bottom: 0.5rem;
        font-size: 0.7rem;
    }

    footer {
        padding: 0.5rem;
    }

    .cheers-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .footer-corner-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .donate-btn {
        left: 1rem;
    }

    .info-btn {
        right: 1rem;
    }
}

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 1rem;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    display: none;
    /* Hidden by default */
    animation: slideUp 0.5s ease-out;
}

.install-prompt.active {
    display: block;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.install-content {
    position: relative;
    text-align: center;
    color: var(--text-color);
}

.close-install-btn {
    position: absolute;
    top: -5px;
    right: 0;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.ios-instructions {
    margin-top: 10px;
    background: rgba(197, 160, 89, 0.1);
    padding: 10px;
    border-radius: 8px;
    text-align: left;
}

.ios-instructions p {
    font-size: 0.85rem;
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.share-icon-wrapper svg {
    width: 18px;
    height: 18px;
    color: #007AFF;
}

.add-home-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.add-home-icon-wrapper svg {
    width: 22px;
    height: 22px;
    stroke: #000;
}