/* ------------- 變數系統 ------------- */
:root {
  --bg: #F2F2F2;
  --surface: #FFFFFF;
  --ink: #111111;       
  --sub-ink: #666666;
  --neon: #00CC44;      
  --alert: #FF2A2A;     
  --warn: #FFAA00;      
  --border: 2px solid #111; 
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', 'Noto Sans TC', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 0 0 60px 0;
  overflow-x: hidden;
  font-size: 16px; 
}

/* ------------- 跑馬燈 Marquee ------------- */
.marquee-container {
  background: var(--ink);
  color: var(--surface);
  overflow: hidden;
  white-space: nowrap;
  padding: 10px 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  border-bottom: var(--border);
}
.marquee-content {
  display: inline-block;
  animation: scroll 40s linear infinite;
}
@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ------------- Header 設計 ------------- */
.header {
  padding: 25px 20px 35px 20px;
  border-bottom: var(--border);
  background: var(--bg);
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--sub-ink);
  letter-spacing: 0.5px;
}
.version-tag {
  background: #ddd;
  padding: 3px 8px;
  border-radius: 4px;
  color: #000;
  font-weight: 700;
}

.glitch-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -1px;
  position: relative;
  display: inline-block;
  font-family: var(--sans);
  word-break: keep-all;
}

.cursor-box {
  display: inline-block;
  width: 18px; height: 18px;     
  background: var(--neon);
  margin-left: 8px;
  border-radius: 50%; 
  animation: blink 1s step-end infinite;
  vertical-align: middle; 
}
@keyframes blink { 50% { opacity: 0; } }

.sub-info-bar {
  display: flex; align-items: center; margin-top: 18px; gap: 12px;
}
.deco-line {
  flex: 1; height: 2px;
  background: repeating-linear-gradient(90deg, var(--ink), var(--ink) 4px, transparent 4px, transparent 8px);
}
.sub-info-bar .code {
  font-family: var(--mono); font-size: 1rem; color: var(--ink); font-weight: 700;
}

/* ------------- 容器 ------------- */
.main-container {
  padding: 20px; width: 100%; max-width: 100%; margin: 0 auto;
}
@media (min-width: 1200px) { .main-container { max-width: 1000px; } }

/* ------------- Tabs ------------- */
.nav-pills {
  display: flex; gap: 12px; margin-bottom: 35px;
}
.nav-item {
  flex: 1; text-align: center; padding: 16px 0;
  border: 2px solid #ccc; font-weight: 700; font-size: 1.1rem;
  cursor: pointer; color: #999; background: #fff; transition: 0.2s; white-space: nowrap;
}
.nav-item.active {
  border-color: var(--ink); background: var(--ink); color: var(--surface);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
}

/* ------------- 卡片 ------------- */
.card {
  background: var(--surface); border: var(--border);
  padding: 25px; margin-bottom: 35px;
  box-shadow: 6px 6px 0px rgba(0,0,0,0.1); width: 100%;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 25px; border-bottom: 2px dashed #ddd; padding-bottom: 15px;
}
.section-title {
  font-family: var(--mono); font-weight: 700; font-size: 1rem;
  color: var(--sub-ink); text-transform: uppercase;
}
.ph-icon { font-size: 1.8rem; color: var(--ink); }

/* ------------- 輸入元件 ------------- */
label {
  display: block; font-weight: 900; font-size: 1.25rem;
  margin-bottom: 12px; color: var(--ink);
}
.sub-label {
  font-size: 1rem; color: #666; margin-bottom: 12px;
  display: block; font-weight: 400; line-height: 1.5;
}

