:root {
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --input-border: #e2e8f0;
    --primary: #4f46e5;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
}

[data-theme='dark'] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --input-border: #334155;
    --primary: #818cf8;
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s;
}

.app-container { width: 100%; max-width: 550px; padding: 15px; }

.navigation-bar {
    display: flex;
    justify-content: center;
    background-color: var(--card-bg);
    padding: 10px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.nav-link {
    color: var(--text-sub);
    text-decoration: none;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link.active {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.main-card {
    background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, var(--card-bg) 100%);
    border-radius: 32px;
    padding: 35px;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

.top-left { position: absolute; top: 25px; left: 25px; }
.top-right { position: absolute; top: 25px; right: 25px; }

.control-btn {
    background: var(--bg);
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.control-btn:hover { transform: translateY(-1px); background: var(--input-border); }

.header { text-align: center; margin-bottom: 30px; margin-top: 15px; }
.header h1 { font-size: 1.8rem; color: var(--primary); margin: 0; }

.input-section { margin-bottom: 25px; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
label { font-size: 1.1rem; font-weight: 700; }
.current-val { font-size: 1rem; font-weight: 800; color: var(--primary); background: rgba(79, 70, 229, 0.1); padding: 4px 12px; border-radius: 8px; }

.species-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.species-btn {
    padding: 15px; border: 2px solid var(--input-border); border-radius: 16px;
    text-align: center; cursor: pointer; font-weight: 700; font-size: 1.1rem;
    transition: 0.2s; background: var(--card-bg); color: var(--text-main);
}
.species-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

input[type="number"], select {
    width: 100%; padding: 16px; border: 2px solid var(--input-border);
    border-radius: 16px; font-size: 1.2rem; font-weight: 600;
    background: var(--card-bg); color: var(--text-main); box-sizing: border-box;
}

input[type="range"] { width: 100%; margin-top: 15px; accent-color: var(--primary); }

.hemocytometer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.quadrant-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--card-bg);
    color: var(--text-main);
    box-sizing: border-box;
    text-align: center;
}


.realtime-display {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.realtime-display span {
    color: var(--primary);
    font-size: 1.1rem;
    background: rgba(79, 70, 229, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
}

.dilution-factor-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 25px;
}

.dilution-btn {
    flex: 1;
    background: var(--bg);
    border: 2px solid var(--input-border);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-sub);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dilution-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2); /* Added box-shadow */
}

.dilution-btn:hover {
    transform: translateY(-1px);
    background: var(--input-border);
}

.plate-selector {
    display: flex;
    justify-content: center;
    gap: 10px; /* Reduced gap for better fit */
    margin-top: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.plate-btn {
    flex: 1; /* Allow buttons to grow/shrink */
    max-width: 90px; /* Max width to keep them from getting too big */
    background: var(--card-bg);
    border: 2px solid var(--input-border);
    padding: 15px 5px; /* Adjust padding for text */
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.2s;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    text-align: center;
    white-space: nowrap; /* Prevent text wrapping */
}

.plate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.plate-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
}

.method-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.method-btn {
    flex: 1;
    background: transparent; /* Changed for more contrast when active */
    border: 1px solid var(--input-border); /* Slightly thinner and less prominent */
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-sub);
    font-size: 0.9rem;
    transition: all 0.2s;
}

button.control-btn.method-btn.active {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
    transform: translateY(-2px);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.input-group input {
    flex: 1;
}

.input-with-label {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.input-with-label input {
    flex: 2; /* Takes 2 parts of the available space, making it roughly 2/3 width */
    min-width: 0;
}

.input-unit {
    flex: 1; /* Takes 1 part of the available space, making it roughly 1/3 width */
    flex-shrink: 0; /* Prevent unit from shrinking */
    font-size: 0.9rem;
    color: var(--text-sub);
    white-space: nowrap;
}

.highlight-btn {
    background-color: #a78bfa !important; /* Light purple for emphasis */
    color: white !important;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.4) !important;
}

.protocol-list {
    list-style-type: none;
    padding: 0;
}

.protocol-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--input-border);
}

.protocol-list li:last-child {
    border-bottom: none;
}

.protocol-list li.summary-item {
    font-weight: bold;
    background-color: var(--bg);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

.slider-container {

    display: flex;

    align-items: center;

    gap: 8px; /* Space between min/max labels and the slider */

    margin-top: 5px; /* Add some space above the slider group */

}



.slider-container input[type="range"] {

    flex-grow: 1; /* Make the slider take up available space */

    margin: 0; /* Remove default margin */

}



.slider-min,

.slider-max {

    font-size: 0.9rem;

    color: var(--text-sub);

    min-width: 20px; /* Ensure enough space for numbers */

    text-align: center;

}

#selectedPlateInfo {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-bottom: 20px;
}

.recipe-card-container {
    padding: 0; /* Remove padding as canvas will take full space */
    border: none; /* Remove border as canvas will have its own design */
    text-align: left;
}

#recipeCanvas {
    display: block; /* Remove extra space below canvas */
    width: 100%;
    height: auto;
}

.state-safe { background-color: rgba(5, 150, 105, 0.1); border-color: var(--success); color: var(--success); }
.state-warn { background-color: rgba(217, 119, 6, 0.1); border-color: var(--warning); color: var(--warning); }
.state-error { background-color: rgba(220, 38, 38, 0.1); border-color: var(--danger); color: var(--danger); }

.res-main {
    font-size: 3.5rem; font-weight: 900; letter-spacing: -2px; margin: 10px 0;
    text-align: center;
}
.status-msg {
    font-size: 1.3rem; font-weight: 800; margin-top: 15px;
    text-align: center;
}

