@font-face {
    font-family: 'ark-pixel';
    src: url('/asset/font/ark-pixel-12px-monospaced-latin.otf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'ark-pixel-cn';
    src: url('/asset/font/ark-pixel-12px-monospaced-zh_cn.otf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

body {
    margin: 0;
    overflow: hidden;
}

button {
    border-radius: 50%;
    border: none;
    cursor: grab;
    background-size: cover;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100px;
    height: 5px;
    background: black;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-family: 'ark-pixel';
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: black;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: black;
    cursor: pointer;
}

:root {
    --sidebar-width: clamp(240px, 18vw, 360px);
    --location-icon-size: clamp(100px, 10vw, 200px);
}

#sidebar1 {
    position: absolute;
    top: 0px;
    left: 0px;
    width: var(--sidebar-width);
    height: 97%;
    background-color: #f0f0f0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    text-align: center;
    transition: transform 0.5s ease-in-out;
    z-index: 999;
}

#sidebar1::-webkit-scrollbar {
    display: none;
}

#sidebar1.hidden {
    transform: translateX(calc(-1 * var(--sidebar-width) - 20px));
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    font-weight: 900;
    font-family: 'ark-pixel';
}

.home-link {
    color: #000;
    text-decoration: none;
    font-size: 12px;
    padding: 5px 10px;
    border: 2px solid #000;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: 'ark-pixel';
}

.home-link:hover {
    background-color: #000;
    color: #fff;
}

#sidebar1 h3 {
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5rem;
    text-align: left;
    font-family: 'ark-pixel-cn';
}

#sidebar1 p {
    width: 100%;
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    line-height: 1.5rem;
    font-family: 'ark-pixel';
}

#sidebar1 .selected-image {
    width: min(70%, 220px);
    height: auto;
}

#sidebar1 label[data-pan-src],
#sidebar1 label[data-low-src],
#sidebar1 label[data-high-src] {
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    margin: 12px 0 6px;
}

#sidebar1 label[data-left-src],
#sidebar1 label[data-right-src] {
    font-size: clamp(0.7rem, 1vw, 0.8rem);
}

#sidebar1 .control-slider {
    width: 100%;
    max-width: calc(var(--sidebar-width) - 40px);
    height: 7px;
    margin: 10px 0 14px;
}

#toggle-sidebar1 {
    position: absolute;
    top: calc(50% - 13px);
    left: calc(var(--sidebar-width) + 39px);
    padding: 5px 5px;
    cursor: pointer;
    background-color: #000;
    color: white;
    border: none;
    font-weight: 700;
    border-radius: 3px;
    transition: left 0.5s ease-in-out;
    z-index: 99;
}

#toggle-sidebar1.hidden {
    left: 19px;
}

#sidebar2 {
    position: absolute;
    top: 0px;
    right: 0px;
    width: var(--sidebar-width);
    height: 100%;
    background-color: #f0f0f0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px; /* match sidebar1 */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    text-align: center;
    transition: transform 0.5s ease-in-out;
    z-index: 999;
}

#sidebar2::-webkit-scrollbar {
    display: none;
}

#sidebar2.hidden {
    transform: translateX(calc(var(--sidebar-width) + 20px));
}

#sidebar2 h2 {
    margin: 0 0 12px;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    font-weight: 900;
    font-family: 'ark-pixel';
}

#sidebar2 h3 {
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    font-weight: 400;
    line-height: 1.5rem;
    text-align: left;
    font-family: 'ark-pixel-cn';
}

#sidebar2 p {
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.5rem;
    font-family: 'ark-pixel';
    margin: 0 0 16px;
}

.sidebar2-body {
    overflow-y: auto;
    padding: 0; /* parent provides padding */
    flex: 1 1 auto;
}

.ai-section {
    text-align: left;
    margin-top: 12px;
}

.ai-label {
    display: block;
    font-family: 'ark-pixel';
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    margin-bottom: 8px;
}

