:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 25px;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.card-header h2 {
    font-size: 1.2rem;
    color: #2c3e50;
}

.card-header .icon {
    font-size: 1.5rem;
}

.card-body p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
    height: 40px; /* fixed height for alignment */
}

.result-area {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
}

.result-area .label {
    display: block;
    font-size: 0.9rem;
    color: #95a5a6;
    margin-bottom: 5px;
}

.result-area .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.result-area .unit {
    font-size: 1rem;
    color: #7f8c8d;
}

.result-detail {
    text-align: center;
    font-size: 0.8rem;
    color: #95a5a6;
    margin-bottom: 15px;
    height: 20px;
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-item.highlight .value {
    color: #9b59b6;
}

.stat-item .label {
    display: block;
    font-size: 0.8rem;
    color: #95a5a6;
    margin-bottom: 2px;
}

.stat-item .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-item .unit {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.canvas-container {
    height: 200px;
    background: #000;
    border-radius: 6px;
    margin-bottom: 15px;
    overflow: hidden;
    position: relative;
    display: none;
}

.canvas-container.active {
    display: block;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
    flex: 1;
}

.btn-sm.secondary {
    background-color: #95a5a6;
}

.btn-sm.secondary:hover {
    background-color: #7f8c8d;
}

/* Progress Bar */
.progress-bar-container {
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--secondary-color);
    width: 0%;
    transition: width 0.3s;
}

/* Stats Grid 3 cols */
.stats-grid.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.info-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.info-item .label {
    display: block;
    font-size: 0.8rem;
    color: #95a5a6;
    margin-bottom: 5px;
}

.info-item .value {
    font-weight: bold;
    color: #34495e;
}

.info-item .value.small {
    font-size: 0.8rem;
    font-weight: normal;
    word-break: break-all;
}

.controls-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.controls-row button {
    flex: 1;
}

.btn-secondary {
    background-color: #34495e;
}

.btn-secondary.active {
    background-color: #2c3e50;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.overlay-msg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 10;
}

footer {
    text-align: center;
    color: #95a5a6;
    font-size: 0.8rem;
    margin-top: 20px;
}
