/* Biến nội bộ */
.mathdate-neo-wrapper {
    --bg-white: #ffffff;
    --border-ink: 3px solid #111111;
    --shadow-solid: 6px 6px 0px #111111;
    --shadow-push: 2px 2px 0px #111111;
    
    /* Bảng màu Neon */
    --clr-add: #8ac926;      /* Xanh Cộng */
    --clr-sub: #ff595e;      /* Đỏ Trừ */
    --clr-base: #4cc9f0;     /* Xanh mốc */
    --clr-bg: #f8f9fa;

    max-width: 700px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, sans-serif;
    color: #111111;
    background: var(--clr-bg);
    padding: 25px;
    border: var(--border-ink);
    border-radius: 16px;
    box-shadow: 10px 10px 0px #111;
}

.mathdate-neo-wrapper * { box-sizing: border-box; }

.mathdate-neo-header { background: var(--clr-base); color: #111; border: var(--border-ink); box-shadow: var(--shadow-solid); padding: 20px; border-radius: 12px; text-align: center; margin-bottom: 25px; }
.mathdate-neo-header h2 { margin: 0 0 10px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase;}
.mathdate-neo-header p { margin: 0; font-weight: 800; font-size: 0.95rem; }

.mathdate-neo-form { display: flex; flex-direction: column; gap: 15px; }
.mathdate-group { display: flex; flex-direction: column; gap: 8px; }
.mathdate-group label { font-weight: 900; font-size: 1.05rem; color: #111; text-transform: uppercase;}

/* Input Date */
.neo-input-date { width: 100%; padding: 15px 20px; font-size: 1.4rem; font-weight: 900; font-family: monospace, system-ui; color: #111; border: var(--border-ink); border-radius: 12px; background: #fff; box-shadow: 4px 4px 0px #111; outline: none; cursor: pointer; transition: all 0.1s;}
.neo-input-date:focus { background: #e0fbfc; transform: translate(-2px, -2px); box-shadow: 6px 6px 0px #111;}

/* Quick Tags */
.quick-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.q-tag { padding: 6px 12px; border: 2px solid #111; border-radius: 20px; font-size: 0.85rem; font-weight: 800; cursor: pointer; background: #fff; box-shadow: 2px 2px 0px #111; color: #111; transition: transform 0.1s;}
.q-tag:hover { background: #111; color: #fff;}
.q-tag:active { box-shadow: 0px 0px 0px #111; transform: translate(2px,2px); }

/* Toggle Mode (Cộng/Trừ) */
.mathdate-mode-toggle { display: flex; gap: 15px; }
.radio-mode { flex: 1; cursor: pointer; }
.radio-mode input { display: none; }
.radio-mode .neo-content { display: block; text-align: center; padding: 15px; font-weight: 900; border: 3px solid #111; border-radius: 12px; background: #e9ecef; box-shadow: 4px 4px 0px #111; transition: all 0.15s; font-size: 1.1rem;}
.radio-mode input:checked + .mode-add { background: var(--clr-add); color: #111; box-shadow: 1px 1px 0px #111; transform: translate(3px, 3px); }
.radio-mode input:checked + .mode-sub { background: var(--clr-sub); color: #fff; box-shadow: 1px 1px 0px #111; transform: translate(3px, 3px); }

/* Grid nhập số lượng */
.units-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.unit-box { display: flex; flex-direction: column; align-items: center; background: #fff; border: 3px solid #111; border-radius: 12px; padding: 10px; box-shadow: 3px 3px 0px #111;}
.unit-box input { width: 100%; border: none; font-size: 1.8rem; font-weight: 900; text-align: center; color: #111; outline: none; background: transparent; padding: 5px 0;}
.unit-box input::placeholder { color: #ccc; }
.unit-box span { font-weight: 900; font-size: 0.95rem; text-transform: uppercase; margin-top: 5px; color: #555; border-top: 2px dashed #ccc; width: 100%; text-align: center; padding-top: 5px;}
.unit-box:focus-within { background: #fff3cc; }

/* Nút Submit */
.mathdate-neo-btn { padding: 18px; font-size: 1.2rem; font-weight: 900; background: #111; color: #fff; border: var(--border-ink); border-radius: 12px; box-shadow: 5px 5px 0px var(--clr-base); cursor: pointer; text-transform: uppercase; transition: all 0.1s; margin-top: 15px; letter-spacing: 1px; width: 100%;}
.mathdate-neo-btn:active { box-shadow: 2px 2px 0px var(--clr-base); transform: translate(3px, 3px); }

/* KẾT QUẢ */
.mathdate-neo-result { margin-top: 30px; padding: 25px; background: var(--clr-add); border: var(--border-ink); border-radius: 12px; box-shadow: var(--shadow-solid); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 15px; transition: background 0.3s;}
.mathdate-neo-result.is-sub { background: var(--clr-sub); } /* Đổi màu nền nếu là phép trừ */
.mathdate-neo-result.is-sub h3, .mathdate-neo-result.is-sub .result-sub { color: #fff; }

.mathdate-neo-result.active { display: flex !important; animation: popResult 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

.mathdate-neo-result h3 { margin: 0; font-size: 1.6rem; font-weight: 900; text-transform: uppercase;}
.result-sub { font-weight: 800; font-size: 1.1rem; margin: 0;}
.winner-box { background: #fff; padding: 20px; border: 4px dashed #111; border-radius: 12px; width: 100%; display: flex; flex-direction: column; gap: 10px;}
.day-of-week { font-size: 1.5rem; font-weight: 900; color: #555; text-transform: uppercase;}
.winner-box .val-text { font-size: 3rem; font-weight: 900; color: #111; font-family: monospace, system-ui; line-height: 1;}

.relative-text { margin: 0; font-weight: 900; font-size: 1.05rem; background: rgba(255,255,255,0.8); display: inline-block; padding: 8px 20px; border-radius: 20px; border: 2px solid #111; color: #111;}

@keyframes popResult { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
    .units-grid { grid-template-columns: repeat(2, 1fr); }
    .winner-box .val-text { font-size: 2.2rem; }
}