.stock-info {
    margin-top: 20px; font-size: 1rem; color: var(--text-sub);
    background: rgba(0,0,0,0.05); padding: 12px; border-radius: 12px; font-weight: 600;
}

.blog-section {
    margin-top: 40px;
    padding: 40px;
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 32px; /* Increased from 24px */
    box-shadow: 0 15px 30px -8px rgba(0, 0, 0, 0.1); /* Enhanced shadow */
}

.blog-section h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 35px;
    font-size: 1.8rem;
}

.blog-section h3 {
    color: var(--primary);
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 15px;
    border-left: none;
    padding-left: 0;
    display: flex;
    align-items: center;
}

.blog-section h3::before {
    content: '➔';
    margin-right: 10px;
    font-size: 1.2rem;
}

.blog-section p {
    line-height: 1.9;
    color: var(--text-sub);
    text-align: justify;
    font-size: 1.05rem;
    word-break: keep-all; /* Helps with word breaks in Korean */
}

.blog-section ul {
    list-style: none;
    padding-left: 0;
    margin-top: 15px;
}

.blog-section li {
    margin-bottom: 12px;
    color: var(--text-sub);
    display: flex;
    align-items: flex-start;
    font-size: 1rem;
    text-align: left;
}

.blog-section li::before {
    content: '✅';
    margin-right: 12px;
    font-size: 0.9rem;
    margin-top: 4px;
}

.blog-section .disclaimer {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--bg);
    border: 1px dashed var(--warning);
    border-radius: 16px;
    font-size: 0.75rem; /* Adjusted for smaller text */
    color: var(--text-sub);
}

.blog-section .disclaimer p {
    margin: 0; /* Ensure no extra margin for the paragraph */
    font-size: 0.8rem; /* Adjusted for smaller text */
}

.blog-section .disclaimer h3 {
    color: var(--warning);
    font-size: 1.2rem;
    margin-top: 0;
}

.blog-section .disclaimer h3::before {
    content: '⚠️';
}


footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-sub);
}

footer a {
    color: var(--text-sub);
    text-decoration: none;
}

footer a:hover {
    color: var(--text-main);
}

/* Responsive Styles */
@media (max-width: 480px) {
    .main-card {
        padding: 25px;
    }
    .blog-section {
        padding: 25px;
    }
    .blog-section h2 {
        font-size: 1.5rem;
    }
    .blog-section h3 {
        font-size: 1.2rem;
    }
    .blog-section p {
        font-size: 0.95rem;
    }
    .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

input:focus::placeholder {
  color: transparent;
}

/* Homepage specific styles */
.hero-section {
    text-align: center;
    margin-bottom: 35px;
}

.hero-section h2 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-main);
    margin: 0;
    text-shadow: 0 2px 15px rgba(0,0,0,0.07);
}

.quick-access-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 35px;
}

.access-card {
    background: var(--bg);
    border-radius: 24px;
    padding: 25px;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid var(--input-border);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
}

.access-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px -5px rgba(79, 70, 229, 0.15);
    border-color: var(--primary);
}

.access-card i {
    font-size: 2.5rem;
    color: var(--primary);
    width: 50px;
    text-align: center;
    transition: transform 0.3s ease;
}

.access-card:hover i {
    transform: scale(1.15);
}

.access-card h3 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
    flex-grow: 1;
}

.access-card span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-sub);
    background-color: var(--input-border);
    padding: 5px 10px;
    border-radius: 8px;
}


.history-placeholder, .safety-tip {
    background: var(--bg);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid var(--input-border);
}

.history-placeholder h3, .safety-tip h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.history-placeholder p, .safety-tip p {
    margin: 0;
    color: var(--text-sub);
    font-size: 0.95rem;
}

.safety-tip {
    background-color: rgba(79, 70, 229, 0.05);
    border-color: rgba(79, 70, 229, 0.2);
}

.safety-tip h3 {
    color: var(--primary);
}

@media (min-width: 500px) {
    .quick-access-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .access-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px 15px;
    }
    .access-card i {
        font-size: 2.2rem;
    }
    .access-card h3 {
        font-size: 1rem;
        height: 40px; /* To align heights */
    }
}

/* About Page Specific Styles */
.about-page .header {
    text-align: center;
    margin-bottom: 40px;
}
.about-page .header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}
.about-page .header p {
    font-size: 1.1rem;
    color: var(--text-sub);
}

.about-section {
    margin-bottom: 40px;
}

.about-section h2 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 30px;
    border-bottom: 2px solid var(--input-border);
    padding-bottom: 15px;
}

.core-pillars-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.pillar-card {
    background: var(--bg);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
}

.pillar-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.pillar-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.pillar-card p {
    margin: 0;
    color: var(--text-sub);
    font-size: 0.95rem;
    line-height: 1.6;
}

.why-safelab-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.feature-point {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.feature-icon {
    font-size: 2rem;
    color: var(--primary);
    width: 40px;
    text-align: center;
    padding-top: 5px;
}

.feature-text h3 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

.feature-text p {
    margin: 0;
    color: var(--text-sub);
    line-height: 1.7;
}

.data-basis-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--input-border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-sub);
}

.why-safelab-container .feature-point {
    background: var(--bg);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.3s ease;
}

.why-safelab-container .feature-point:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.1);
}

.data-basis-section .warning-text {
    margin-top: 15px;
    font-weight: 600;
    color: var(--warning);
    background-color: rgba(217, 119, 6, 0.05);
    padding: 10px;
    border-radius: 8px;
}