/* Perfect Cut - Mobile-First Single Column Layout */

:root {
    /* Fluid typography base values */
    --min-screen: 320;
    --max-screen: 500;
    --min-font: 14;
    --max-font: 18;
    
    /* Dynamic font size calculation */
    --fluid-font: calc(var(--min-font) * 1px + (var(--max-font) - var(--min-font)) * ((100vw - var(--min-screen) * 1px) / (var(--max-screen) - var(--min-screen))));
    
    /* Layout spacing that adapts to screen size */
    --dynamic-spacing: clamp(4px, 2vw, 8px);
    --dynamic-padding: clamp(8px, 4vw, 20px);
    --dynamic-margin: clamp(10px, 3vw, 16px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Inter', 'Segoe UI', sans-serif;
    background-color: #ffffff;
    color: #000000;
    line-height: 1.4;
    height: 100vh;
    padding: var(--dynamic-padding);
    font-size: var(--fluid-font);
    
    /* Prevent zoom and scroll */
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Main App Container - Single Column, Vertical Stack */
.app-container {
    max-width: clamp(320px, 95vw, 400px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--dynamic-spacing);
    padding-bottom: var(--dynamic-padding);
    min-height: calc(100vh - var(--dynamic-padding) * 2);
}

/* Header Row - Title and Help Button */
.header-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.app-title {
    font-size: clamp(1.8rem, 5vw, 2.2rem);
    font-weight: 700;
    color: #000000;
    letter-spacing: -0.5px;
    font-family: system-ui, -apple-system, 'Inter', 'Segoe UI', sans-serif;
}

/* Header Buttons Container */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-button {
    width: 36px;
    height: 36px;
    border: 2px solid #000000;
    background-color: #6B7B82;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px #000000;
    position: relative;
    z-index: 100;
}

.share-button-header {
    width: 36px;
    height: 36px;
    border: 2px solid #000000;
    background-color: #4CAF50;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px #000000;
    color: white;
    visibility: hidden; /* Hidden by default until game is completed */
    opacity: 0;
    position: relative;
    z-index: 100;
}

.help-button:hover {
    background-color: #5A686F;
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px #000000;
}

.help-button:active {
    transform: translateY(0px);
    box-shadow: 1px 1px 0px #000000;
}

.share-button-header:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px #000000;
}

.share-button-header:active {
    transform: translateY(0px);
    box-shadow: 1px 1px 0px #000000;
}

/* Trophy button - soft yellow color matching other buttons */
.trophy-button {
    width: 36px;
    height: 36px;
    border: 2px solid #000000;
    background-color: #FFED9A; /* Bolder yellow - between original colors */
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px #000000;
    color: #000000;
    position: relative;
    z-index: 100;
}

.trophy-button:hover {
    background-color: #FFE47A;
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px #000000;
}

.trophy-button:active {
    transform: translateY(0px);
    box-shadow: 1px 1px 0px #000000;
}


/* Canvas Container */
.canvas-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 0;
}

#geoCanvas {
    width: clamp(280px, 90vw, 380px);
    height: clamp(280px, 90vw, 380px);
    max-width: calc(100vw - var(--dynamic-padding) * 2);
    max-height: calc(100vw - var(--dynamic-padding) * 2);
    border: 3px solid #000000;
    background-color: #ffffff;
    box-shadow: 4px 4px 0px #000000;
    touch-action: none;
    aspect-ratio: 1;
}

/* Commentary Overlay (positioned lower in the playing field) */
.commentary-overlay {
    position: absolute;
    bottom: 10px; /* Positioned slightly lower in the playing field */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #000000;
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    max-width: 320px;
    z-index: 10;
}

.commentary-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333333;
    line-height: 1.0;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 290px;
}

/* Canvas Button Overlay - Fixed position */
.canvas-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    transition: opacity 0.2s ease;
    opacity: 0; /* Hide by default to prevent flash */
    pointer-events: none; /* Disable interaction when hidden */
}

.canvas-button-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Canvas Buttons Group - Contains both Play and Practise buttons */
.canvas-buttons-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Canvas Play Button - Centered in canvas */
.canvas-play-button {
    border: 2px solid #000000;
    border-radius: 8px;
    padding: clamp(10px, 3vw, 12px) clamp(20px, 6vw, 24px);
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 600;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px #000000;
    font-family: inherit;
    width: clamp(100px, 25vw, 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

/* Play button - blue color to match cut render */
#playBtn {
    background-color: rgb(100, 150, 255);
}
#playBtn:hover {
    background-color: rgb(80, 130, 235);
}

/* Practise button - green color */
#practiseBtn {
    background-color: #CFE0C3;
}
#practiseBtn:hover {
    background-color: #B8D1AB;
}

