:root {
    /* モダンカラーパレット */
    --primary: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --secondary: #ec4899; /* Pink/Rose */
    --bg-body: #0f172a; /* Slate 900 */
    --bg-card: #1e293b; /* Slate 800 */
    --bg-header: rgba(15, 23, 42, 0.85);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    
    /* カテゴリカラー */
    --color-fun: #f43f5e;
    --color-study: #10b981;
    --color-other: #f59e0b;

    --font-base: 'Inter', 'Noto Sans JP', sans-serif;
    --radius: 12px;
    --header-h: 64px;
}

[data-theme="light"] {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.9);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-base);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

/* 背景装飾 */
.bg-gradient {
    position: fixed; inset: 0; z-index: -1;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(236, 72, 153, 0.1), transparent 40%);
    pointer-events: none;
}
.bg-pattern {
    position: fixed; inset: 0; z-index: -2;
    background-image: linear-gradient(var(--border) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.05;
}

/* ヘッダー */
.site-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; height: 100%;
    display: flex; justify-content: space-between; align-items: center;
}

/* ロゴエリアのレイアウト調整 */
.logo-area {
    display: flex; align-items: center; gap: 8px;
}
.site-icon-img {
    height: 1.5rem; /* 文字サイズに合わせる */
    width: auto;
    border-radius: 4px;
}

.site-title {
    font-size: 1.5rem; font-weight: 900; margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.site-title .subtitle {
    font-size: 0.8rem; font-weight: 500;
    -webkit-text-fill-color: var(--text-muted);
    margin-left: 8px;
}

nav ul {
    list-style: none; display: flex; gap: 0.5rem; margin: 0; padding: 0;
}
nav a {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    text-decoration: none; color: var(--text-muted);
    font-weight: 600; font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
}
nav a:hover, nav a.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}
nav a svg { width: 20px; height: 20px; }

.header-right { display: flex; align-items: center; gap: 1rem; }
.user-id-badge {
    font-family: monospace; font-size: 0.75rem;
    background: var(--bg-card); border: 1px solid var(--border);
    padding: 4px 8px; border-radius: 6px; color: var(--text-muted);
}

/* Theme Toggle */
.theme-switcher input { display: none; }
.theme-label {
    cursor: pointer; font-size: 1.2rem;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border);
    transition: 0.2s;
}
.theme-label:hover { border-color: var(--primary); }
.sun-icon { display: none; }
#theme-toggle:checked + .theme-label .sun-icon { display: block; }
#theme-toggle:checked + .theme-label .moon-icon { display: none; }

/* Main Layout */
main {
    max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem;
    min-height: calc(100vh - var(--header-h) - 100px);
}

.content-section { display: none; animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.content-section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toolbar (Filters) */
.toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.filter-group {
    display: flex; background: var(--bg-card); padding: 4px;
    border-radius: 12px; border: 1px solid var(--border);
}
.filter-btn {
    background: transparent; border: none; padding: 8px 20px;
    border-radius: 8px; color: var(--text-muted); font-weight: 600;
    cursor: pointer; transition: 0.2s; font-family: inherit;
}
.filter-btn.active {
    background: var(--primary); color: #fff; box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.text-link {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-weight: 500; text-decoration: underline;
    margin-right: 1rem;
}
.text-link:hover { color: var(--primary); }
.online-counter {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--text-muted);
    background: var(--bg-card); padding: 4px 12px;
    border-radius: 20px; border: 1px solid var(--border);
}
.pulse { color: #22c55e; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* Grid & Cards */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; flex-direction: column;
}

.item-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.thumb-area {
    width: 100%; height: 160px;
    background: #000; position: relative; overflow: hidden;
}
.thumb-area img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease;
}
.item-card:hover .thumb-area img { transform: scale(1.1); }

.no-image-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #2a2a2a; color: #555;
    font-weight: 900; font-size: 1.2rem; letter-spacing: 2px;
}

.ribbon {
    position: absolute; top: 12px; left: -30px;
    width: 120px; text-align: center;
    font-size: 0.7rem; font-weight: 800; color: #fff;
    transform: rotate(-45deg);
    padding: 4px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
    text-transform: uppercase; letter-spacing: 1px;
}
.ribbon.fun { background: var(--color-fun); }
.ribbon.study { background: var(--color-study); }
.ribbon.other { background: var(--color-other); }

