body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #87ceeb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: white;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.top-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

#audio-toggle, #list-entries-btn, #export-data-btn, #import-data-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    font-size: 18px;
    transition: background 0.2s;
}

#audio-toggle:hover, #list-entries-btn:hover, #export-data-btn:hover, #import-data-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#controls-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

#add-page-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #7b2cbf;
    border: 2px solid #ff9e00;
    color: white;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 158, 0, 0.4);
    pointer-events: auto;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-page-btn:hover {
    transform: scale(1.1);
    background: #4895ef;
}

#editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 20, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#editor-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

#ocean-log-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100%;
    background: #ffffff;
    z-index: 150;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: #333;
    display: flex;
    flex-direction: column;
}

#ocean-log-sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (max-width: 600px) {
    #ocean-log-sidebar {
        width: 85%;
    }
}

.modal-content, .sidebar-content {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    color: #333;
    overflow: hidden;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    height: 80%;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content header, .sidebar-content header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    justify-content: space-between;
}

.modal-content header h2 {
    margin: 0;
    font-size: 18px;
    color: #5a189a;
}

#page-title {
    flex-grow: 1;
    border: none;
    font-size: 20px;
    font-weight: 600;
    outline: none;
    color: #222;
}

#close-editor {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 5px;
}

#page-content {
    flex-grow: 1;
    border: none;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    outline: none;
    color: #444;
    background: #fdfdfd;
}

#entries-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
}

.entry-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.2s;
}

.entry-item:hover {
    border-color: #5a189a;
    transform: translateX(4px);
}

.entry-rank {
    background: #f0e6ff;
    color: #5a189a;
    font-weight: bold;
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 13px;
}

.entry-info {
    flex-grow: 1;
}

.entry-item-title {
    font-weight: 600;
    font-size: 15px;
    color: #222;
    margin-bottom: 2px;
}

.entry-item-snippet {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.modal-content footer {
    padding: 10px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    gap: 10px;
}

.order-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eee;
    padding: 4px 8px;
    border-radius: 6px;
}

.order-controls button {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 8px;
    font-weight: bold;
}

.order-controls button:hover {
    background: #f0f0f0;
}

#swap-btn {
    margin-left: 10px;
    background: #5a189a;
    color: white !important;
    border: none !important;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#swap-btn:hover {
    background: #7b2cbf;
}

#boat-rank-display {
    font-weight: bold;
    font-size: 14px;
    color: #5a189a;
    min-width: 30px;
    text-align: center;
}

#status-msg {
    font-size: 11px;
    color: #999;
    flex-grow: 1;
}

button.danger {
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

button.danger:hover {
    background: #ff3333;
}

/* Joystick area for mobile */
#joystick-container {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 120px;
    height: 120px;
    z-index: 20;
    pointer-events: auto;
}

#hover-preview {
    position: fixed;
    background: rgba(255, 255, 255, 0.9);
    color: #222;
    padding: 10px 14px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 200px;
    backdrop-filter: blur(4px);
    transition: opacity 0.15s;
}

#hover-preview.hidden {
    opacity: 0;
}

.preview-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    color: #5a189a;
}

.preview-snippet {
    font-size: 12px;
    line-height: 1.4;
    color: #555;
    font-style: italic;
}