@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    --bg:       #0a0a12;
    --surface:  #12111f;
    --card:     #1a1830;
    --border:   #2a2545;
    --accent1:  #b668f7;
    --accent2:  #f06ef7;
    --accent3:  #6e8aff;
    --text:     #f0eeff;
    --muted:    #7a7599;
    --success:  #5af0c0;
    --danger:   #f75a7a;
    --grad:     linear-gradient(135deg, var(--accent1), var(--accent2));
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Background orbs ── */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: drift 12s ease-in-out infinite alternate;
}
.orb1 { width: 500px; height: 500px; background: var(--accent1); top: -100px; left: -100px; animation-duration: 14s; }
.orb2 { width: 400px; height: 400px; background: var(--accent2); bottom: -100px; right: -80px; animation-duration: 10s; animation-delay: -4s; }
.orb3 { width: 300px; height: 300px; background: var(--accent3); top: 40%; left: 50%; animation-duration: 16s; animation-delay: -8s; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,30px) scale(1.1); } }

/* ── Navbar & site nav ── */
.header-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 18, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
}
.brand {
    font-size: 1.2rem; font-weight: 700; letter-spacing: .04em;
    background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0;
}
.brand-icon { font-size: 1.4rem; }
.site-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 16px 12px;
}
.nav-tab {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    border-radius: 12px;
    padding: 8px 14px;
    min-height: 40px;
    font-family: 'Outfit', sans-serif;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nav-tab-icon { font-size: 1rem; line-height: 1; }
.nav-tab-label { line-height: 1.2; }
.nav-label-short { display: none; }
.nav-tab:hover { color: var(--text); border-color: var(--border); }
.nav-tab-active, .nav-tab.nav-tab-active {
    color: var(--text);
    background: rgba(182, 104, 247, 0.15);
    border-color: var(--accent1);
}
.nav-tab-link { display: inline-flex; }
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--accent1); object-fit: cover; }
.user-name-label, #userName { font-size: .9rem; color: var(--muted); }

/* ── Points badge ── */
.points-badge {
    display: flex; align-items: center; gap: 5px;
    background: rgba(182,104,247,0.15);
    border: 1px solid var(--accent1);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: .85rem; font-weight: 600;
    color: var(--accent1);
}
.pt-icon { font-size: .7rem; }

/* ── 広告視聴ボタン ── */
.btn-ad-watch {
    display: flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #2a1845, #1a2845);
    border: 1px solid var(--accent3);
    color: var(--accent3);
    border-radius: 20px;
    padding: 4px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: .82rem; font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .15s;
    white-space: nowrap;
}
.btn-ad-watch:hover {
    background: linear-gradient(135deg, #3a2060, #1e3060);
    transform: translateY(-1px);
}

/* ── Container ── */
.container {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* ── 静的ページ（使い方・規約・AI透明性） ── */
/* 実色指定＋box-shadow で端末差・iOSの border-collapse 崩れに強い */
body.legal-doc {
    overflow-x: clip;
}
body.legal-doc::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #0a0a12;
    pointer-events: none;
}
body.legal-doc .bg-orbs {
    opacity: 0.35;
}
body.legal-doc .bg-orbs .orb {
    opacity: 0.12;
}

.legal-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 20px calc(48px + env(safe-area-inset-bottom, 0px));
    position: relative;
    z-index: 2;
    color: #f0eeff;
}
.legal-page h1 {
    font-size: clamp(1.45rem, 5vw, 2rem);
    margin-bottom: 8px;
    color: #f0eeff;
    line-height: 1.25;
}
.legal-page h2 {
    font-size: clamp(1.05rem, 3.5vw, 1.15rem);
    margin: 0 0 12px;
    color: #c99bff;
}
.legal-page h3 {
    font-size: 1rem;
    margin: 16px 0 8px;
    color: #e8e4ff;
}
.legal-page p,
.legal-page li {
    line-height: 1.75;
    color: #d4cee8;
    margin-bottom: 10px;
}
.legal-page ul,
.legal-page ol {
    padding-left: 1.25rem;
    margin-bottom: 14px;
}
.legal-page .legal-lead {
    font-size: clamp(.92rem, 3.2vw, 1rem);
    margin-bottom: 20px;
    color: #d4cee8;
}
.legal-page strong {
    color: #f0eeff;
}
.legal-page a {
    color: #c99bff;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.legal-card {
    background: #16142a;
    border: 1.5px solid #4a4080;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 10px 36px rgba(0, 0, 0, 0.45);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.legal-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px 0;
    border: 1.5px solid #4a4080;
    border-radius: 10px;
    background: #0e0c18;
    box-shadow: inset 0 0 0 1px rgba(182, 104, 247, 0.15);
}
.legal-table {
    width: 100%;
    min-width: 280px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .88rem;
    margin: 0;
}
.legal-table th,
.legal-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    background: #16142a;
    color: #d4cee8;
    border: none;
    box-shadow:
        inset 0 -1px 0 #4a4080,
        inset -1px 0 0 #4a4080;
}
.legal-table tr:last-child th,
.legal-table tr:last-child td {
    box-shadow: inset -1px 0 0 #4a4080;
}
.legal-table thead th {
    background: #1f1b38;
    color: #f0eeff;
    font-weight: 700;
    box-shadow:
        inset 0 1px 0 #4a4080,
        inset 0 -1px 0 #4a4080,
        inset -1px 0 0 #4a4080;
}
.legal-table tbody td {
    box-shadow:
        inset 0 -1px 0 #4a4080,
        inset -1px 0 0 #4a4080;
}
.legal-page code {
    background: #0a0a12;
    border: 1px solid #4a4080;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .85rem;
    color: #e8e4ff;
    word-break: break-all;
}
.legal-nav-top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    font-size: .9rem;
}
.legal-nav-top a {
    color: #e8dcff;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    background: #16142a;
    border: 1.5px solid #4a4080;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.legal-nav-top a:hover {
    border-color: #b668f7;
    color: #fff;
}
.legal-muted {
    font-size: .82rem;
    color: #9a94b8;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .legal-page {
        padding: 20px 14px calc(40px + env(safe-area-inset-bottom, 0px));
    }
    .legal-card {
        padding: 16px 14px;
        border-radius: 12px;
    }
    .legal-table {
        font-size: .82rem;
    }
    .legal-table th,
    .legal-table td {
        padding: 8px 10px;
    }
}