.canvas-play-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000000;
}

.canvas-play-button:active {
    transform: translateY(0px);
    box-shadow: 2px 2px 0px #000000;
}

/* Canvas Play Button States - removed "again" styles to prevent vestige buttons */

.canvas-play-button.disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

.canvas-play-button.disabled:hover {
    background-color: #cccccc;
    box-shadow: 4px 4px 0px #000000;
}

/* Buttons positioned below playing field */
.buttons-below-canvas {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 16px auto;
    width: fit-content;
}

/* Practice instructions styling */
.practice-instructions {
    font-size: 14px;
    font-weight: 400;
    color: #333333;
    text-align: center;
    margin: 12px auto;
    line-height: 1.4;
    max-width: 320px;
    padding: 0 20px;
    display: none;
}

/* Practice phase specific styling */
.practice-phase-1 {
    font-size: 18px;
    font-weight: 500;
}

.practice-phase-2 {
    font-size: 18px;
    margin-top: 8px;
}

.practice-phase-final {
    font-size: 18px;
    margin-top: 12px;
}

/* Practice split display styling */
.practice-split {
    margin: 16px 0;
}

.split-display-container {
    text-align: center;
    margin: 16px auto;
}

/* Play button positioned below goal for practice mode */
.play-below-goal {
    display: none;
    margin: 20px auto;
    text-align: center;
    width: fit-content;
}

/* Compact Button Container - Only for auxiliary controls */

/* Main Button (Play, Next, etc.) */
.main-button {
    background-color: transparent;
    border: 3px solid #000000;
    border-radius: 30px;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 0px #000000;
    font-family: inherit;
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    /* White background for text readability over colored shapes */
    position: relative;
}

.main-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(255, 255, 255, 0.80);
    border-radius: 30px;
    z-index: -1;
    width: 100%;
    height: 100%;
}

.main-button:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 0px #000000;
}

.main-button:active {
    transform: translateY(0px);
    box-shadow: 2px 2px 0px #000000;
}

/* Removed "again" button styles to prevent vestige buttons during replay */

/* Disabled Button State */
.main-button.disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

.main-button.disabled:hover {
    background-color: #cccccc;
    transform: none;
    box-shadow: 4px 4px 0px #000000;
}


/* Results Table */
.results-container {
    width: 100%;
    max-width: clamp(280px, 90vw, 380px);
    margin-top: var(--dynamic-spacing);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 2px solid #000000;
    font-size: clamp(14px, 4vw, 18px);
    margin-bottom: var(--dynamic-margin);
    table-layout: fixed;
}

.results-table th:nth-child(1),
.results-table td:nth-child(1) {
    width: 22%;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
    width: 48%;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3) {
    width: 30%;
}

.results-table th {
    background-color: #f5f5f5;
    padding: 4px 8px;
    text-align: center;
    font-weight: 800;
    border-bottom: 2px solid #000000;
    font-size: 17px;
}

.results-table th:not(:last-child) {
    border-right: none;
}

.results-table td {
    padding: 4px 8px;
    text-align: center;
    font-weight: 700;
    border-bottom: 2px solid #000000;
    font-size: 17px;
    white-space: nowrap;
}

.results-table td:not(:last-child) {
    border-right: none;
}

.results-table tr:last-child td {
    border-bottom: 2px solid #000000;
}

/* Totals row styling */
.results-table tr.totals-row {
    background-color: #ffffff;
    font-weight: 700;
}

.results-table tr.totals-row td {
    padding: 6px 8px;
    border-bottom: 2px solid #000000;
    border-top: 2px solid #000000;
}

/* Goal Display Overlay on Playing Field */
.goal-display {
    width: clamp(280px, 85vw, 360px);
    max-width: 85vw;
    background-color: transparent; /* No background */
    border: none; /* No border */
    border-radius: 0;
    padding: clamp(20px, 6vw, 30px) var(--dynamic-padding);
    text-align: center;
    margin: 0; /* No margin needed for overlay */
    box-shadow: none; /* No shadow */
    transition: opacity 0.3s ease-out;
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.4; /* Comfortable line spacing */
}

/* Goal display as overlay on canvas */
.goal-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    margin: 0; /* Remove margin for overlay positioning */
}

/* Green text for "Practise" in welcome message */
.practise-text {
    color: #7FB069;
    font-weight: 600;
}

/* Blue text for "Play" in welcome message */
.play-text {
    color: rgb(100, 150, 255);
    font-weight: 600;
}

.goal-display.animate-in {
    animation: popGoalBox 1s ease-out forwards;
}

