/* Variables */
:root {
    --bg-color: #0f172a;
    --text-main: #f1f5f9;
    --text-sub: #94a3b8;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #4ade80;
    --danger: #ef4444;
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    overflow: hidden; /* 3D Canvas covers everything */
    height: 100vh;
    width: 100vw;
}

/* Canvas Layer */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

/* UI Layer */
#ui-layer {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to 3D */
}

/* Enable pointer events on interactive elements */
button, input, dialog, .panel {
    pointer-events: auto;
}

/* Header */
.app-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}
.subtitle {
    font-size: 0.8rem;
    color: var(--text-sub);
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: #0f172a;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 15px var(--accent-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-sub);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
}

/* Panel (Details) */
.panel {
    position: absolute;
    top: 80px;
    right: 20px;
    bottom: 20px;
    width: 320px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.panel.hidden {
    transform: translateX(20px);
    opacity: 0;
    pointer-events: none;
}

.close-btn {
    align-self: flex-end;
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 1.5rem;
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.05);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}
.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-sub);
}
.stat-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

/* Check Button */
.btn-check {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #38bdf8, #3b82f6);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-check.checked {
    background: var(--success);
    cursor: default;
}

.check-status {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 8px;
}

/* History Chart (Simple visualizer) */
.history-chart {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.history-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}
.history-dot.active {
    background: var(--success);
    box-shadow: 0 0 5px var(--success);
}

/* Modal */
dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1e293b;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
dialog::backdrop {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(2px);
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-sub);
}
.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--text-sub);
    background: rgba(255,255,255,0.05);
    color: white;
}
.form-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast */
.toast {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: #064e3b;
    padding: 10px 24px;
    border-radius: 20px;
    font-weight: 600;
    transition: opacity 0.3s;
}
.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--danger);
    text-decoration: underline;
    cursor: pointer;
    margin-top: 20px;
    font-size: 0.8rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .panel {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(0);
    }
    .panel.hidden {
        transform: translateY(100%);
    }
}