@media (prefers-contrast: more) {
    .legal-card,
    .legal-table-wrap,
    .legal-nav-top a {
        border-width: 2px;
        border-color: #8a7ec8;
    }
    .legal-page p,
    .legal-page li,
    .legal-table td {
        color: #f0eeff;
    }
}

/* ── フッター（トップページ） ── */
.site-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 4px;
    margin-bottom: 10px;
}
.site-footer-nav a {
    color: var(--accent1);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
    padding: 8px 10px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.site-footer-nav a:hover { text-decoration: underline; }
.site-footer-nav .sep {
    color: var(--muted);
    user-select: none;
}
.site-footer-copy {
    font-size: .75rem;
    color: var(--muted);
    margin: 0;
}

/* ── Buttons ── */
.btn-primary {
    background: var(--grad);
    color: #fff; border: none;
    border-radius: 10px; padding: 11px 22px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700; font-size: .95rem;
    cursor: pointer; width: 100%;
    transition: opacity .2s, transform .15s;
    margin-top: 8px;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--accent1);
    color: var(--accent1);
    border-radius: 8px; padding: 8px 18px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600; font-size: .9rem;
    cursor: pointer; transition: background .2s;
}
.btn-outline:hover { background: rgba(182,104,247,0.12); }

.btn-ghost {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px; padding: 11px 22px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600; font-size: .95rem;
    cursor: pointer; transition: background .2s;
    flex: 1;
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); }

.btn-link {
    background: none; border: none;
    color: var(--accent1); font-family: 'Outfit', sans-serif;
    font-size: .85rem; cursor: pointer;
    text-decoration: underline; width: 100%; margin-top: 8px;
}

.btn-download {
    background: var(--grad);
    color: #fff; border: none;
    border-radius: 8px; padding: 10px 24px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700; font-size: .9rem;
    cursor: pointer; transition: opacity .2s;
    display: flex; align-items: center; gap: 8px;
}
.btn-download:hover { opacity: .85; }

.btn-view {
    background: rgba(182,104,247,0.15);
    border: 1px solid var(--accent1);
    color: var(--accent1);
    border-radius: 8px; padding: 8px 18px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600; font-size: .88rem;
    cursor: pointer; transition: background .2s;
}
.btn-view:hover { background: rgba(182,104,247,0.28); }

