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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #fff;
}

#pond-container {
    position: relative;
    width: var(--pond-size, 256px);
    height: var(--pond-size, 256px);
    cursor: pointer;
}

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

#background-layer {
    z-index: 0;
}

#water-layer {
    z-index: 1;
}

#fish-layer {
    z-index: 2;
}

#surface-layer {
    z-index: 3;
}

/* Debug panel */
#debug-panel {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 280px;
    max-height: calc(100vh - 24px);
    overflow: hidden;
    z-index: 10;
    background: rgba(10, 18, 16, 0.78);
    color: #dfe7e4;
    font-family: "SF Mono", "Fira Mono", "Menlo", monospace;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(6px);
}

#debug-panel.is-hidden {
    display: none;
}

.debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.debug-toggle {
    background: rgba(255, 255, 255, 0.08);
    color: #dfe7e4;
    border: 0;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
}

.debug-body {
    padding: 8px 12px 12px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.debug-body.is-hidden {
    display: none;
}

.debug-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}

.debug-row label {
    grid-column: 1 / span 2;
    color: rgba(223, 231, 228, 0.9);
}

.debug-row input[type="range"] {
    grid-column: 1 / span 1;
    width: 100%;
}

.debug-value {
    text-align: right;
    min-width: 38px;
    color: rgba(223, 231, 228, 0.7);
}

/* Prevent text selection and touch callouts on mobile */
#pond-container {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: none;
}

#record-panel {
    position: fixed;
    left: 12px;
    bottom: 12px;
    width: 260px;
    z-index: 10;
    background: rgba(10, 18, 16, 0.78);
    color: #dfe7e4;
    font-family: "SF Mono", "Fira Mono", "Menlo", monospace;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    backdrop-filter: blur(6px);
}

#record-panel .record-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

#record-panel label {
    flex: 1;
}

#record-panel input[type="number"],
#record-panel select {
    width: 80px;
    background: rgba(255, 255, 255, 0.08);
    color: #dfe7e4;
    border: 0;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 11px;
}

#record-panel button {
    background: rgba(255, 255, 255, 0.08);
    color: #dfe7e4;
    border: 0;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    cursor: pointer;
}

#record-status {
    font-size: 11px;
    color: rgba(223, 231, 228, 0.7);
}

body.embed-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #fdfdfd;
}

body.embed-mode #pond-container {
    flex-shrink: 0;
    width: min(480px, calc(100vw - 300px)) !important;
    height: min(480px, calc(100vw - 300px)) !important;
}

body.embed-mode #record-panel {
    position: static;
    width: 260px;
    flex-shrink: 0;
}

body.embed-mode #debug-panel {
    display: none;
}

@media (max-width: 640px) {
    body.embed-mode {
        flex-direction: column;
    }

    body.embed-mode #pond-container {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1;
    }

    body.embed-mode #record-panel {
        width: 100%;
    }
}
