:root {
    --accent: #6d28d9;
    --accent-2: #0891b2;
    --accent-light: #ede9fe;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    overflow-x: hidden;
}

/* NAVBAR */
.navbar {
    background: rgba(248,250,252,0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.navbar-brand { color: var(--accent) !important; font-weight: 900; font-size: 1.3rem; }
.nav-link { color: var(--text-muted) !important; font-weight: 500; transition: color .2s; }
.nav-link:hover { color: var(--accent) !important; }
.lang-btn {
    background: transparent; border: 1.5px solid var(--border); color: var(--text-muted);
    border-radius: 999px; padding: 4px 14px; font-size: .8rem; cursor: pointer;
    transition: all .2s; font-weight: 600;
}
.lang-btn:hover, .lang-btn.active {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-light);
}

/* HERO */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #fdf4ff 50%, #f0fffe 100%);
    position: relative;
    overflow: hidden;
}
#hero::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(109,40,217,0.12) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
}
#hero::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(8,145,178,0.1) 0%, transparent 70%);
    bottom: -50px; left: -50px;
    border-radius: 50%;
}
#hero .content { position: relative; z-index: 1; }
.badge-pill {
    background: var(--accent-light); border: 1px solid rgba(109,40,217,0.3);
    color: var(--accent); border-radius: 999px; padding: 6px 18px; font-size: .82rem;
    display: inline-block; margin-bottom: 1.5rem; font-weight: 600;
}
.hero-title {
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    font-weight: 900;
    line-height: 1.05;
    color: var(--text);
}
.hero-title .accent-word {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub { font-size: 1.1rem; color: var(--text-muted); max-width: 560px; margin: 1.5rem auto 2.5rem; line-height: 1.8; }
.btn-primary-custom {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; border: none; border-radius: 999px; padding: 13px 34px; font-weight: 700;
    font-size: 1rem; transition: transform .2s, box-shadow .2s; text-decoration: none; display: inline-block;
}
.btn-primary-custom:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(109,40,217,0.35); color: #fff; }
.btn-outline-custom {
    background: transparent; color: var(--accent); border: 2px solid var(--accent);
    border-radius: 999px; padding: 11px 32px; font-weight: 700; font-size: 1rem;
    transition: all .2s; text-decoration: none; display: inline-block;
}
.btn-outline-custom:hover { background: var(--accent); color: #fff; transform: translateY(-3px); }

/* STATS */
#stats { background: #fff; padding: 64px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat-card { text-align: center; padding: 24px; }
.stat-number {
    font-size: 3.2rem; font-weight: 900;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-label { color: var(--text-muted); font-size: .95rem; margin-top: .4rem; font-weight: 500; }

/* SKILLS */
#skills { background: var(--bg); }
.section-badge {
    display: inline-block; background: var(--accent-light); border: 1px solid rgba(109,40,217,0.25);
    color: var(--accent); border-radius: 999px; padding: 4px 14px; font-size: .75rem;
    letter-spacing: .08em; text-transform: uppercase; margin-bottom: .75rem; font-weight: 600;
}
.section-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; color: var(--text); }
.skill-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1.5px solid var(--border); border-radius: 12px;
    padding: 10px 20px; margin: 5px; font-size: .9rem; color: var(--text);
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
.skill-chip:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 4px 16px rgba(109,40,217,0.12); }
.skill-chip i { font-size: 1.2rem; color: var(--accent); }

/* WORKS */
#works { background: #fff; }
.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: 260px; gap: 18px; }
.bento-card {
    border-radius: 20px; padding: 28px; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
    transition: transform .3s, box-shadow .3s;
    border: 1px solid transparent;
    cursor: pointer;
}
.bento-card:hover { transform: translateY(-6px); box-shadow: 0 20px 50px rgba(0,0,0,0.12); }
.bento-card .card-content { position: relative; z-index: 2; }
.bento-card .card-tag { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .4rem; opacity: .75; }
.bento-card h3 { font-size: 1.2rem; font-weight: 800; margin: 0 0 .4rem; }
.bento-card p { font-size: .85rem; margin: 0; opacity: .75; line-height: 1.6; }
.bento-card .card-link { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; margin-top: .75rem; text-decoration: none; font-weight: 600; }
.bento-card .card-link:hover { gap: 10px; }
.bento-card .card-icon { position: absolute; top: 20px; right: 20px; font-size: 2.8rem; opacity: .15; }
.bento-lg { grid-column: span 7; }
.bento-sm { grid-column: span 5; }
.bento-md { grid-column: span 6; }
/* Colorful light cards */
.bento-1 { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); color: #3b0764; }
.bento-1 .card-link { color: #6d28d9; }
.bento-2 { background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); color: #0c4a6e; }
.bento-3 { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); color: #14532d; }
.bento-4 { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #78350f; }
.tech-tag {
    display: inline-block; background: rgba(0,0,0,0.08); border-radius: 6px;
    padding: 2px 10px; font-size: .75rem; margin: 2px; font-weight: 600;
}

/* CONTACT */
#contact { background: var(--bg); }
.contact-card {
    background: #fff; border: 1px solid var(--border); border-radius: 24px; padding: 56px 44px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.form-control, .form-select {
    background: var(--bg); border: 1.5px solid var(--border); color: var(--text); border-radius: 12px;
}
.form-control:focus {
    background: #fff; border-color: var(--accent); color: var(--text);
    box-shadow: 0 0 0 3px rgba(109,40,217,0.12);
}
.form-label { color: var(--text); font-weight: 600; font-size: .88rem; margin-bottom: .4rem; }

/* FOOTER */
footer { background: var(--text); color: #cbd5e1; padding: 48px 0 32px; }
.footer-sns a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 1px solid rgba(255,255,255,0.15); border-radius: 12px;
    color: #94a3b8; font-size: 1.2rem; text-decoration: none;
    transition: all .2s; margin: 0 5px;
}
.footer-sns a:hover { border-color: #a78bfa; color: #a78bfa; transform: translateY(-3px); }

/* BACK TO TOP */
#backToTop {
    position: fixed; bottom: 32px; right: 32px; width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: none; border-radius: 14px; color: #fff; font-size: 1.2rem;
    display: none; align-items: center; justify-content: center;
    cursor: pointer; z-index: 9999; box-shadow: 0 4px 20px rgba(109,40,217,0.4); transition: transform .2s;
}
#backToTop:hover { transform: translateY(-4px); }
#backToTop.show { display: flex; }

section { padding: 100px 0; }

/* ──── NEW: MODAL STYLES ──── */
.modal-content { border-radius: 24px; border: none; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.2); }
.modal-header { border-bottom: none; padding: 32px 32px 0; }
.modal-body { padding: 24px 32px 32px; }
.modal-title { font-weight: 800; font-size: 1.8rem; }
.detail-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 700; margin-bottom: .5rem; display: block; }
.detail-text { color: var(--text); font-size: 1rem; margin-bottom: 1.5rem; line-height: 1.7; }
.tech-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.5rem; }

