:root {
    --background-color: #fff;
    --text-color: #111;
    --text-muted-color: #555;
    --card-background: #f9f9f9;
    --card-border-color: #e9ebe9;
    --pill-background: #e9ebe9;
    --shadow-color: rgba(0,0,0,0.05);
    --shadow-hover-color: rgba(0,0,0,0.1);
    --gradient: linear-gradient(to right, #3b82f6, #8b5cf6);
    --hero-bottom-margin: 0.0em;
}
body.dark-mode {
    --background-color: #121212;
    --text-color: #fff;
    --text-muted-color: #b9bbbe;
    --card-background: #1e1f22;
    --card-border-color: #2c2f33;
    --pill-background: #2c2f33;
    --shadow-color: rgba(0,0,0,0.2);
    --shadow-hover-color: rgba(0,0,0,0.3);
}

html, body {
    margin: 0; padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Arial', sans-serif; text-align: center; overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}
html { scroll-behavior: smooth; }
body {
    display: block; min-height: 100vh; position: relative;
    font-size: 16px;
}
.section {
    min-height: 100vh; height: auto;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 8em 1em; box-sizing: border-box; position: relative;
}
.main {
    justify-content: center;
    padding-top: 0;
}

/* トップセクション */
.hero-text { margin-bottom: var(--hero-bottom-margin); }
.seo-h1 { display: none; }
.text-line-1 { font-family: 'Zen Maru Gothic', sans-serif; font-size: 3em; font-weight: 900; margin: 0; }
.hero-text .face-emoji { font-size: 0.8em; vertical-align: middle; }
.text-line-2 { font-family: 'Inter', sans-serif; font-size: 2.2em; font-weight: 500; color: var(--text-muted-color); margin: 0.2em 0; }
.gradient-text { font-weight: 700; background-image: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.text-line-3 { font-family: 'Noto Sans JP', sans-serif; font-size: 0.9em; color: var(--text-muted-color); margin: 0; }
.quick-nav-buttons { display: flex; gap: 1em; margin-top: 1.5em; }
.quick-nav-btn { display: inline-flex; align-items: center; gap: 0.5em; text-decoration: none; padding: 0.6em 1.2em; border-radius: 30px; font-weight: 500; transition: transform 0.2s, box-shadow 0.2s; }
.quick-nav-btn:hover { transform: scale(1.05); box-shadow: 0 4px 15px var(--shadow-color); }
.btn-primary { background-color: #333; color: #fff; border: 1px solid transparent; }
.btn-secondary { background-color: var(--background-color); color: var(--text-color); border: 1px solid var(--card-border-color); }
body.dark-mode .btn-primary { background-color: #f0f0f0; color: #111; }
.contact-section { margin-top: 2.5em; width: 100%;}

/* 連絡先リスト */
.contact-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em 1.5em;
    width: 100%; max-width: 520px; margin: 0 auto;
}
.contact-item {
    display: flex; align-items: center; justify-content: space-between;
    text-decoration: none; color: var(--text-muted-color); font-family: 'Noto Sans JP', sans-serif;
    padding: 0.2em 0.5em; border-radius: 8px; transition: background-color 0.2s;
}
.contact-item:not(.discord):hover { background-color: var(--card-border-color); }
.contact-info-left { display: flex; align-items: center; gap: 0.8em; }
.contact-info-left i { font-size: 1.5em; color: var(--text-muted-color); width: 1.5em; text-align: center; }
.contact-info-left .contact-name { font-weight: 500; font-size: 1.1em; color: var(--text-color); }
.contact-username-pill {
    background-color: var(--pill-background); color: var(--text-muted-color); padding: 0.4em 0.9em;
    border-radius: 30px; font-size: 0.9em; font-weight: 500;
}
.contact-item.discord, .server-status { grid-column: 1 / -1; }
.server-status { text-align: center; margin-top: 1em; }
.server-status h3 { font-family: 'Zen Maru Gothic', sans-serif; font-size: 1.2em; color: var(--text-color); margin-bottom: 0.5em; }
.shields-group { display: flex; justify-content: center; gap: 0.5em; flex-wrap: wrap; }
.contact-item.discord { position: relative; padding: 0; height: 100px; overflow: visible; color: white; background-color: #37373e; border-radius: 8px; }
.discord-banner { position: absolute; top: 0; left: 0; width: 100%; height: 60px; overflow: hidden; opacity: 0.9; border-radius: 8px 8px 0 0; }
.discord-banner img, .discord-banner video { width: 100%; height: 100%; object-fit: cover; }
.discord-pfp { position: absolute; left: 15px; bottom: 10px; }
.discord-pfp-wrapper { position: relative; width: 65px; height: 65px; }
.discord-pfp-wrapper img { width: 100%; height: 100%; border-radius: 50%; border: 4px solid #37373e; transition: border-color 0.2s; }
.status-indicator { position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #37373e; background-color: #747f8d; }
.status-indicator.online { background-color: #3ba55d; } .status-indicator.idle { background-color: #faa81a; } .status-indicator.dnd { background-color: #ed4245; }
.discord-text { position: absolute; left: 95px; bottom: 15px; text-align: left; }
.discord-display-name { font-family: 'Zen Maru Gothic', sans-serif; font-weight: 900; font-size: 1.1em; text-shadow: 1px 1px 3px rgba(0,0,0,0.7); }
.discord-username { font-size: 0.9em; color: #ccc; text-shadow: 1px 1px 3px rgba(0,0,0,0.7); }
.contact-item.discord:hover .discord-pfp-wrapper img { border-color: #4a4a55; }
.discord-icon { position: absolute; right: 15px; bottom: 12px; font-size: 1.4em; color: #ccc; }
.custom-status-bubble { position: absolute; bottom: calc(100% + 5px); left: 0; background-color: #111214; color: #dcddde; padding: 8px 12px; border-radius: 8px; font-size: 0.9em; font-family: 'Zen Maru Gothic', sans-serif; font-weight: 500; white-space: nowrap; z-index: 10; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; }
.custom-status-bubble.visible { opacity: 1; visibility: visible; }
.custom-status-bubble::after { content: ''; position: absolute; top: 100%; left: 15px; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #111214 transparent transparent transparent; }
.custom-status-text { display: flex; align-items: center; gap: 6px; }
.custom-status-emoji { width: 1.2em; height: 1.2em; object-fit: contain; }

/* PGPモーダル */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(10, 10, 10, 0.75); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content { background: #1e1f22; color: #dcddde; padding: 2em; border-radius: 12px; max-width: 90%; width: 600px; max-height: 80vh; overflow-y: auto; transform: scale(0.9); transition: transform 0.3s; }
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5em; }
.modal-header h2 { margin: 0; font-family: 'Zen Maru Gothic', sans-serif; color: #fff; }
.modal-close-btn { background: none; border: none; font-size: 1.8em; cursor: pointer; color: #b9bbbe; transition: color .2s; }
.modal-close-btn:hover { color: #fff; }
.pgp-key-block { background-color: #2c2f33; border: none; border-radius: 8px; padding: 1em; text-align: left; font-family: 'Courier New', Courier, monospace; font-size: 0.8em; white-space: pre-wrap; word-break: break-all; color: #b9bbbe; }
.pgp-fingerprint { margin-top: 1em; font-size: 0.9em; word-break: break-all; color: #8e9297; }
.pgp-fingerprint strong { font-family: 'Zen Maru Gothic', sans-serif; color: #dcddde; }
.modal-actions { display: flex; gap: 1em; margin-top: 1.5em; flex-wrap: wrap; }
.modal-actions button, .modal-actions a { flex: 1; text-align: center; font-size: 0.9em; padding: 0.8em 1em; border-radius: 8px; border: none; background-color: #40444b; cursor: pointer; text-decoration: none; color: #fff; font-family: 'Noto Sans JP', sans-serif; font-weight: 500; transition: background-color .2s; }
.modal-actions button:hover, .modal-actions a:hover { background-color: #5865f2; }

/* トースト通知 */
#toast-notification { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); background-color: #222; color: white; padding: 12px 20px; border-radius: 30px; font-size: 0.95em; z-index: 3000; transition: bottom 0.5s ease-in-out; }
#toast-notification.show { bottom: 30px; }

/* スクロール連動UI */
.header-fixed-item { position: fixed; z-index: 1000; opacity: 0; transition: opacity 0.4s ease, transform 0.4s ease; }
.header-fixed-item.visible { opacity: 1; transform: translateY(0); }
.header-fixed-item.hidden { opacity: 0; transform: translateY(-20px); pointer-events: none; }
#top-nav { position: fixed; top: 0; left: 0; width: 100%; display: flex; justify-content: center; align-items: center; padding: 10px 0; background-color: rgba(255, 255, 255, 0.8); backdrop-filter: blur(5px); box-shadow: 0 2px 5px var(--shadow-color); z-index: 1500; opacity: 0; transform: translateY(-100%); pointer-events: none; transition: opacity 0.4s ease, transform 0.4s ease; }
body.dark-mode #top-nav { background-color: rgba(18, 18, 18, 0.8); }
#top-nav.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#top-nav a { font-family: 'Zen Maru Gothic', sans-serif; font-weight: bold; text-decoration: none; color: var(--text-color); margin: 0 15px; font-size: 1.1em; }
#top-nav a:hover { text-decoration: underline; }
.shields-container { top: 1em; left: 1em; display: flex; flex-direction: column; align-items: flex-start; }
.shields-badge { margin-bottom: 0.5em; }
#getloli-counter { top: 1em; right: 1em; display: flex; flex-direction: column; align-items: center; }
#getloli-counter-text { font-size: 0.8em; color: var(--text-muted-color); margin-top: 0.2em; font-family: 'Zen Maru Gothic', sans-serif; }
#now { top: 1em; right: 50%; transform: translateX(50%); color: var(--text-muted-color); font-size: 1em; font-family: 'Zen Maru Gothic', sans-serif; white-space: nowrap; }
#hayane { top: 3em; right: 50%; transform: translateX(50%); color: var(--text-muted-color); font-size: 1em; font-family: 'Zen Maru Gothic', sans-serif; }
#dark-mode-toggle { position: absolute; right: 20px; background: none; border: none; cursor: pointer; font-size: 1.3em; color: var(--text-muted-color); padding: 5px; }
#back-to-top { position: fixed; bottom: 20px; right: 20px; width: 50px; height: 50px; background-color: rgba(0,0,0,0.6); color: white; border-radius: 50%; text-decoration: none; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px); opacity: 0; pointer-events: none; transform: translateY(20px); transition: opacity 0.3s, transform 0.3s; }
#back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* スクロールダウン矢印 */
#scroll-down-container { position: absolute; bottom: 3em; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-muted-color); animation: bounce 2s infinite; }
body.dark-mode #scroll-down-container { color: rgba(255, 255, 255, 0.4); }
#scroll-down-container:hover { color: var(--text-color); }
.scroll-down-text { font-family: 'Zen Maru Gothic', sans-serif; font-size: 0.9em; font-weight: bold; letter-spacing: 1px; margin-bottom: 0.5em; }
.scroll-down-icon { font-size: 1.5em; }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translate(-50%, 0); } 40% { transform: translate(-50%, -15px); } 60% { transform: translate(-50%, -8px); } }

/* Aboutセクション */
.about-section { background-color: var(--card-background); }
.about-card {
    background-color: var(--background-color);
    border: 1px solid var(--card-border-color);
    border-radius: 12px;
    padding: 1.5em 2em;
    text-align: left;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    box-shadow: 0 4px 12px var(--shadow-color);
}
.about-card:first-child { margin-bottom: 2em; }
.about-card h2 { font-family: 'Zen Maru Gothic', sans-serif; font-size: 2em; margin: 0.2em 0 0.4em 0; color: var(--text-color); }
.about-card p { font-size: 1.05em; color: var(--text-muted-color); margin: 0 0 1.5em 0; }
.info-pills { display: flex; flex-wrap: wrap; gap: 0.8em; margin-bottom: 1.5em; }
.info-pills > span { background-color: var(--pill-background); color: var(--text-muted-color); padding: 0.4em 0.8em; border-radius: 6px; display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.9em; font-weight: 500; }
.tech-category { margin-bottom: 1.5em; }
.tech-category:last-child { margin-bottom: 0; }
.tech-category h3 { font-family: 'Zen Maru Gothic', sans-serif; font-size: 1.1em; color: var(--text-muted-color); margin: 0 0 1em 0; font-weight: 500; }
.tech-pills { display: flex; flex-wrap: wrap; gap: 0.8em; }
.tech-pills > span { background-color: var(--pill-background); color: var(--text-muted-color); padding: 0.4em 0.8em; border-radius: 6px; display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.9em; font-weight: 500; transition: transform 0.2s, box-shadow 0.2s; }
.tech-pills > span:hover { transform: scale(1.05); box-shadow: 0 4px 10px var(--shadow-color); }
.about-footer { margin-top: 2em; padding-top: 1.5em; border-top: 1px solid var(--card-border-color); text-align: center; font-family: 'Zen Maru Gothic', sans-serif; color: var(--text-muted-color); font-size: 0.9em; }
.about-footer p { margin: 0; }

/* プロジェクトセクション */
.projects-section { background-color: var(--background-color); }
.projects-section h2 { font-family: 'Zen Maru Gothic', sans-serif; font-size: 2.5em; margin-bottom: 1em; color: var(--text-color); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5em; width: 100%; max-width: 1200px; padding: 0 1em; }
.project-card {
    background-color: var(--card-background); border: 1px solid var(--card-border-color);
    border-radius: 8px; padding: 1.5em; text-align: left; box-shadow: 0 4px 12px var(--shadow-color); 
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px var(--shadow-hover-color); border-color: #ddd; }
body.dark-mode .project-card:hover { border-color: #444; }
.project-card h3 { font-family: 'Zen Maru Gothic', sans-serif; font-size: 1.4em; margin: 0 0 0.5em 0; color: var(--text-color); }
.project-card p { font-family: 'Noto Sans JP', sans-serif; font-size: 0.95em; color: var(--text-muted-color); flex-grow: 1; margin-bottom: 1em; }
.project-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.9em; color: var(--text-muted-color); font-family: 'Noto Sans JP', sans-serif; }
.project-meta .language-color { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; background-color: #ccc; }

#loading { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; display: flex; justify-content: center; align-items: center; z-index: 2000; color: white; font-size: 2em; font-family: 'Noto Sans JP', sans-serif; flex-direction: column; opacity: 1; transition: opacity 1s ease-in-out; }
#loading.fade-out { opacity: 0; pointer-events: none; }
#loading-percentage { font-size: 2em; font-family: 'Orbitron', sans-serif; }
#loading-text { font-size: 1em; margin-top: 0.5em; font-family: 'Noto Sans JP', sans-serif; }

/* フェードインアニメーション */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.main .reveal:nth-child(1) { transition-delay: 0.1s; }
.main .reveal:nth-child(2) { transition-delay: 0.2s; }
.main .reveal:nth-child(3) { transition-delay: 0.3s; }

.reveal-child {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.reveal.is-visible .reveal-child {
    opacity: 1;
    transform: translateY(0);
}
.reveal.is-visible .reveal-child:nth-child(1) { transition-delay: 0.2s; }
.reveal.is-visible .reveal-child:nth-child(2) { transition-delay: 0.3s; }
.reveal.is-visible .reveal-child:nth-child(3) { transition-delay: 0.4s; }
.reveal.is-visible .reveal-child:nth-child(4) { transition-delay: 0.5s; }

.projects-grid.is-visible .project-card {
    opacity: 1;
}
.projects-grid.is-visible .project-card:nth-child(3n+1) { transition-delay: 0.1s; transform: translateX(0); }
.projects-grid.is-visible .project-card:nth-child(3n+2) { transition-delay: 0.2s; transform: translateY(0); }
.projects-grid.is-visible .project-card:nth-child(3n+3) { transition-delay: 0.3s; transform: translateX(0); }
.projects-grid .project-card {
    opacity: 0;
}
.projects-grid .project-card:nth-child(3n+1) { transform: translateX(-30px); }
.projects-grid .project-card:nth-child(3n+2) { transform: translateY(30px); }
.projects-grid .project-card:nth-child(3n+3) { transform: translateX(30px); }


@media screen and (max-width: 768px) {
    .section { padding-top: 6em; padding-bottom: 6em; }
    .main { padding-top: 8em; }
    .text-line-1 { font-size: 2.5em; }
    .text-line-2 { font-size: 1.8em; }
    .contact-links { grid-template-columns: 1fr; }
    #now, #hayane { display: none; }
    #getloli-counter img { height: 4.5em; width: auto; }
    #getloli-counter-text { font-size: 0.8em; }
    .about-card, .tech-card { padding: 1em 1.5em; }
    .about-card h2 { font-size: 1.8em; }
    #scroll-down-container { display: none; }
    
    .projects-grid .project-card,
    .projects-grid.is-visible .project-card {
        transform: translateY(30px);
    }
    .projects-grid.is-visible .project-card {
        transform: translateY(0);
    }
}
@media screen and (max-width: 480px) {
    .text-line-1 { font-size: 10vw; }
    .text-line-2 { font-size: 8vw; }
}
