body {
    font-family: Arial, sans-serif;
    margin: 2em;
    background: #181a20;
    color: #e3e3e3;
}

h1 {
    color: #f8c300;
    text-align: center;
    letter-spacing: 1px;
    font-size: 2.2em;
    margin-bottom: 0.5em;
}

.form-container {
    background: #23252b;
    padding: 2em;
    border-radius: 12px;
    max-width: 420px;
    margin: 1.5em auto 2em auto;
    box-shadow: 0 2px 12px #0006;
}

label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: bold;
}

input[type="text"] {
    width: 100%;
    padding: 0.5em;
    border-radius: 5px;
    border: 1px solid #444;
    margin-bottom: 1em;
    background: #181a20;
    color: #e3e3e3;
}

button {
    background: #f8c300;
    color: #181a20;
    border: none;
    padding: 0.7em 1.5em;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px #0002;
}

    button:hover {
        background: #ffd700;
        box-shadow: 0 4px 16px #0004;
        transform: translateY(-2px) scale(1.04);
    }

#dashboard {
    display: flex;
    flex-direction: row;
    gap: 2.5em;
    justify-content: center;
    align-items: flex-start;
    margin: 2em auto 0 auto;
    max-width: 1400px;
    min-height: 600px;
}

#leftCol {
    flex: 0 0 340px;
    min-width: 300px;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 2.5em; /* Increase gap between children */
}

#farmingScoreCard {
    background: linear-gradient(135deg,#23252b 60%,#2e2e4d 100%);
    border-radius: 16px;
    box-shadow: 0 4px 24px #0008;
    padding: 1.5em 1em 1em 1em;
    margin-bottom: 2.5em; /* More space below */
}

#clearsList {
    background: #23252b;
    border-radius: 14px;
    box-shadow: 0 2px 12px #0007;
    padding: 1.2em 1em 1em 1em;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.7em;
    min-width: 0;
    max-width: 100%;
    align-items: stretch;
    justify-items: stretch;
    max-height: 55vh;
    overflow-y: auto;
    margin-top: 2.5em; /* More space above */
}

    #clearsList > div {
        break-inside: avoid;
    }

.clear-card {
    position: relative;
    background: linear-gradient(120deg,#181a20 60%,#23252b 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px #0006;
    padding: 0.7em 1.2em;
    min-width: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    font-size: 1.08em;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    transition: transform 0.18s, box-shadow 0.18s;
}

.clear-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    opacity: 0.18;
    background-size: cover;
    background-position: center;
    filter: blur(0.5px) brightness(0.9) saturate(1.2);
    transition: opacity 0.2s;
}

.clear-card:hover {
    transform: scale(1.045) translateY(-2px);
    box-shadow: 0 6px 24px #000a;
}

.clear-card .clear-name,
.clear-card .clear-value {
    position: relative;
    z-index: 1;
}

.clear-card .clear-name {
    color: #f8c300;
    font-weight: bold;
    margin-bottom: 0.2em;
}

.clear-card .clear-value {
    color: #4caf50;
    font-size: 1.2em;
    font-weight: bold;
}

.clear-card .baseline-value {
    color: #aaa;
    font-size: 0.98em;
    font-weight: normal;
    margin-left: 0.5em;
}

#rightCol {
    flex: 1 1 600px;
    min-width: 350px;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 2em;
}

.chart-container {
    background: #181a20;
    border-radius: 12px;
    box-shadow: 0 2px 12px #0007;
    margin: 0 auto 0 auto;
    padding: 1.5em 1em 1em 1em;
    max-width: 700px;
    position: relative;
}

.expand-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #23252b;
    color: #f8c300;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.3em 0.9em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 2;
}

    .expand-btn:hover {
        background: #f8c300;
        color: #23252b;
    }
/* Modal for expanded chart */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(24,26,32,0.92);
    align-items: center;
    justify-content: center;
}

    .modal.active {
        display: flex;
    }