/* ──── NEW: AI CHAT WIDGET ──── */
#aiWidget {
    position: fixed; bottom: 90px; right: 32px; width: 320px; background: #fff;
    border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 999; display: flex; flex-direction: column; overflow: hidden;
    transform: translateY(20px); opacity: 0; transition: all .4s cubic-bezier(0.2, 0.9, 0.2, 1);
    pointer-events: none;
}
#aiWidget.show { transform: translateY(0); opacity: 1; pointer-events: auto; }

.ai-header { background: var(--accent); color: #fff; padding: 12px 16px; font-weight: 700; font-size: .85rem; display: flex; align-items: center; gap: 8px; }
.ai-header i { font-size: 1.1rem; }
.ai-body { padding: 16px; min-height: 100px; font-size: .85rem; line-height: 1.6; }
.ai-typing { font-weight: 500; color: var(--text); }
.ai-tag { font-size: .7rem; background: var(--accent-light); color: var(--accent); padding: 2px 8px; border-radius: 4px; margin-top: 8px; display: inline-block; font-weight: 700; }

#aiToggle {
    position: fixed; bottom: 32px; left: 32px; width: 56px; height: 56px;
    background: var(--bg-card); border: 2px solid var(--accent); border-radius: 50%;
    color: var(--accent); display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; cursor: pointer; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all .2s;
}
#aiToggle:hover { transform: scale(1.1); background: var(--accent); color: #fff; }

@media (max-width: 576px) {
    #aiWidget { width: calc(100vw - 64px); }
}
