body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none; /* Prevent overscroll bounce */
    padding-bottom: 20px;
}

.back-button {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.container {
    position: relative;
    width: 90vw;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 20px auto;
}

.header {
    text-align: center;
    margin-bottom: 10px;
    z-index: 5;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 0;
    color: #ff4500;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
}

.header p {
    font-size: 1.2em;
    margin-top: 5px;
    opacity: 0.8;
}

.vitals {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    padding: 10px;
    z-index: 10;
    margin-bottom: 10px;
}

.vital {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8em;
    opacity: 0.8;
    cursor: help;
}

.vital-level {
    width: 100%;
    height: 5px;
    background: #444;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
    position: relative;
}

.vital-fill {
    height: 100%;
    transition: width 0.3s ease, background 0.3s ease;
}

.vital-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-size: 0.7em;
    min-width: 80px;
    text-align: center;
}

.vital:hover .vital-tooltip {
    opacity: 1;
}

/* Add vital name label under the bar */
.vital-name {
    font-size: 0.7em;
    margin-top: 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.scoreboard {
    text-align: center;
    margin-bottom: 0;
    font-size: 0.8em;
    opacity: 0.9;
}

/* Fix for X (Twitter) bar alignment */
.vital:nth-child(12) {
    margin-top: -2px; /* Shift entire bar up to match others */
}
.vital:nth-child(12) .vital-name {
    margin-top: 0; /* Align label */
    padding-top: 2px; /* Maintain visual spacing */
}

.card-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
    perspective: 1000px;
    overflow: visible;
    touch-action: none; /* Prevent all browser touch actions */
    min-height: 500px;
}

.card {
    position: absolute;
    width: 90%;
    height: 90%;
    background: #1a1a1a;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    text-align: center;
    transition: transform 0.1s ease-out, opacity 0.2s ease;
    backface-visibility: hidden;
    will-change: transform, opacity;
    user-select: none;
    overflow: visible;
    touch-action: none; /* Prevent browser handling of all touch actions */
    transform-origin: center center;
    margin: 0 auto;
    max-height: 600px;
}

.card h2 {
    font-size: 1.3em;
    margin-bottom: 15px;
    z-index: 2;
}

.card p {
    font-size: 1em;
    line-height: 1.4;
    margin-top: auto;
    margin-bottom: 20px;
    z-index: 2;
}

.card-emojis {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 1.5em;
    margin-bottom: 15px;
    z-index: 2;
}

.swipe-instruction {
    font-size: 0.9em;
    opacity: 0.7;
    margin-top: auto;
    margin-bottom: 10px;
    z-index: 2;
}

.elon-illustration {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 10px auto;
    z-index: 2;
    opacity: 1;
    pointer-events: none; /* Prevent interaction with the image */
    background-color: transparent;
    overflow: visible;
}

.elon-face {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none; /* Prevent interaction with the image */
    background-color: transparent;
    max-width: 100%;
    max-height: 100%;
}

.overlay {
    position: absolute;
    top: 40%;
    width: 80%;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1000;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    margin: 0 auto;
    left: 10%;
    right: 10%;
    display: none;
    visibility: hidden;
}

#left-overlay {
    transform: translateX(-50px);
    color: #e74c3c;
}

#right-overlay {
    transform: translateX(50px);
    color: #2ecc71;
}

.show-overlay {
    opacity: 1 !important;
    transform: translateX(0) !important;
    display: block !important;
    visibility: visible !important;
    z-index: 1000 !important;
}

.swiped-left {
    transform: translateX(-150%) rotate(-30deg) !important;
    opacity: 0 !important;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease !important;
}

.swiped-right {
    transform: translateX(150%) rotate(30deg) !important;
    opacity: 0 !important;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease !important;
}

.next-card-enter {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
}

.next-card-enter-active {
    transform: scale(1) translateY(0);
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.game-over.show {
    opacity: 1;
    pointer-events: all;
}

.game-over h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #e74c3c;
}

.game-over p {
    font-size: 1.2em;
    margin-bottom: 30px;
    text-align: center;
    max-width: 80%;
}

.control-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.control-button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.control-button:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.restart-button {
    background: #2ecc71;
    color: #000;
}

.restart-button:hover {
    background: #27ae60;
}

.quit-button {
    background: #e74c3c;
    color: #000;
}

.quit-button:hover {
    background: #c0392b;
}

.share-button {
    background: #3498db;
    color: #000;
}

.share-button:hover {
    background: #2980b9;
}

.top-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 0.8em;
    margin-bottom: 5px;
}

.language-toggle {
    cursor: pointer;
}

.language-toggle span {
    margin: 0 2px;
    cursor: pointer;
}

.language-toggle span:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
