/* Mobile Stylesheet - FIXED for SVG bridges */

html {
    height: -webkit-fill-available;
}

body {
    margin: 0;
    padding: 0;
    background-color: #fff;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    height: 100%;
    position: fixed;
    width: 100%;
    overflow: hidden;
}

body::before {
  content: "Mobile: pre-alpha";
  position: fixed;
  bottom: 0;
  left: 0;
  background: green;
  color: white;
  padding: 3px 3px;
  font-size: 10px;
  z-index: 9999;
}

.top-right-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-icon {
    background-color: rgba(51, 51, 51, 0.95);
    color: white;
    border: none;
    padding: 9px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: background-color 0.2s;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    height: 48px;
    box-sizing: border-box;
    overflow: hidden;
}

.user-icon:hover {
    background-color: #555;
}

.user-menu {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
}

.hamburger-menu {
    position: relative;
}

.hamburger-button {
    background-color: #333;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: background-color 0.2s;
}

.hamburger-button:hover {
    background-color: #555;
}

.menu-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    background-color: #333;
    border-radius: 5px;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    display: none;
}

.menu-dropdown.show {
    display: block;
}

.menu-link {
    display: block;
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    transition: background-color 0.2s;
}

.menu-link:hover {
    background-color: #555;
}

.menu-link:first-child {
    border-radius: 5px 5px 0 0;
}

.menu-link:last-child {
    border-radius: 0 0 5px 5px;
}

.toolbar {
    display: flex;
    gap: 10px;
}

.tool {
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 9px 15px;
    border-radius: 5px;
    transition: background-color 0.2s;
    background-color: rgba(51, 51, 51, 0.95);
    min-width: 50px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    height: 48px;
    box-sizing: border-box;
    overflow: hidden;
}

.tool:hover {
    background-color: #555;
}

.tool.active {
    background-color: #555;
}

/* ============================================================
   CRITICAL: Bridge Section - FIXED for mobile viewport
   ============================================================ */

#bridge-section {
    position: relative;
    /* Height will be set by JavaScript */
    overflow-x: auto;
    overflow-y: hidden;
    
    /* CRITICAL: Enable pinch-zoom */
    touch-action: pan-x pan-y pinch-zoom;
    
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: flex-end; /* Align bridges to bottom */
    min-height: 0; /* Important for flex children */
}

#bridge-canvas {
    position: relative;
    width: fit-content;
    /* Height set by JavaScript to match bridge-section */
    cursor: grab;
    display: flex;
    align-items: flex-end; /* Align bridges to bottom */
}

#navigation-section {
    flex-shrink: 0;
}

#minimap-section {
    position: relative;
    /* Height set by JavaScript to 14vh */
    flex-shrink: 0;
    background-color: #f0f0f0;
    border-top: 1px solid #ccc;
}

/* ============================================================
   CRITICAL: Bridge Container - FIXED aspect ratio
   ============================================================ */

.bridge-container {
    position: absolute;
    height: 100%;
    z-index: 1;
    display: flex;
    align-items: flex-end; /* Align SVG to bottom */
}

/* CRITICAL: SVG sizing to maintain aspect ratio */
.bridge-container svg {
    display: block;
    height: 100%;
    width: auto;
    max-height: none;
    max-width: none;
    object-fit: contain; /* Maintain aspect ratio */
}

/* ============================================================
   LANDSCAPE MODE - Auto-adjust on rotation
   ============================================================ */

@media (orientation: landscape) {
    #bridge-canvas {
        align-items: center; /* Center vertically in landscape */
    }
    
    .bridge-container {
        align-items: center;
    }
}

/* ============================================================
   PORTRAIT MODE - Ensure full bridge is visible
   ============================================================ */

@media (orientation: portrait) {
    #bridge-canvas {
        align-items: flex-end; /* Bottom-align in portrait */
    }
    
    .bridge-container {
        align-items: flex-end;
    }
}

/* ============================================================
   HEART MODAL - MOBILE CENTERED
   ============================================================ */

@media (max-width: 768px) {
    #lock-heart-modal {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    #lock-delete-modal .lock-modal-content {
        position: fixed !important;
        top: 60% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* ============================================================
   LOCK STYLING
   ============================================================ */

.placed-object {
    position: absolute;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 10;
    
    background: rgba(0, 0, 0, 0.02);
    backdrop-filter: blur(2px) brightness(0.7);
    -webkit-backdrop-filter: blur(2px) brightness(0.7);
    border-radius: 50%;
    padding: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.placed-object[data-is-owner="true"] {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.9);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(255, 215, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.3);
}

.coords {
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: 600;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 2px 6px;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.position-marker {
    position: absolute;
    top: 5px;
    color: #999;
    font-size: 10px;
    font-family: monospace;
    pointer-events: none;
}

/* Lock Confirmation Modal */
.lock-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background-color: transparent;
    pointer-events: none;
}

.lock-modal-backdrop * {
    pointer-events: auto;
}

.lock-modal-content {
    position: fixed;
    background-color: #fff;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    border: 2px solid #333;
    z-index: 2001;
}

.lock-modal-content p {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.lock-modal-options {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-option {
    font-size: 13px;
    color: #333;
    cursor: pointer;
    padding: 3px 8px;
    transition: all 0.2s;
}

.modal-option:hover {
    color: #000;
    font-weight: bold;
    transform: scale(1.1);
}

/* User Stats Display */
.user-stats {
    background-color: rgba(51, 51, 51, 0.95);
    border-radius: 5px;
    padding: 7px 9px 11px 9px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    font-size: 9px;
    color: white;
    line-height: 1.4;
    text-align: right;
    white-space: nowrap;
    min-width: 100px;
    height: 48px;
    box-sizing: border-box;
    overflow: hidden;
}

.user-stats .stat-label {
    color: #aaa;
    font-weight: normal;
}

.user-stats .stat-value {
    color: white;
    font-weight: bold;
}

/* Minimap Canvas */
#minimap-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

/* Minimap Controls */
#minimap-controls {
    position: absolute;
    bottom: 100%;
    margin-bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1001;
}

.minimap-nav-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.minimap-nav-btn:hover:not(:disabled) {
    background-color: #555;
}

.minimap-nav-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

#minimap-page-indicator {
    font-size: 12px;
    color: #333;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

#current-bridge-name {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    color: #333;
    font-size: 16px;
    font-family: Arial, sans-serif;
}

.heart-date-text {
    position: absolute;
    left: calc(50% + 0px);
    top: calc(50% + 35px);
    font-size: 10pt;
    color: black;
    font-weight: normal;
    white-space: nowrap;
    transform-origin: 0 0;
    transform: rotate(-45deg);
    z-index: 5;
}