@keyframes popGoalBox {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Goal title removed per request */

.goal-text {
    font-size: 18px;
    font-weight: 400;
    color: #333333;
    margin: 0;
    line-height: 1.4;
    opacity: 0; /* Start invisible for animation */
}

/* CUT Popup - centered in playing field */
.cut-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #000000;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    color: #000000;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.cut-popup.show {
    opacity: 1;
}


/* Medal Stats Table */
.medal-stats-table {
    width: 300px;
    max-width: 300px;
    margin: 0 auto;
    text-align: center;
}

.stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 0;
    margin: 0;
    gap: 20px;
}

.medal {
    font-size: 24px;
    width: auto;
    text-align: center;
    flex-shrink: 0;
}

.attempt-split {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    min-width: 140px;
}

.average-label {
    font-size: 18px;
    font-weight: 600;
    color: #666;
    text-align: center;
    flex-shrink: 0;
}

.average-split {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    min-width: 140px;
}

.stats-divider {
    width: 50%;
    margin: 4px auto;
    border-bottom: 1px solid #ddd;
    height: 1px;
}

.attempt-text {
    font-size: 32px;
    font-weight: 700;
    color: #333333;
    margin: 0;
    line-height: 1.4;
    text-align: center;
}

.goal-text.fade-in {
    animation: fadeInGoalText 0.4s ease-out forwards;
    animation-delay: 0.8s; /* Start after box animation is mostly complete */
}