.ai-textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    font-family: 'ark-pixel-cn';
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

.ai-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.ai-button {
    background: #000;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'ark-pixel';
    cursor: pointer;
}

.ai-button:hover {
    opacity: 0.9;
}

.ai-hint {
    display: block;
    margin-top: 8px;
    color: #666;
    font-family: 'ark-pixel-cn';
    font-size: clamp(0.8rem, 1vw, 0.9rem);
}

.ai-duration-control {
    margin: 20px 0;
}

.duration-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

.duration-slider {
    flex: 1;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.duration-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.duration-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #007bff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.duration-value {
    font-family: 'ark-pixel';
    font-weight: bold;
    color: #007bff;
    min-width: 40px;
    text-align: center;
}

.ai-success {
    color: #28a745;
    margin-top: 10px;
    font-size: 14px;
    padding: 8px 12px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    animation: fadeIn 0.3s ease-in;
    font-family: 'ark-pixel-cn';
}

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

/* AI-generated button styling */
.image-button.ai-generated {
    border: 2px solid #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.3);
}

.image-button.ai-generated:hover {
    border-color: #20c997;
    box-shadow: 0 0 15px rgba(32, 201, 151, 0.5);
}

.sidebar2-footer {
    border-top: 1px solid #ddd;
    padding: 12px 20px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.sidebar2-logo {
    height: auto;
    max-width: 45%;
}

.sidebar2-logo.primary {
    max-height: 80px;
}

.sidebar2-logo.secondary {
    max-height: 60px;
}

#toggle-sidebar2 {
    position: absolute;
    top: calc(50% - 13px);
    right: calc(var(--sidebar-width) + 39px);
    padding: 5px 5px;
    cursor: pointer;
    background-color: #000;
    color: white;
    border: none;
    font-weight: 700;
    border-radius: 3px;
    transition: right 0.5s ease-in-out;
    z-index: 99;
}

#toggle-sidebar2.hidden {
    right: 19px;
}

#canvas-container {
    position: absolute;
    top: calc(3% - 4px);
    left: calc(2% - 4px);
    width: 96%;
    height: 94%;
    overflow: hidden;
    border: dashed 4px #000;
}

svg image {
    cursor: pointer;
}

.zoom-button {
    padding: 0 13px;
    position: absolute;
    background-color: #000;
    /* background-color: #007BFF; */
    color: white;
    border: none;
    border-radius: 3px;
    width: 40px;
    height: 40px;
    font-size: 2rem;
    font-family: 'ark-pixel';
    text-align: center;
    line-height: 40px;
    cursor: pointer;
}

#reset-canvas {
    padding: 0 15px;
    position: absolute;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 8px;
    width: 50px;
    height: 50px;
    font-size: 3rem;
    font-family: 'ark-pixel';
    text-align: center;
    line-height: 40px;
    bottom: 20px;
    left: calc(50% - 25px);
    right: auto;
    cursor: pointer;
    z-index: 1001; /* ensure on top of SVG and other elements */
}

#canvas-border {
    fill: none;
    /* stroke: #000;
    stroke-dasharray: 5, 5;
    stroke-width: 5; */
}

line {
    stroke: black;
    stroke-dasharray: 5, 5;
    stroke-width: 2;
}

#park-icon {
    position: absolute;
    top: 0;
    width: var(--location-icon-size);
    height: var(--location-icon-size);
}

#science-icon {
    position: absolute;
    top: 0;
    width: var(--location-icon-size);
    height: var(--location-icon-size);
}

#park-zone {
    position: absolute;
    top: calc(50% - 100px);
    left: calc(50% - 50px);
    font-size: 30px;
    font-family: 'ark-pixel';
    writing-mode: vertical-lr;
}

#science-zone {
    position: absolute;
    top: calc(50% - 100px);
    right: calc(50% - 50px);
    font-size: 30px;
    font-family: 'ark-pixel';
    writing-mode: sideways-lr;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.5;
    }
}