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

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-6 {
    gap: 1.5rem;
}

.space-y-2 > * + * {
    margin-top: 0.5rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.text-4xl {
    font-size: 2.25rem;
}

.font-bold {
    font-weight: bold;
}

.text-right {
    text-align: right;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

@media (min-width: 768px) {
    .md\\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .xl\\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .xl\\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
}

.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 24px;
}

.data-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

.data-card.gps { border-left: 4px solid #3b82f6; }
.data-card.imu { border-left: 4px solid #22c55e; }
.data-card.quaternion { border-left: 4px solid #a855f7; }
.data-card.magnetic { border-left: 4px solid #ef4444; }
.data-card.comparison { border-left: 4px solid #06b6d4; }

.value-display {
    font-family: monospace;
    font-size: 1.125rem;
    font-weight: bold;
    color: #e2e8f0;
}

.label-text {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.map-container {
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    background: rgba(15, 23, 42, 0.5);
}

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 16px;
}

#orientation-3d {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.metric-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 16px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #60a5fa;
}

.metric-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: #94a3b8;
}

.status-indicator {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
}

.status-ok { 
    background: #22c55e;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.status-fail { 
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

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

.vector-display {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.vector-component {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.vector-component .label {
    font-size: 0.75rem;
    color: #94a3b8;
}

.vector-component .value {
    font-size: 1.125rem;
    font-weight: bold;
    color: #e2e8f0;
}

.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: white;
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.home-button:hover {
    transform: scale(1.05);
}

.home-button svg {
    width: 20px;
    height: 20px;
}

.connection-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connected {
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid #22c55e;
    color: #22c55e;
}

.disconnected {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.section-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
}

.section-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gps-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.gps-source {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 16px;
}

.gps-source.legacy {
    border-left: 4px solid #f59e0b;
}

.gps-source.xsens {
    border-left: 4px solid #3b82f6;
}

.speed-gauge {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    position: relative;
}

.speed-gauge svg {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(148, 163, 184, 0.2);
    stroke-width: 20;
}

.gauge-fill {
    fill: none;
    stroke-width: 20;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-speed {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;
}

.gauge-unit {
    font-size: 1rem;
    color: #94a3b8;
}

.diff-indicator {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 8px;
}

.diff-good {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.diff-warn {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.diff-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.ripple-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #60a5fa;
    position: relative;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.8);
}

.ripple-marker::before,
.ripple-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 2px solid #60a5fa;
    transform: translate(-50%, -50%);
    animation: ripple 2s infinite;
}

.ripple-marker::after {
    animation-delay: 1s;
}

@keyframes ripple {
    0% { width: 0; height: 0; opacity: 1; }
    100% { width: 60px; height: 60px; opacity: 0; }
}

.gps-dashboard {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 column */
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(51, 65, 85, 0.5);
}

@media (min-width: 1024px) {
    .gps-dashboard {
        grid-template-columns: 1fr 1fr; /* Desktop: 2 equal columns */
    }
}

.source-panel {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-label {
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-value {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #f8fafc;
    font-weight: 600;
}

.speed-display {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed rgba(255, 255, 255, 0.1);
}