@keyframes fadeInGoalText {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.goal-description {
    font-size: 18px; /* 2 points smaller than the base 20px */
}

/* Swipe instruction text styling */
.swipe-instruction {
    width: 100%;
    text-align: center;
    margin-top: 8px;
}

.swipe-text {
    font-size: 16px;
    font-weight: 500;
    color: #666666;
    margin: 0;
    line-height: 1.3;
}

/* Split percentage uniform styling */
.results-table td {
    font-size: 16px !important;
}

.results-table td:nth-child(2),
.results-table td:nth-child(3) {
    font-size: 18px !important;
    font-weight: 600 !important;
}

.split-multi-line {
    line-height: 1.3;
    white-space: pre-line;
}

/* Split color coding */
.split-left {
    color: #6496FF;
    font-weight: bold;
}

.split-right {
    color: #FF6464;
    font-weight: bold;
}

.split-q1 { color: #FF6464; font-weight: bold; }
.split-q2 { color: #6496FF; font-weight: bold; }
.split-q3 { color: #64C864; font-weight: bold; }
.split-q4 { color: #FFC864; font-weight: bold; }

/* Currently viewed shape highlight */
.results-table tr.current-shape {
    background-color: #fff3cd !important;
    border: 2px solid #000000;
    box-shadow: 0 0 0 1px #000000;
}

/* Visual Swipe Indicators - Replay Navigation Arrows */
.swipe-indicators {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.swipe-arrow {
    position: absolute;
    top: 50%; /* Horizontal center line of playing field */
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    width: 24px;
    height: 24px;
}

.swipe-arrow-left {
    left: 10px; /* Slightly inset from left edge */
}

.swipe-arrow-right {
    right: 10px; /* Slightly inset from right edge */
}

.swipe-arrow svg {
    width: 24px;
    height: 24px;
    fill: rgba(255, 255, 255, 0.85); /* Semi-transparent white fill */
    stroke: #000000; /* Solid black stroke */
    stroke-width: 2;
    filter: drop-shadow(2px 2px 0px rgba(0, 0, 0, 1)); /* Sharp drop shadow like playing field */
}

/* Footer Info - Contact and Copyright */
.footer-info {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px; /* Match app container width */
    padding: 10px 20px;
    z-index: 999;
    font-size: 0.85rem;
    line-height: 1.4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright {
    color: #888;
}

.footer-contact {
    color: #888;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-contact:hover {
    color: #666;
}


/* v3.0 - Attempt Result Display */
.attempt-result {
    width: 100%;
    margin-top: 8px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}


.attempt-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* v3.0 - Post lock-in elements (share button and thanks message) */
.post-lockin-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
}

.post-lockin-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-lockin-share-btn {
    background-color: #CFE0C3;
    color: #000000;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000000;
    font-family: inherit;
    transition: all 0.2s ease;
    width: 120px;
    text-align: center;
}

.post-lockin-share-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000000;
    background-color: #B8D1AB;
}

.post-lockin-share-btn:active {
    transform: translateY(0px);
    box-shadow: 2px 2px 0px #000000;
}


.thanks-message {
    font-size: 18px;
    color: #333;
    font-weight: 600;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.countdown-message {
    font-size: 18px;
    color: #333;
    font-weight: 500;
    text-align: center;
    margin: 0;
}

/* Countdown Timer Overlay */
.countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    pointer-events: none;
}

.countdown-box {
    background-color: rgba(255, 255, 255, 0.75);
    border: 2px solid rgba(0, 0, 0, 1);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.split-display {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.split-display-large {
    font-size: 51px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    /* Ensure responsive container for animations */
    min-height: 1.2em;
    position: relative;
}

.split-divider {
    color: #666;
}

.score-display {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* v3.0 - Attempt Buttons */
.attempt-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    animation: slideUp 0.3s ease;
}

.attempt-button {
    padding: 12px 28px;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid #000;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px #000;
    width: 160px;
    text-align: center;
    line-height: 1.3;
}

/* Removed em styles since we're not using bracketed text anymore */

.try-again-button {
    background-color: #9EC1A3;
    color: #000;
}

.try-again-button:hover:not(.disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000;
}

.try-again-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lock-in-button {
    background-color: #FCAF58;
    color: #000000;
}

.lock-in-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000;
    background-color: #f0f0f0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* v3.0 - Final Score Display */
.final-score-display {
    text-align: center;
    margin-bottom: 20px;
}

.final-score-display h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.final-score {
    font-size: 20px;
    font-weight: 600;
}

/* Progress Circles - positioned under percentage splits */
.progress-circles {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    position: fixed;
    top: 580px; /* Moved up to sit under percentage splits */
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.progress-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #000;
    background-color: white;
    transition: background-color 0.3s ease;
}

.progress-circle.filled {
    background-color: rgb(100, 150, 255);
}

.share-feedback {
    text-align: center;
    color: #4CAF50;
    font-size: 14px;
    margin-top: 10px;
    font-weight: 600;
}


/* New Welcome Popup for First-Time Visitors */
.welcome-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

/* On mobile, align towards top for better UX */
@media (max-height: 700px) {
    .welcome-popup {
        align-items: flex-start;
        padding: 62px 20px 20px 20px;
    }
}

/* Desktop centering fix */
@media (min-width: 768px) {
    .welcome-popup {
        justify-content: center;
        align-items: center;
        padding: 20px;
    }
    
    .welcome-content {
        width: 400px;
        max-width: none;
        margin: 0 auto;
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
    }
}

.welcome-content {
    background-color: #ffffff;
    border: 3px solid #000000;
    border-radius: 12px;
    max-width: 90vw;
    width: 100%;
    max-width: min(400px, 90vw);
    box-shadow: 6px 6px 0px #000000;
    transition: max-height 300ms ease-out;
    max-height: 240px; /* Increased further to show the gap */
    overflow: hidden;
    /* Top alignment handled by popup padding */
}

.welcome-content.expanded {
    max-height: 90vh;
    overflow-y: auto;
}

.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 20px;
    border-bottom: 2px solid #000000;
    background-color: #6B7B82;
}

.welcome-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.welcome-body {
    padding: 24px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
}

.welcome-message {
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.welcome-message p {
    margin: -8px 0 0 0; /* Move text up */
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: #333333;
}

.how-to-play-button {
    background-color: #fff3cd;
    border: 3px solid #000000;
    border-radius: 25px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 0px #000000;
    font-family: inherit;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    margin: 12px auto 0 auto; /* Move button down */
}

.how-to-play-button:hover {
    background-color: #ffeaa7;
    transform: translateY(-1px);
    box-shadow: 6px 6px 0px #000000;
}

/* Continue Button for Welcome Back Popup */
.continue-button {
    background-color: #d4edda;
    border: 3px solid #000000;
    border-radius: 25px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 0px #000000;
    font-family: inherit;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    margin: 12px auto 0 auto;
}

.continue-button:hover {
    background-color: #c3e6cb;
    transform: translateY(-1px);
    box-shadow: 6px 6px 0px #000000;
}

.continue-button:active {
    transform: translateY(2px);
    box-shadow: 2px 2px 0px #000000;
}

.how-to-play-button:active {
    transform: translateY(0px);
    box-shadow: 2px 2px 0px #000000;
}

.welcome-instructions {
    margin-top: 16px;
}

/* Copy relevant instruction styles for welcome popup */
.welcome-instructions .demo-instructions {
    width: 100%;
    margin: 0 auto 16px auto;
}

.welcome-instructions .demo-instructions p {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 6px;
}

.welcome-instructions .demo-section {
    margin: 12px 0;
    padding: 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.welcome-instructions .demo-results {
    margin-bottom: 12px;
}

.welcome-instructions .demo-results-table {
    width: 280px;
    border-collapse: collapse;
    border: 2px solid #000000;
    background-color: #ffffff;
    font-size: 17px;
    margin: 0 auto 12px auto;
    table-layout: fixed;
}

.welcome-instructions .demo-results-table th {
    background-color: #f5f5f5;
    padding: 2px 8px;
    text-align: center;
    font-weight: 800;
    border-bottom: 2px solid #000000;
    font-size: 16px;
}

.welcome-instructions .demo-results-table th:not(:last-child) {
    border-right: none;
}

.welcome-instructions .demo-results-table td {
    padding: 2px 8px;
    text-align: center;
    font-weight: 700;
    border-bottom: 2px solid #000000;
    font-size: 17px;
    white-space: nowrap;
}

.welcome-instructions .demo-results-table td:not(:last-child) {
    border-right: none;
}

.welcome-instructions .demo-results-table th:nth-child(1),
.welcome-instructions .demo-results-table td:nth-child(1) {
    width: 65%;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.welcome-instructions .demo-results-table th:nth-child(2),
.welcome-instructions .demo-results-table td:nth-child(2) {
    width: 35%;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.welcome-instructions .demo-goal-display {
    width: 280px;
    background-color: #f5f5f5;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 4px auto 0 auto;
    text-align: center;
    box-shadow: 2px 2px 0px #000000;
    transition: opacity 0.3s ease-out;
}

.welcome-instructions .demo-goal-text {
    font-size: 1rem;
    font-weight: 400;
    color: #333333;
    margin: 0;
    line-height: 1.3;
}

.welcome-instructions #demoCanvas {
    border: 2px solid #000000;
    border-radius: 4px;
    background-color: #ffffff;
    cursor: crosshair;
    margin-bottom: 8px;
    box-shadow: 2px 2px 0px #000000;
    max-width: 100%;
    height: auto;
    outline: none;
}

/* Responsive adjustments for welcome popup */
@media (max-width: 400px) {
    .welcome-content {
        max-width: 95vw;
        border-radius: 0 0 8px 8px;
    }
    
    .welcome-body {
        padding: 12px 16px;
    }
    
    .welcome-instructions #demoCanvas {
        width: 250px;
        height: 250px;
        max-width: calc(100vw - 80px);
    }
}

/* Help Popup */
.help-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    padding: 62px 20px 30px 20px;
}

.help-content {
    background-color: #ffffff;
    opacity: 1;
    border: 3px solid #000000;
    border-radius: 12px;
    max-width: 90vw;
    width: 100%;
    max-width: min(400px, 90vw);
    box-shadow: 6px 6px 0px #000000;
    height: 620px;
    max-height: 95vh;
    overflow-y: hidden;
    transition: transform 300ms ease-out, opacity 300ms ease-out;
}

/* Removed global border-right: none rule that was affecting button text boxes */

/* Animation states for first-visit popup */
.help-popup.animated-entry {
    opacity: 0;
}

.help-popup.animated-entry .help-content {
    transform: scale(0.3);
    opacity: 0;
    transform-origin: top right;
}

.help-popup.animated-entry.show-animated .help-content {
    transform: scale(1);
    opacity: 1;
}

.help-popup.animated-entry.show-animated {
    opacity: 1;
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 20px;
    border-bottom: 2px solid #000000;
    background-color: #6B7B82;
}

.help-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #ffffff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

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

.help-body {
    padding: 16px 16px 8px 16px;
}

.help-body p {
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.help-body ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.help-body li {
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 1.4;
}

/* Blue highlight box for GOAL words */
.goal-highlight {
    background-color: #e3f2fd;
    border: 2px solid #000000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: #000000;
    margin: 0 2px;
    display: inline-block;
    box-shadow: 2px 2px 0px #000000;
}

/* Demo section styles */
.demo-section {
    margin: 12px 0;
    padding: 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.demo-instructions {
    width: 300px;
    margin: 0 auto 8px auto;
}

.demo-instructions p {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 6px;
}

#demoCanvas {
    border: 2px solid #000000;
    border-radius: 4px;
    background-color: #ffffff;
    cursor: crosshair;
    margin-bottom: 8px;
    box-shadow: 2px 2px 0px #000000;
    max-width: 100%;
    height: auto;
    outline: none;
}

/* Mobile responsive adjustments for demo */
@media (max-width: 400px) {
    .demo-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    #demoCanvas {
        width: 280px;
        height: 280px;
        max-width: calc(100vw - 80px);
    }
    
    .help-content {
        max-width: 95vw;
    }
    
    .help-body {
        padding: 16px;
    }
    
    /* Adjust animation origin for mobile */
    .help-popup.animated-entry .help-content {
        transform-origin: top right;
    }
}

.demo-practice-text {
    font-size: 24px;
    font-weight: 500;
    text-align: center;
    width: 300px;
    margin: 0px auto;
    color: rgb(100, 150, 255);
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.demo-practice-text.faded {
    opacity: 0;
}

.demo-percentage-text {
    font-size: 32.5px;
    font-weight: 600;
    text-align: center;
    width: 300px;
    margin: 0px auto;
    color: #000000;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
    margin-top: -35px; /* Moved closer to demo canvas */
}

.demo-results {
    margin-bottom: 12px;
    width: 300px;
    text-align: left;
    border: none;
    outline: none;
}

.demo-results * {
    border-right: none !important;
    outline: none !important;
}

.demo-percentage {
    font-size: 32px;
    font-weight: bold;
    margin-top: -32px;
    text-align: center;
    width: 400px;
    position: relative;
    z-index: 2;
    border: none;
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    left: 50%;
    transform: translateX(-50%);
}

.demo-percentage span {
    border: none;
    outline: none;
}

.demo-results-table {
    width: 300px;
    border-collapse: collapse;
    border: 2px solid #000000;
    background-color: #ffffff;
    font-size: 17px;
    margin: 0 auto 12px auto;
    table-layout: fixed;
}

.demo-results-table th {
    background-color: #f5f5f5;
    padding: 2px 8px;
    text-align: center;
    font-weight: 800;
    border-bottom: 2px solid #000000;
    font-size: 16px;
}

.demo-results-table th:not(:last-child) {
    border-right: none;
}

.demo-results-table td {
    padding: 2px 8px;
    text-align: center;
    font-weight: 700;
    border-bottom: 2px solid #000000;
    font-size: 17px;
    white-space: nowrap;
}

.demo-results-table td:not(:last-child) {
    border-right: none;
}

/* Demo table column widths */
.demo-results-table th:nth-child(1),
.demo-results-table td:nth-child(1) {
    width: 65%;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.demo-results-table th:nth-child(2),
.demo-results-table td:nth-child(2) {
    width: 35%;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

.demo-goal-display {
    width: 300px;
    background-color: #f5f5f5;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 4px auto 0 auto;
    text-align: center;
    box-shadow: 2px 2px 0px #000000;
    transition: opacity 0.3s ease-out;
}

/* Demo goal title removed per request */

.demo-goal-text {
    font-size: 1rem;
    font-weight: 400;
    color: #333333;
    margin: 0;
    line-height: 1.3;
}

/* Stats popup specific styles - positioned below playing field */

/* Reset button styles */
.reset-container {
    text-align: center;
    margin-top: 20px;
}

.reset-button {
    background-color: #ff6b6b;
    color: white;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 3px 3px 0px #000000;
}

.reset-button:hover {
    background-color: #ff5252;
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px #000000;
}

/* Trophy Popup */
.trophy-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: #FFED9A; /* Bolder yellow - between #FFD700 and #FFF3CD */
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 24px 32px;
    box-shadow: 4px 4px 0px #000000;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    min-width: 280px;
}

.trophy-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.trophy-popup-content {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #333333;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.trophy-popup-icon {
    width: 32px;
    height: 32px;
    color: #000000;
}

.trophy-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333333;
    transition: transform 0.2s ease;
}

.trophy-popup-close:hover {
    transform: scale(1.1);
}

/* Orientation Lock */
.orientation-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.orientation-text {
    font-size: 24px;
    font-weight: 800;
    color: #000000;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 20px;
}

.orientation-emoji {
    font-size: 48px;
    text-align: center;
    outline: none;
}

.demo-section * {
    border-right: none !important;
    outline: none !important;
}

/* Score Colors */
.score-perfect {
    color: #2e7d32;
    font-weight: 800;
}

.score-excellent {
    color: #388e3c;
    font-weight: 800;
}

.score-good {
    color: #689f38;
    font-weight: 700;
}

.score-okay {
    color: #ffa000;
    font-weight: 700;
}

.score-poor {
    color: #f57c00;
    font-weight: 700;
}

.score-bad {
    color: #d32f2f;
    font-weight: 700;
}

/* Enhanced Mobile Responsive Design */

/* Intermediate screen sizes */
@media (max-width: 450px) {
    :root {
        --dynamic-spacing: clamp(2px, 1vw, 6px);
        --dynamic-padding: clamp(6px, 3vw, 15px);
    }
    
    .app-container {
        gap: clamp(2px, 1vw, 4px);
    }
    
    .header-row {
        padding: 0 clamp(5px, 2vw, 10px);
    }
}

/* Mobile Responsive */
@media (max-width: 400px) {
    body {
        padding: var(--dynamic-padding);
    }
    
    .app-container {
        gap: var(--dynamic-spacing);
        padding-bottom: calc(var(--dynamic-padding) * 5);
    }
    
    .app-title {
        font-size: 1.8rem;
    }
    
    .help-button,
    .share-button-header {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    #geoCanvas {
        width: 350px;
        height: 350px;
    }
    
    .canvas-play-button {
        padding: 12px 24px;
        font-size: 18px; /* Increased from 16px */
        min-width: 100px;
    }
    
    .results-table {
        font-size: 14px;
    }
    
    .results-table th,
    .results-table td {
        padding: 4px 6px;
    }
    
    .results-table td:nth-child(2),
    .results-table td:nth-child(3) {
        font-size: 16px !important;
    }
}

/* Very small screens - iPhone SE and similar */
@media (max-width: 320px), (max-height: 600px) {
    body {
        padding: 2px 4px 4px 4px;
        font-size: 14px;
    }
    
    .app-container {
        gap: 0px;
        padding-bottom: 60px;
        min-height: calc(100vh - 10px);
    }
    
    .app-title {
        font-size: 1.4rem;
        margin: 2px 0;
    }
    
    .header-row {
        padding: 2px 3px;
        margin-bottom: 2px;
    }
    
    .help-button,
    .share-button-header {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    #geoCanvas {
        width: 280px;
        height: 280px;
    }
    
    .canvas-play-button {
        padding: 8px 14px;
        font-size: 15px; /* Increased from 13px */
        width: 90px;
    }
    
    .attempt-button {
        padding: 8px 14px;
        font-size: 16px;
        font-weight: 700;
        width: 90px;
    }
    
    .post-lockin-share-btn {
        padding: 8px 14px;
        font-size: 14px;
        width: 90px;
    }
    
    .goal-display {
        width: calc(100vw - 20px);
        max-width: 280px;
        padding: 6px 8px;
        font-size: 12px;
        margin: 4px auto 0 auto;
        box-sizing: border-box;
    }
    
    .attempt-display {
        width: 100%;
        margin: 20px auto;
    }
    
    .attempt-text {
        font-size: 28px;
    }
    
    .progress-circles {
        top: 550px; /* Moved up for mobile to sit under percentage splits */
    }
    
    
    .split-display-large {
        font-size: 34px;
        gap: 8px;
        margin-top: 2px;
    }
    
    .attempt-result {
        margin-top: 4px;
    }
    
    .attempt-buttons {
        gap: 8px;
        margin-top: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .post-lockin-container {
        gap: 6px;
        margin-top: 8px;
        padding-bottom: 10px;
    }
    
    .thanks-message,
    .countdown-message {
        font-size: 16px;
    }
    
    .countdown-box {
        padding: 12px 20px;
    }
    
    .help-popup .help-content {
        width: calc(100vw - 10px);
        max-width: 310px;
        height: auto;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .demo-section canvas {
        width: 200px;
        height: 200px;
    }
    
    .demo-practice-text {
        font-size: 14px;
        width: 200px;
    }
    
    .demo-percentage-text {
        font-size: 10px;
        width: 200px;
    }
    
    .help-body {
        padding: 10px 10px 5px 10px;
    }
    
    .demo-instructions p {
        font-size: 13px;
        margin: 4px 0;
        line-height: 1.3;
    }
    
    .demo-instructions {
        margin-bottom: 8px;
    }
    
    .demo-section {
        margin: 8px 0;
        padding: 8px;
    }
}

/* Additional small screen optimizations */
@media (max-height: 650px) {
    .app-container {
        gap: 0px;
        padding-bottom: 40px;
    }
    
    .attempt-buttons {
        margin-top: 4px;
    }
    
    .post-lockin-container {
        margin-top: 6px;
        gap: 4px;
    }
    
    .goal-display {
        margin: 2px auto 0 auto;
        padding: 4px 6px;
    }
    
    .split-display-large {
        font-size: 42px;
        margin-top: 0px;
    }
}

/* Ultra-compact for very constrained screens */
@media (max-width: 300px) {
    #geoCanvas {
        width: 260px;
        height: 260px;
    }
    
    .goal-display {
        width: calc(100vw - 15px);
        font-size: 11px;
        padding: 4px 6px;
    }
    
    .attempt-button,
    .post-lockin-share-btn,
    .canvas-play-button {
        width: 80px;
        padding: 6px 10px;
        font-size: 14px; /* Increased from 12px */
    }
    
    .split-display-large {
        font-size: 29px;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
}

/* Button-like text styling in instruction popup */
.button-text {
    display: inline-block;
    padding: 8px 12px;
    border: 3px solid #000000;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
    text-align: center;
    vertical-align: top;
}

.retry-button-text {
    background-color: #9EC1A3;
    color: #000000;
    padding: 8px 12px;
    border: 2px solid #000000;
    font-weight: bold;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
    min-width: 80px;
}

.commit-button-text {
    background-color: #FCAF58;
    color: #000000;
    padding: 8px 12px;
    border: 2px solid #000000;
    font-weight: bold;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
    min-width: 80px;
}

/* Styling for italic text within buttons */
.button-text em,
.retry-button-text em,
.commit-button-text em {
    font-size: 12px;
    font-weight: normal;
    font-style: italic;
    opacity: 0.8;
}

/* Indent text to align with bullet point text content */
.indent-text {
    margin-left: 1.2em;
    margin-top: -0.5em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.indent-text span:not(.button-text) {
    vertical-align: middle;
    position: relative;
    top: 0;
}

/* Committed results styling */
.committed-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    max-width: 280px;
    margin: 0 auto;
    padding: 0 20px;
}

.results-columns {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.percentages-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    white-space: nowrap;
    margin-right: 15px;
}

.labels-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    white-space: nowrap;
    margin-left: 15px;
}

.split-text {
    color: #777777;
    text-align: left;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.average-text {
    color: #000000;
    text-align: left;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}


.split-label,
.average-label {
    color: #000000;
    font-size: 18px;
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

.average-label {
    color: #000000;
}

/* Responsive adjustments for committed results */
@media (max-width: 320px) {
    .committed-results {
        font-size: 16px;
        gap: 6px;
        max-width: 260px;
        padding: 0 15px;
    }
    
    .split-text,
    .average-text {
        font-size: 16px;
    }
    
    .split-label,
    .average-label {
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .committed-results {
        font-size: 17px;
        max-width: 270px;
        padding: 0 18px;
    }
    
    .split-text,
    .average-text {
        font-size: 17px;
    }
    
    .split-label,
    .average-label {
        font-size: 17px;
    }
}

/* Percentage animation support */
@media (prefers-reduced-motion: reduce) {
    .split-display-large * {
        transition: none !important;
        animation: none !important;
    }
    
    .committed-results {
        transition: none !important;
    }
}

/* Enhanced responsiveness for percentage animations */
.split-display-large {
    box-sizing: border-box;
}

@media (max-width: 320px) {
    .split-display-large {
        font-size: 34px;
        min-height: 1.1em;
    }
}

/* Extra small screens optimization */
@media (max-height: 568px) {
    .app-container {
        gap: 2px;
        padding-bottom: 105px;
    }
    
    .canvas-play-button {
        padding: 10px 20px;
        font-size: 17px; /* Increased from 15px */
        min-width: 90px;
    }
    
    .replay-arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .results-table {
        font-size: 12px;
    }
    
    .results-table th,
    .results-table td {
        padding: 4px 6px;
    }
    
    .results-table td:nth-child(2),
    .results-table td:nth-child(3) {
        font-size: 14px !important;
    }
}


/* Enhanced Landscape orientation handling */
@media (orientation: landscape) and (max-height: 500px) {
    .app-container {
        display: none;
    }
    
    .orientation-message {
        display: flex !important;
        font-size: clamp(16px, 3vh, 20px);
        padding: clamp(10px, 2vh, 20px);
    }
}

/* Dynamic viewport height adjustments */
@media (max-height: 700px) {
    :root {
        --dynamic-spacing: clamp(2px, 0.5vh, 6px);
        --dynamic-padding: clamp(5px, 2vh, 15px);
    }
    
    .app-container {
        min-height: calc(100vh - var(--dynamic-padding));
    }
}

/* Improved touch target sizes for accessibility */
@media (pointer: coarse) {
    .canvas-play-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .help-button,
    .share-button-header {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Prevent text selection and zoom */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Disable double-tap zoom */
input, button, textarea, select {
    font-size: 16px;
}

/* Loading Splash Screen */
.loading-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.loading-splash.visible {
    opacity: 1;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #000000;
    letter-spacing: -0.5px;
    margin: 0;
}

.loading-message {
    font-size: 18px;
    font-weight: 600;
    color: #666666;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Loading Hexagon Animation */
.loading-hexagon {
    display: block;
    margin: 8px auto 0;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawEraseHexagon 1s linear infinite;
}

@keyframes drawEraseHexagon {
    0% { 
        stroke-dashoffset: 400; 
    }
    50% { 
        stroke-dashoffset: 0; 
    }
    100% { 
        stroke-dashoffset: -400; 
    }
}

/* Loading splash responsive adjustments */
@media (max-width: 480px) {
    .loading-title {
        font-size: 1.8rem;
    }
    
    .loading-message {
        font-size: 16px;
    }
}

/* Updated Header with Tagline */
.title-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}


/* Play Section - Goal beside Play Button */
.play-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 380px;
}

.play-section .shape-goal {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    text-align: left;
}


/* Compact Loading Popup */
.loading-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.loading-popup.visible {
    opacity: 1;
}

.loading-popup-content {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    text-align: center;
    box-shadow: none;
    min-width: auto;
}

.loading-popup-content .loading-message {
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    text-align: center;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .play-section {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .play-section .shape-goal {
        font-size: 15px;
        text-align: center;
    }
}