input[type="number"], input[type="date"], input[type="text"], select {
  width: 100%; background: #FAFAFA;
  border: none; border-bottom: 3px solid #ccc; border-radius: 0;
  padding: 18px 12px; font-family: var(--mono); font-size: 1.3rem;
  color: var(--ink); margin-bottom: 30px; appearance: none;
  font-weight: 500; transition: 0.2s;
}
input:focus, select:focus {
  outline: none; border-bottom-color: var(--ink); background: #fff;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }

/* ------------- Radio Button Group (日期模式) ------------- */
.radio-group { display: flex; gap: 15px; margin-bottom: 25px; }
.radio-btn {
    flex: 1; text-align: center; padding: 15px;
    border: 2px solid #ccc; font-weight: 700; cursor: pointer;
    transition: 0.2s; font-size: 1rem; color: #999;
}
.radio-btn.active {
    border-color: var(--ink); background: #000; color: #fff;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

/* ------------- 單日多選列表 ------------- */
.single-date-row {
    display: flex; align-items: flex-start; gap: 15px;
    padding: 15px; border: 1px solid #eee; margin-bottom: 15px; background: #fafafa;
    position: relative;
}
.single-date-row .grid { margin-bottom: 0; gap: 15px; flex: 1; }
.single-date-row input { margin-bottom: 0; font-size: 1.1rem; padding: 12px; }
.single-date-row label { font-size: 0.9rem; margin-bottom: 5px; }

.btn-remove {
    background: #fff; border: 2px solid #ccc; color: #999;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.2rem; transition: 0.2s; margin-top: 28px; /* Align with inputs */
}
.btn-remove:hover { border-color: var(--alert); color: var(--alert); }

.btn-add {
    width: 100%; padding: 15px; border: 2px dashed #aaa;
    background: transparent; color: #666; font-weight: 700; font-size: 1rem;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-add:hover { border-color: var(--ink); color: var(--ink); background: #fff; }

/* ------------- Checkbox ------------- */
.toggle-block {
  display: flex; align-items: center; padding: 20px;
  border: 2px solid #eee; margin-bottom: 18px; cursor: pointer;
  transition: 0.1s; background: #fff;
}
.toggle-block:active { transform: scale(0.99); }
.toggle-block.checked {
  border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); background: #fff;
}
.toggle-square {
  width: 28px; height: 28px; border: 2px solid #999;
  margin-right: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.toggle-block.checked .toggle-square {
  background: var(--ink); border-color: var(--ink);
}
.toggle-square i { color: #fff; font-size: 18px; display: none; font-weight: bold; }
.toggle-block.checked .toggle-square i { display: block; }
.toggle-text { font-size: 1.15rem; font-weight: 700; line-height: 1.5; flex: 1; }
.tag {
  font-family: var(--mono); font-size: 0.85rem; background: #000; color: #fff; 
  padding: 3px 8px; margin-left: 8px; vertical-align: middle; display: inline-block;
}

/* ------------- Validator Box ------------- */
.validator-box {
  margin-top: 15px; padding: 25px; background: #111; color: #fff;
  font-family: var(--mono); font-size: 1rem; border-left: 8px solid #555;
}
.validator-box.pass { border-left-color: var(--neon); }
.validator-box.fail { border-left-color: var(--alert); }
.validator-box.warn { border-left-color: var(--warn); }
.v-status {
  font-weight: 900; font-size: 1.1rem; margin-bottom: 10px; display: block; text-transform: uppercase; letter-spacing: 1px;
}
.pass .v-status { color: var(--neon); }
.fail .v-status { color: var(--alert); }
.warn .v-status { color: var(--warn); }
.v-msg span { display: block; margin-bottom: 6px; color: #ccc; line-height: 1.5; }
.v-msg span::before { content: "> "; opacity: 0.5; }

/* ------------- Link Block ------------- */
.info-link { text-decoration: none; color: inherit; display: block; }
.link-block {
  display: flex; align-items: center; padding: 22px; border: 2px solid #eee; 
  margin-bottom: 18px; background: #fff; transition: 0.2s;
}
.link-block:active { background: #f0f0f0; border-color: #999; }
.link-icon { font-size: 2rem; margin-right: 18px; flex-shrink: 0; color: var(--ink); }
.link-content { flex: 1; }
.link-title { font-size: 1.2rem; font-weight: 900; display: block; margin-bottom: 6px; }
.link-desc { font-size: 1rem; color: #666; font-family: var(--mono); display: block; line-height: 1.4;}
.link-arrow { font-family: var(--mono); font-weight: 900; margin-left: 10px; font-size: 1.4rem; }

/* ------------- iOS Tutorial ------------- */
.ios-tutorial {
  background: #EAEAEA; padding: 25px; margin-top: 35px; border-radius: 10px; font-size: 1rem;
}
.ios-title {
  font-weight: 900; font-size: 1.1rem; margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.step-row { display: flex; align-items: flex-start; margin-bottom: 15px; }
.step-num {
  background: var(--ink); color: #fff; width: 24px; height: 24px; 
  border-radius: 50%; text-align: center; line-height: 24px; 
  font-size: 0.85rem; font-weight: bold; margin-right: 12px; flex-shrink: 0; font-family: var(--mono);
}
.step-text { color: #333; line-height: 1.5; }

.footer-text {
    font-size: 0.9rem; color: #888; line-height: 1.6; margin-top: 40px; 
    border-top: 2px solid #ddd; padding-top: 25px; font-weight: 500;
}
.footer-copy {
    font-family: var(--mono); font-size: 0.8rem; color: #aaa; margin-top: 12px; display: block;
}

.hidden { display: none !important; }

/* ========================================= */
/* PIXEL HELPER (CSS BOT)           */
/* ========================================= */

#pixel-helper {
    position: fixed;
    z-index: 9999;
    pointer-events: none; 
    display: flex;
    align-items: center;
    top: 50%;
    left: 50%;
    transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1), 
                top 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

#pixel-helper.active {
    opacity: 1;
}

/* 機器人本體 */
.bot-container {
    position: relative;
    width: 60px;
    height: 60px;
}

.bot-body {
    width: 100%;
    height: 100%;
    background: #111;
    position: relative;
    border-radius: 8px; /* 稍微圓角 */
    animation: float 2s infinite ease-in-out;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
}

.bot-face {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 24px;
}

.bot-eye {
    width: 8px;
    height: 8px;
    background: #00CC44; /* Neon Green Eyes */
    position: absolute;
    top: 0;
    transition: 0.2s;
}

.bot-eye.left { left: 0; }
.bot-eye.right { right: 0; }

.bot-mouth {
    width: 100%;
    height: 4px;
    background: #00CC44;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: 0.2s;
}

.bot-shadow {
    width: 40px;
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    animation: shadow-scale 2s infinite ease-in-out;
}

/* 對話氣泡 */
#helper-bubble {
    background: #000;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 15px;
    position: relative;
    opacity: 0;
    transition: 0.2s;
    white-space: nowrap;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

#helper-bubble::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px 0 8px 8px;
    border-style: solid;
    border-color: transparent transparent transparent #000;
}

#pixel-helper.active #helper-bubble {
    opacity: 1;
    transform: translateX(0);
}

/* --- ANIMATIONS & STATES --- */

/* 1. Normal Float */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes shadow-scale {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.5; }
    50% { transform: translateX(-50%) scale(0.8); opacity: 0.3; }
}

/* 2. Typing (Jump) */
.helper-typing .bot-body {
    animation: jump 0.3s infinite alternate !important;
    background: #333;
}
@keyframes jump {
    from { transform: translateY(0); }
    to { transform: translateY(-15px); }
}

/* 3. Success (Spin) */
.helper-success .bot-body {
    background: #00CC44;
    animation: spin 0.6s ease-in-out;
}
.helper-success .bot-eye, .helper-success .bot-mouth { background: #fff; }
@keyframes spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* 4. Error (Shake) */
.helper-error .bot-body {
    background: #FF2A2A;
    animation: shake 0.4s infinite;
}
.helper-error .bot-eye, .helper-error .bot-mouth { background: #fff; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 5. Idle (Sleep) */
.helper-idle .bot-body {
    opacity: 0.6;
    animation: sleep 3s infinite ease-in-out;
}
.helper-idle .bot-eye { height: 2px; top: 10px; } /* 閉眼 */
@keyframes sleep {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.95) translateY(5px); }
}