/* ── BANボタン ── */
.btn-ban {
    flex: 1; background: rgba(247,90,122,0.15);
    border: 1.5px solid var(--danger);
    color: var(--danger);
    border-radius: 8px; padding: 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700; font-size: .88rem;
    cursor: pointer; transition: background .2s;
}
.btn-ban:hover { background: rgba(247,90,122,0.28); }

.btn-unban {
    flex: 1; background: rgba(90,240,192,0.1);
    border: 1.5px solid var(--success);
    color: var(--success);
    border-radius: 8px; padding: 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700; font-size: .88rem;
    cursor: pointer; transition: background .2s;
}
.btn-unban:hover { background: rgba(90,240,192,0.22); }

.ban-perm-label {
    display: flex; align-items: center; gap: 8px;
    color: var(--danger); font-size: .88rem; font-weight: 600;
    cursor: pointer;
}
.ban-perm-label input[type="checkbox"] { accent-color: var(--danger); width: 16px; height: 16px; }

/* ── Modal ── */
.modal {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s ease;
    pointer-events: auto;
}
.modal.modal-on-top {
    z-index: 100000 !important;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    width: min(480px, 92vw);
    position: relative;
    z-index: 1;
    pointer-events: auto;
    animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.detail-box {
    width: min(700px, 95vw);
    max-height: min(85vh, 100dvh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.detail-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    z-index: 3;
}
.detail-modal-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.detail-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 24px;
    overscroll-behavior: contain;
}
.detail-modal-close {
    position: static;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    border-radius: 10px;
    touch-action: manipulation;
}

.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: rgba(255,255,255,0.07); border: none;
    color: var(--muted); border-radius: 6px;
    width: 30px; height: 30px; cursor: pointer;
    font-size: .9rem; transition: background .2s;
    touch-action: manipulation;
}
.modal-close:hover { background: rgba(255,255,255,0.14); }

.modal-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; }

/* ── 広告モーダル ── */
.ad-modal-box {
    width: min(500px, 94vw);
}
.ad-container {
    border-radius: 12px; overflow: hidden; margin-bottom: 20px;
}
.ad-placeholder {
    background: linear-gradient(135deg, #1a1040, #0d1a40);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
}
.ad-brand {
    font-size: 1.1rem; font-weight: 700; color: var(--accent1);
    margin-bottom: 8px;
}
.ad-tagline {
    font-size: .95rem; color: var(--text);
    margin-bottom: 16px; font-weight: 600;
}
.ad-visual {
    font-size: 3rem; margin-bottom: 12px;
    animation: adPulse 2s ease-in-out infinite;
}
@keyframes adPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.ad-sub {
    font-size: .82rem; color: var(--muted);
}
.ad-progress-wrap {
    margin-bottom: 4px;
}
.ad-progress-bar {
    height: 6px; background: var(--border);
    border-radius: 3px; overflow: hidden; margin-bottom: 8px;
}
.ad-progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent3), var(--accent1));
    border-radius: 3px;
    transition: width 1s linear;
}
.ad-timer {
    font-size: .82rem; color: var(--muted); text-align: right;
}