.card-body {
    padding: 1.25rem; flex-grow: 1; display: flex; flex-direction: column;
}
.card-title {
    margin: 0 0 0.5rem; font-size: 1.1rem; font-weight: 700;
    line-height: 1.4;
}
.card-desc {
    font-size: 0.85rem; color: var(--text-muted); margin: 0;
    line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.recommend-tag {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    color: #fff; font-size: 0.7rem; padding: 2px 8px;
    border-radius: 4px; font-weight: 700; border: 1px solid rgba(255,255,255,0.2);
    z-index: 5;
}

/* 広告枠スタイル */
.ad-section { width: 100%; text-align: center; margin: 2rem 0; }
.ad-label {
    font-size: 0.7rem; color: var(--text-muted); letter-spacing: 1px;
    margin-bottom: 5px; text-transform: uppercase;
}
.ad-box-large, .ad-box-banner {
    background: var(--bg-card); border: 1px dashed var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    min-height: 100px;
}
.ad-box-large { min-height: 150px; }
.ad-placeholder-text {
    position: absolute; color: var(--border); font-weight: bold; font-size: 1.2rem;
    pointer-events: none; z-index: 0;
}

.ad-card-slot {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 250px; text-align: center;
    position: relative; overflow: hidden;
}
.ad-card-slot .ad-text {
    color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; font-weight: bold;
}

/* FAQ */
.card-container {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 2rem;
    box-shadow: var(--shadow-card);
}
.faq-list dl { margin: 0; }
.faq-list dt {
    font-weight: 700; color: var(--primary); margin-top: 1.5rem;
    font-size: 1.05rem;
}
.faq-list dd {
    margin-left: 0; margin-top: 0.5rem; padding-left: 1rem;
    border-left: 2px solid var(--border); color: var(--text-muted);
}

/* Author */
.author-header { display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.author-img-wrapper img {
    width: 120px; height: 120px; border-radius: 50%;
    border: 4px solid var(--bg-body); box-shadow: 0 0 0 2px var(--primary);
}
.author-text h2 { margin: 0; font-size: 2rem; color: var(--text-main); }
.author-text .role { color: var(--secondary); font-weight: 700; margin: 0.5rem 0; }
.author-text .bio { color: var(--text-muted); }

/* Footer */
.site-footer {
    margin-top: 4rem; padding: 3rem 1rem; text-align: center;
    background: var(--bg-card); border-top: 1px solid var(--border);
}
.footer-links { margin-bottom: 1rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.copyright { color: var(--text-muted); font-size: 0.8rem; }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: 0.3s;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--bg-card); width: 90%; max-width: 500px;
    border-radius: 16px; border: 1px solid var(--border);
    padding: 1.5rem; max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: scale(0.95); transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-content.large { max-width: 700px; }
.modal-content.small { max-width: 400px; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { margin: 0; font-size: 1.25rem; }
.close-modal-btn {
    background: transparent; border: none; font-size: 1.5rem;
    color: var(--text-muted); cursor: pointer;
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-input {
    width: 100%; padding: 12px; background: var(--bg-body); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-main); font-size: 1rem;
    transition: 0.2s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.modal-actions { margin-top: 1.5rem; display: flex; justify-content: flex-end; gap: 10px; }

.btn {
    padding: 10px 24px; border-radius: 8px; border: none; font-weight: 700;
    cursor: pointer; transition: 0.2s; font-size: 0.95rem;
}
.btn.primary { background: linear-gradient(135deg, var(--primary), #4338ca); color: white; box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 12px rgba(79, 70, 229, 0.4); }
.btn.ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--text-main); color: var(--text-main); }
.btn.warning { background: #ef4444; color: white; }

.rating-stars { font-size: 1.5rem; cursor: pointer; color: var(--border); }
.rating-stars span.active { color: #fbbf24; }

/* Details Modal */
.details-body { overflow-y: auto; flex-grow: 1; padding-right: 5px; }
.details-img-container { width: 100%; border-radius: 8px; overflow: hidden; margin-bottom: 1rem; border: 1px solid var(--border); }
.details-img-container img { width: 100%; display: block; }
.ad-box-small {
    margin-top: 1rem; background: rgba(0,0,0,0.2); border: 1px dashed var(--border);
    height: 80px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
}

/* BAN Screen */
.hidden-screen { display: none; position: fixed; inset: 0; background: #000; z-index: 9999; align-items: center; justify-content: center; }
.hidden-screen.visible { display: flex; }
.ban-content { text-align: center; max-width: 600px; padding: 3rem; background: #111; border: 1px solid #333; border-radius: 20px; }
.ban-icon { font-size: 4rem; margin-bottom: 1rem; }
.ban-content h1 { color: #ef4444; margin: 0 0 1rem; }

/* Fake Translator */
#fake-translator {
    position: fixed; inset: 0; background: #fff; z-index: 10000;
    display: flex; flex-direction: column; color: #333;
}
.hidden { display: none !important; }
.trans-header { padding: 1rem 2rem; border-bottom: 1px solid #ddd; font-size: 1.2rem; color: #555; }
.trans-body { padding: 2rem; display: flex; gap: 2rem; height: 100%; }
.trans-body textarea { flex: 1; border: none; resize: none; font-size: 1.4rem; outline: none; }
.trans-divider { width: 1px; background: #ddd; }

/* Toast */
#toast-notification {
    position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 100px);
    background: var(--bg-card); color: var(--text-main); padding: 12px 30px;
    border-radius: 50px; border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); opacity: 0; transition: 0.3s;
    font-weight: 600; pointer-events: none;
}
#toast-notification.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 768px) {
    .site-header { padding: 0 1rem; }
    nav span { display: none; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .action-group { justify-content: space-between; margin-top: 1rem; display: flex; }
}
