/* Mobile-only overrides */
html, body { 
    height: 100%; 
    margin: 0; 
}

:root { 
    --vh: 1vh; /* JS below sets this precisely */
}

/* Stack the layout vertically */
.main-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
}

/* Give the map a real height */
#map { 
    width: 100%; 
    height: 60dvh; 
    border-radius: 12px; 
}

/* Fallback for browsers that don't support dvh */
@supports not (height: 60dvh) { 
    #map { 
        height: calc(var(--vh) * 60); 
    } 
}

/* Make panels full width */
.sidebar {
    width: 100%;
    max-width: 100%;
}

.sidebar-content {
    padding: 12px;
}

.card, .instruction-card, .score-card, .tokens-card, .revealed-card, .result-card {
    border-radius: 12px;
    padding: 12px;
}

/* Make buttons wrap and be responsive */
.form-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guess-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

#theme-guess-input, #vertex-guess-input {
    width: 100%;
    min-width: 0;
    flex: 1;
}

.submit-btn {
    width: 100%;
    max-width: 100%;
}

.attempts-indicator {
    flex-direction: column;
    gap: 8px;
}

/* Make navigation responsive */
.nav-container {
    flex-direction: column;
    gap: 12px;
}

.nav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.nav-btn {
    flex: 1 1 160px;
    max-width: 100%;
    min-width: 140px;
}

/* Make attempts dots and tokens wrap */
.attempts-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Prevent horizontal scroll */
body { 
    overflow-x: hidden; 
}

/* Adjust Leaflet controls for mobile */
.leaflet-top.leaflet-left { 
    top: calc(env(safe-area-inset-top,0px) + 8px); 
    left: 8px; 
}

.leaflet-bottom.leaflet-right { 
    bottom: calc(env(safe-area-inset-bottom,0px) + 8px); 
    right: 8px; 
}

/* Modal adjustments for mobile */
.modal-content {
    margin: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}

/* Make header responsive */
.top-nav {
    padding: 12px;
}

.nav-brand {
    text-align: center;
}

/* Score display adjustments */
.score-display {
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Result section adjustments */
.result-card {
    text-align: center;
}

.copy-btn {
    width: 100%;
    max-width: 100%;
}