/* ── Auth buttons ── */
.auth-buttons { display: flex; flex-direction: column; gap: 10px; }
.btn-auth {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 12px; border-radius: 10px;
    font-family: 'Outfit', sans-serif; font-weight: 600; font-size: .95rem;
    cursor: pointer; border: none; transition: opacity .2s;
}
.btn-github { background: #24292e; color: #fff; }
.btn-google { background: #fff; color: #333; }
.btn-auth:hover { opacity: .88; }

.divider {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 0; color: var(--muted); font-size: .85rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.email-form { display: flex; flex-direction: column; gap: 10px; }
.email-btns { display: flex; gap: 8px; }
.email-btns .btn-primary, .email-btns .btn-ghost { margin-top: 0; }

/* ── Input fields ── */
.input-field {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    font-size: .95rem;
    padding: 11px 14px;
    outline: none;
    transition: border-color .2s;
    margin-bottom: 0;
}
.input-field:focus { border-color: var(--accent1); }
.input-field::placeholder { color: var(--muted); }

/* ── Admin panel ── */
.admin-panel {
    background: rgba(182,104,247,0.06);
    border: 1px solid rgba(182,104,247,0.25);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 36px;
}
.admin-header h2 { font-size: 1.1rem; margin-bottom: 20px; color: var(--accent1); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .admin-grid { grid-template-columns: 1fr; } }

.admin-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.admin-card h3 { font-size: .95rem; color: var(--muted); margin-bottom: 4px; }
.admin-msg { font-size: .85rem; padding: 8px 12px; border-radius: 8px; margin-top: 4px; }
.admin-msg.success { background: rgba(90,240,192,0.12); color: var(--success); }
.admin-msg.error { background: rgba(247,90,122,0.12); color: var(--danger); }
.moderation-info {
    font-size: .82rem;
    color: var(--muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.5;
}
.moderation-list {
    max-height: 360px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}
.mod-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: .82rem;
    line-height: 1.55;
}
.mod-item-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--muted);
}
.mod-item-resolved {
    opacity: 0.72;
    border-color: rgba(90, 240, 192, 0.35);
}

/* ── 通知 ── */
.btn-notify {
    position: relative;
    padding: 8px 14px;
    min-width: 44px;
}
.notify-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.notify-box {
    width: min(520px, 96vw);
    max-height: min(85vh, 100dvh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notify-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding-right: 36px;
}
.notify-list {
    flex: 1;
    min-height: 0;
    max-height: min(60vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.notify-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    text-align: left;
}
.notify-item:hover { border-color: var(--accent1); }
.notify-item.unread {
    border-color: rgba(182, 104, 247, 0.55);
    background: rgba(182, 104, 247, 0.08);
}
.notify-item-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: .78rem;
    color: var(--muted);
}
.notify-item-title {
    font-weight: 700;
    font-size: .92rem;
    color: var(--text);
    margin-bottom: 4px;
}
.notify-item-body {
    font-size: .84rem;
    line-height: 1.55;
    color: #c8c2e6;
    white-space: pre-wrap;
}
.notify-item-type {
    font-size: .72rem;
    font-weight: 700;
    color: var(--accent1);
}
.mod-reply-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.mod-reply-box textarea {
    min-height: 64px;
    margin-bottom: 8px;
}

/* ── File drop ── */
.file-drop {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    font-size: .9rem;
    transition: border-color .2s, background .2s;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.file-drop:hover, .file-drop.dragover { border-color: var(--accent1); background: rgba(182,104,247,0.06); }
.drop-icon { font-size: 1.8rem; }

.file-preview {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .75rem;
    color: var(--success);
    max-height: 100px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Search ── */
.search-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 16px;
    margin-bottom: 28px;
}
.search-icon { font-size: 1rem; }
.search-input {
    flex: 1; background: none; border: none;
    color: var(--text); font-family: 'Outfit', sans-serif;
    font-size: .95rem; padding: 10px 0; outline: none;
}
.search-input::placeholder { color: var(--muted); }

/* ── Repo grid ── */
.repo-grid { display: flex; flex-direction: column; gap: 16px; }

/* ── Preset card ── */
.preset-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 24px;
    transition: border-color .25s, transform .2s;
    animation: cardIn .35s ease both;
    display: flex; gap: 14px;
}
.preset-card:hover { border-color: var(--accent1); transform: translateY(-2px); }
.card-thumb {
    width: 72px; height: 72px; border-radius: 10px; object-fit: cover;
    flex-shrink: 0; border: 1px solid var(--border);
}
.card-thumb-ph {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1040, #0d1a40);
    font-size: 1.5rem; color: var(--accent1);
}
.card-body { flex: 1; min-width: 0; }
.ai-tag-badge {
    font-size: .65rem; background: rgba(110,138,255,0.2);
    color: var(--accent3); padding: 2px 6px; border-radius: 6px; margin-left: 6px;
}
.version-badge { font-size: .65rem; background: rgba(90,240,192,0.15); color: var(--success); padding: 2px 6px; border-radius: 6px; margin-left: 4px; }
.author-link { color: var(--accent1); cursor: pointer; text-decoration: none; }
.author-link:hover { text-decoration: underline; }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; }
.view-hint { background: rgba(182,104,247,0.1); border: 1px solid var(--accent1); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: .88rem; }
.ranking-section, .tags-section { margin-bottom: 28px; }
.rank-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rank-columns h3 { font-size: 1rem; margin-bottom: 12px; color: var(--accent2); }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: border-color .2s; }
.rank-item:hover { border-color: var(--accent1); }
.rank-num { font-size: 1.2rem; font-weight: 900; color: var(--accent1); min-width: 28px; }
.rank-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.rank-thumb-ph { width: 48px; height: 48px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #1a1040; color: var(--accent1); }
.rank-title { font-weight: 600; font-size: .9rem; }
.rank-meta { font-size: .75rem; color: var(--muted); }
.rank-empty { color: var(--muted); font-size: .85rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tag-cloud-item { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: .82rem; cursor: pointer; color: var(--text); font-family: 'Outfit', sans-serif; transition: all .2s; }
.tag-cloud-item span { color: var(--muted); margin-left: 4px; }
.tag-cloud-item:hover, .tag-cloud-item.active { border-color: var(--accent1); background: rgba(182,104,247,0.12); }
.tag-preset-list { display: flex; flex-direction: column; gap: 8px; }
.tag-preset-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.tag-preset-row img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.ai-assist-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.thumb-preview { width: 100%; max-width: 200px; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--border); }
.public-profile-box { width: min(520px, 96vw); }
.public-profile-header { display: flex; gap: 16px; align-items: flex-start; }
.public-profile-name { font-size: 1.2rem; font-weight: 700; }
.public-profile-stats { font-size: .82rem; color: var(--muted); margin: 4px 0 8px; }
.public-profile-bio { font-size: .88rem; line-height: 1.6; color: #c8c2e6; }
.public-profile-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.mini-preset-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px; cursor: pointer; font-size: .78rem; text-align: center; }
.mini-preset-card img { width: 100%; height: 60px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.mini-preset-placeholder { height: 60px; display: flex; align-items: center; justify-content: center; background: #1a1040; border-radius: 6px; margin-bottom: 6px; font-size: 1.2rem; }
.version-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-thumb { width: 100%; max-height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 14px; border: 1px solid var(--border); }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.card-desc { font-size: .88rem; color: var(--muted); }
.card-meta { font-size: .78rem; color: var(--muted); margin-top: 10px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
    background: rgba(182,104,247,0.15);
    color: var(--accent1);
    border-radius: 20px; padding: 3px 10px;
    font-size: .75rem; font-weight: 600;
    cursor: pointer;
}
.card-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── Detail modal content ── */
.detail-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.detail-desc { color: var(--muted); margin-bottom: 16px; }
.detail-xml {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .78rem;
    color: #a7f3d0;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 16px;
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Loading ── */
.loading-state { text-align: center; padding: 60px; color: var(--muted); }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent1);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── いいねボタン ── */
.btn-like {
    background: none; border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px;
    color: var(--muted); font-size: .85rem;
    cursor: pointer; transition: all .2s;
}
.btn-like:hover { border-color: #f06ef7; color: #f06ef7; }
.btn-like.liked { border-color: #f06ef7; color: #f06ef7; background: rgba(240,110,247,0.1); }

.btn-like-big {
    background: none; border: 1.5px solid var(--border);
    border-radius: 10px; padding: 10px 20px;
    color: var(--muted); font-size: .95rem; font-family: 'Outfit', sans-serif;
    cursor: pointer; transition: all .2s; font-weight: 600;
}
.btn-like-big:hover { border-color: #f06ef7; color: #f06ef7; }
.btn-like-big.liked { border-color: #f06ef7; color: #f06ef7; background: rgba(240,110,247,0.1); }

/* ── カード下部 ── */
.card-bottom {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px; flex-wrap: wrap; gap: 8px;
}

/* ── コメント ── */
.comments-section { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.comments-title { font-size: 1rem; margin-bottom: 14px; color: var(--text); }
.comment-item {
    display: flex; gap: 10px; margin-bottom: 14px;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; flex-shrink: 0; }
.comment-name { font-weight: 600; font-size: .88rem; margin-right: 8px; }
.comment-date { font-size: .75rem; color: var(--muted); }
.comment-text { font-size: .9rem; color: var(--text); margin-top: 4px; line-height: 1.5; }
.comment-form { display: flex; gap: 10px; margin-top: 16px; align-items: flex-end; }
.comment-textarea {
    flex: 1; background: rgba(255,255,255,0.05);
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--text); font-family: 'Outfit', sans-serif;
    font-size: .9rem; padding: 10px 14px;
    outline: none; resize: none; height: 80px;
    transition: border-color .2s;
}
.comment-textarea:focus { border-color: var(--accent1); }

/* ── プロフィール ── */
.profile-avatar-wrap {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px; margin-bottom: 20px;
}
.profile-avatar-img {
    width: 80px; height: 80px; border-radius: 50%;
    border: 3px solid var(--accent1); object-fit: cover;
}
.profile-avatar-edit {
    background: rgba(182,104,247,0.15);
    border: 1px solid var(--accent1);
    color: var(--accent1); border-radius: 8px;
    padding: 6px 16px; font-size: .85rem;
    cursor: pointer; font-family: 'Outfit', sans-serif;
    transition: background .2s;
}
.profile-avatar-edit:hover { background: rgba(182,104,247,0.28); }

/* ── IDコピーボタン ── */
.btn-id-copy {
    background: none; border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 10px;
    color: var(--muted); font-size: .8rem;
    cursor: pointer; transition: all .2s;
}
.btn-id-copy:hover { border-color: var(--accent3); color: var(--accent3); }

/* ── もっと見るボタン ── */
.btn-more {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text); border-radius: 10px;
    padding: 12px 32px; font-family: 'Outfit', sans-serif;
    font-size: .95rem; font-weight: 600;
    cursor: pointer; transition: background .2s;
}
.btn-more:hover { background: rgba(255,255,255,0.1); }

/* ── トースト通知 ── */
.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--card); border: 1px solid var(--accent1);
    color: var(--text); border-radius: 10px;
    padding: 12px 24px; font-size: .9rem; font-weight: 600;
    opacity: 0; transition: all .3s; z-index: 999; pointer-events: none;
    white-space: nowrap;
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive fixes ── */
@media (max-width: 768px) {
    .header-wrap {
        border-bottom: 1px solid var(--border);
    }
    .navbar {
        padding: 10px 12px;
        align-items: center;
    }
    .brand { font-size: 1rem; }
    /* メインナビを下部ドックに（ヘッダーと被らない） */
    .site-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 95;
        justify-content: space-around;
        align-items: stretch;
        gap: 2px;
        flex-wrap: nowrap;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        background: rgba(8, 8, 14, 0.96);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        border-bottom: none;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    }
    .site-nav .nav-tab {
        flex: 1;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
        min-height: 52px;
        padding: 6px 2px;
        border-radius: 10px;
        font-size: .62rem;
    }
    .site-nav .nav-tab-icon {
        font-size: 1.35rem;
    }
    .site-nav .nav-tab-label {
        font-size: .58rem;
        font-weight: 600;
        letter-spacing: -0.02em;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .site-nav .nav-tab-active {
        background: rgba(182, 104, 247, 0.22);
    }
    .rank-columns { grid-template-columns: 1fr; }
    .nav-right {
        gap: 6px;
        justify-content: flex-end;
        flex: 1;
        min-width: 0;
    }
    .btn-nav-compact {
        padding: 8px 12px !important;
        min-width: 44px;
        min-height: 44px;
    }
    #feedbackBtn.btn-nav-compact {
        font-size: 1.1rem;
        padding: 8px 10px !important;
    }
    .user-name-label {
        display: none;
    }
    .user-info {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .points-badge {
        font-size: .75rem;
        padding: 4px 8px;
    }
    .container {
        padding: 16px 12px calc(88px + env(safe-area-inset-bottom, 0px));
    }
    .admin-panel { padding: 14px; margin-bottom: 18px; }
    .admin-card { padding: 14px; }
    .preset-card {
        padding: 14px;
        border-radius: 12px;
    }
    .card-top {
        flex-direction: column;
        align-items: stretch;
    }
    .card-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    .detail-actions {
        flex-direction: column;
    }
    .detail-actions > * {
        width: 100%;
        justify-content: center;
    }
    .comment-form {
        flex-direction: column;
        align-items: stretch;
    }
    .comment-form .btn-primary {
        width: 100% !important;
        align-self: stretch !important;
    }
    .modal-box {
        width: min(96vw, 96vw);
        padding: 18px;
        border-radius: 14px;
    }
    .detail-box {
        width: 96vw;
        max-height: min(92dvh, 92vh);
    }
    .detail-modal-header {
        padding: 12px 14px;
    }
    .detail-scroll {
        padding: 14px 16px 20px;
    }
    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.05rem;
    }
    .search-bar {
        padding: 2px 10px;
    }
}

@media (max-width: 480px) {
    .site-nav .nav-tab-label {
        font-size: .52rem;
    }
    .site-nav .nav-label-long { display: none; }
    .site-nav .nav-label-short { display: inline; }
    .site-nav .nav-tab-icon {
        font-size: 1.2rem;
    }
    .btn-outline {
        padding: 7px 12px;
        font-size: .82rem;
    }
    .btn-ad-watch span:last-child {
        display: none;
    }
    #userName {
        max-width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .toast {
        max-width: 92vw;
        white-space: normal;
        text-align: center;
    }
}