.modal-content {
    background: #23252b;
    border-radius: 16px;
    box-shadow: 0 4px 32px #000a;
    padding: 2em 2em 1.5em 2em;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-close {
    position: absolute;
    top: 1.5em;
    right: 2em;
    background: #23252b;
    color: #f8c300;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.3em 1.2em;
    font-size: 1.2em;
    cursor: pointer;
    z-index: 2;
}

    .modal-close:hover {
        background: #f8c300;
        color: #23252b;
    }

#apiStatus {
    position: fixed;
    right: 2vw;
    bottom: 2vw;
    min-width: 220px;
    background: #23252b;
    color: #f8c300;
    border-radius: 10px;
    box-shadow: 0 2px 12px #0007;
    padding: 1em 1.5em;
    z-index: 1001;
    text-align: right;
    font-size: 1em;
    opacity: 0.95;
}

@media (max-width: 700px) {
    body {
        margin: 0.5em;
        font-size: 1em;
    }

    h1 {
        font-size: 1.3em;
        margin-bottom: 0.3em;
    }

    .form-container {
        padding: 1em 0.3em;
        max-width: 100vw;
        box-sizing: border-box;
    }

    label {
        font-size: 1em;
    }

    input[type="text"] {
        font-size: 1em;
        padding: 0.7em 0.5em;
        width: 100%;
        min-width: 0;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: auto;
        word-break: break-all;
    }

    button {
        width: 100%;
        box-sizing: border-box;
    }

    #dashboard {
        flex-direction: column;
        gap: 1em;
        min-height: unset;
        max-width: 100vw;
    }

    #leftCol {
        display: flex;
        flex-direction: column;
        gap: 1.5em;
        max-width: 100vw;
        min-width: 0;
    }

    #farmingScoreCard {
        margin-bottom: 1.5em !important;
    }

    #clearsList {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        max-height: unset;
    }

    #leftCol, #rightCol {
        max-width: 100vw;
        min-width: 0;
        gap: 1em;
    }

    #farmingScoreCard, #clearsList, .about-section, .chart-container {
        padding: 0.7em 0.5em 0.5em 0.5em;
        font-size: 0.98em;
    }

    #clearsList {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.4em;
        max-height: 40vh;
        overflow-y: auto;
        margin-top: 0 !important;
    }

    .clear-card {
        font-size: 0.98em;
        padding: 0.5em 0.5em;
    }

    .chart-container {
        max-width: 100vw;
        width: 100vw;
        min-width: 0;
        overflow-x: auto;
        padding: 0.7em 0.1em 0.7em 0.1em;
        box-sizing: border-box;
    }

        .chart-container canvas {
            width: 600px !important;
            min-width: 500px;
            max-width: 100vw;
            height: auto !important;
            display: block;
        }

    .about-section {
        max-width: 98vw;
    }

    .expand-btn {
        top: 8px;
        right: 8px;
        font-size: 0.95em;
        padding: 0.2em 0.7em;
    }

    #apiStatus {
        font-size: 0.9em;
        min-width: 90px;
        padding: 0.5em 0.5em;
    }

    /* Modal responsive styles */
    .modal-content {
        padding: 0.7em 0.2em 0.5em 0.2em;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 8px;
        box-sizing: border-box;
    }

        .modal-content canvas {
            width: 600px !important;
            min-width: 500px;
            max-width: 100vw;
            height: auto !important;
            display: block;
        }
}

@media (max-width: 500px) {
    h1 {
        font-size: 1.05em;
    }

    .form-container {
        padding: 0.5em 0.1em;
    }

    input[type="text"] {
        font-size: 0.98em;
        padding: 0.6em 0.3em;
    }

    #dashboard {
        gap: 0.5em;
    }

    #farmingScoreCard, #clearsList, .about-section, .chart-container {
        font-size: 0.93em;
    }

    #leftCol {
        gap: 1em;
    }

    #farmingScoreCard {
        margin-bottom: 1em !important;
    }

    #clearsList {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        max-height: unset;
    }

    .clear-card {
        font-size: 0.93em;
    }

    .chart-container canvas {
        width: 400px !important;
        min-width: 350px;
        max-width: 100vw;
    }

    /* Modal responsive styles */
    .modal-content canvas {
        width: 400px !important;
        min-width: 350px;
        max-width: 100vw;
    }
}
