/* 基本スタイルのリセット */
body,
h1,
h2,
footer,
p {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全体のスタイル */
body {
    font-family: 'Helvetica Neue', 'Arial', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
    background-color: #ffffff;
    /* 少しグレーがかった白 */
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    padding: 40px 20px;
    position: relative;
}

/* サイトタイトル */
.site-title {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 60px;
    padding-top: 20px;
    perspective: 1000px;
    /* 遠近感 */
    position: relative;
}

.user-profile {
    position: absolute;
    top: 2px;
    right: 0;
    z-index: 100;
}

.user-profile img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #ffffff;
    padding: 2px;
    box-sizing: border-box;
}

.user-profile a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 12px 2px 2px;
    background-color: #007bff;
    color: #ffffff;
    border-radius: 30px 0 0 30px;
    font-weight: bold;
    font-size: 12px;
    text-decoration: none;
    border: 2px solid #ccc;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease;
}

:root {
    --carousel-radius: 240px;
}

@media (max-width: 768px) {
    :root {
        --carousel-radius: 170px;
    }
}

.user-profile a:hover {
    background-color: #0056b3;
}

.user-profile .login-link {
    padding: 8px 18px 8px 24px;
}

.cube-container {
    display: flex;
    gap: 40px;
    /* ブロック間の隙間 */
    transform-style: preserve-3d;
}

.cube {
    width: 50px;
    height: 50px;
    position: relative;
    transform-style: preserve-3d;
    /* 左手前と右手前が均等に見えるように調整 */
    transform: rotateX(-25deg) rotateY(-45deg);
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.cube:hover {
    /* マウスオーバーで横回転 */
    transform: rotateX(-25deg) rotateY(315deg);
}

.face {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-family: 'Arial Black', 'Helvetica Neue', sans-serif;
    /* 太めのフォント */
    color: #333;
    box-sizing: border-box;
    user-select: none;
    background-color: #fff;
    border-radius: 8px;
    /* 角を丸めてサイコロ風に */
}

/* 立方体の面構成 (サイズ50px / 2 = 25px) */
/* 光源を左上と想定して各面の明るさを調整 */
.front {
    transform: translateZ(25px);
    background-color: #e9ecef;
    /* 左手前：光源が左奥なので少し影 */
}

/* 文字面 */
.back {
    transform: rotateY(180deg) translateZ(25px);
}

.right {
    transform: rotateY(90deg) translateZ(25px);
    background-color: #dee2e6;
    /* 右手前：文字面。光源の反対側なので影 */
    /* 刻印風デザイン: 文字色を背景に馴染ませ、ハイライトと影で凹みを表現 */
    color: #adb5bd;
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 rgba(0, 0, 0, 0.15);
}

.left {
    transform: rotateY(-90deg) translateZ(25px);
    background-color: #f8f9fa;
    /* 左側面 */
}

/* 左側面（影） */
.top {
    transform: rotateX(90deg) translateZ(25px);
    background-color: #ffffff;
}

/* 上面（ハイライト） */
.bottom {
    transform: rotateX(-90deg) translateZ(25px);
    background-color: #ced4da;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* 底面（影） */

/* リアルな影（床への落ち影） */
.cube::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 光源が左後方上空 -> 影は右前方（手前）に落ちる */
    transform: translateZ(-50px) translateY(45px) translateX(15px) rotateX(90deg);
    background: rgba(0, 0, 0, 0.1);
    filter: blur(15px);
    /* 影をより柔らかくぼかす */
    border-radius: 50%;
    /* 影の形状 */
}

/* 4番目のキューブ（数字の9）だけ赤くする */
.cube-container .cube:nth-child(4) .face.right {
    color: #e03131;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6), -1px -1px 0 rgba(0, 0, 0, 0.1);
}

/* インタラクションエリア（操作可能範囲を拡張） */
.interaction-area {
    position: relative;
    width: 100%;
    margin: 60px 0 100px;
    display: flex;
    justify-content: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

/* カードコンテナ */
.container {
    position: relative;
    width: 180px;
    height: 200px;
    perspective: 1000px;
}

.carousel {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
}

/* カードのスタイル */
.card {
    position: relative;
    display: block;
    width: 180px;
    height: auto;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: transparent;
    border-radius: 15px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    border: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
    /* 選択防止 */
    user-select: none;
    -webkit-user-select: none;
}

.card:nth-child(1) {
    transform: rotateY(0deg) translateZ(var(--carousel-radius));
}

.card:nth-child(2) {
    transform: rotateY(90deg) translateZ(var(--carousel-radius));
}

.card:nth-child(3) {
    transform: rotateY(180deg) translateZ(var(--carousel-radius));
}

.card:nth-child(4) {
    transform: rotateY(270deg) translateZ(var(--carousel-radius));
}

/* カード画像 */
.card-image {
    width: 100%;
    height: auto;
    border-radius: 15px;
    display: block;
    margin: 0 auto;
    /* 画像のドラッグ防止 */
    pointer-events: none;
}

/* スマートフォン向けのレスポンシブ対応 */
@media (max-width: 768px) {
    body {
        padding: 30px 15px;
        /* 全体の余白を調整 */
    }

    .site-title {
        margin-bottom: 40px;
        /* タイトル下の余白を調整 */
    }

    .cube-container {
        transform: scale(0.6);
        /* スマホでは全体を縮小 */
        gap: 8px;
    }

    .site-footer {
        margin-top: 40px;
        /* フッター上の余白を調整 */
    }

    .top10-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .top10-item {
        width: 100%;
        max-width: 400px;
        /* テーブルが広がりすぎないように */
    }
}

/* フッター */
.site-footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #e9ecef;
    /* コンテンツとの区切り線 */
}

.social-link {
    display: inline-block;
    color: #888;
    /* 少し控えめな色 */
    transition: transform 0.3s ease, color 0.3s ease;
}

.social-link:hover {
    color: #000;
    /* ホバーで黒に */
    transform: scale(1.1);
    /* 少し拡大 */
}

.social-link svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
    /* 親要素の色を継承 */
}

.info-layer {
    position: relative;
    text-align: center;
    margin-top: -60px;
    margin-bottom: 60px;
    /* 高さはJSで制御 */
    width: 100%;
    /* overflow: hidden; */
    transition: height 0.3s ease;
    box-sizing: border-box;
}

.interaction-hint {
    text-align: center;
    color: #b0b0b0;
    font-size: 14px;
    margin-top: -80px;
    margin-bottom: 80px;
    user-select: none;
}

.info-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: 20px;
    box-sizing: border-box;
    padding-left: 15px;
    padding-right: 15px;
}

.info-item.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.info-item h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #333;
    width: 100%;
    max-width: 500px;
    text-align: left;
}

.info-item p {
    font-size: 0.95rem;
    color: #666;
    width: 100%;
    max-width: 500px;
    text-align: left;
}

.read-more-link,
.read-less-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
    margin-left: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.read-more-link:hover,
.read-less-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .info-layer {
        margin-top: -40px;
        padding: 0 20px;
    }
}

.ranking-container {
    width: 100%;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    overflow-x: auto;
}

.base-table {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    border-collapse: collapse;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
    border: 2px solid #ccc;
    border-radius: 12px;
    overflow: hidden;
    font-size: 0.9em;
}

.base-table th,
.base-table td {
    border-bottom: 1px solid #f0f0f0;
}

.base-table th {
    background-color: #66b0ff;
    color: #ffffff;
    font-weight: 600;
}

.top10-table th,
.top10-table td {
    padding: 10px;
    text-align: left;
    white-space: nowrap;
}

.top10-table th {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.top10-table th:first-child,
.top10-table td:first-child {
    text-align: right;
}

.top10-table tbody tr:last-child td {
    border-bottom: none;
}

.top10-table tbody tr:hover {
    background-color: #f8f9fa;
}

.top10-table tbody tr.rank-1 {
    background-color: #fffbeb;
    /* Light gold */
    font-weight: 600;
}

.top10-table tbody tr.rank-1:hover {
    background-color: #fef3c7;
    /* Slightly darker gold on hover */
}

.user-name-cell {
    position: relative;
    overflow: hidden;
}

.rank-bg-icon {
    position: absolute;
    top: -50%;
    left: 0;
    height: 200%;
    width: auto;
    opacity: 0.5;
    object-fit: cover;
    pointer-events: none;
}

.user-name-text {
    position: relative;
    z-index: 1;
    font-weight: bold;
    text-shadow:
        1px 1px 0 #fff, -1px -1px 0 #fff,
        -1px 1px 0 #fff, 1px -1px 0 #fff,
        0 1px 0 #fff, 0 -1px 0 #fff,
        -1px 0 0 #fff, 1px 0 0 #fff;
}

.bbs-preview-container {
    width: 100%;
    max-width: 500px;
}

.bbs-table {
    table-layout: fixed;
}

.bbs-table th,
.bbs-table td {
    padding: 10px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.bbs-table th:first-child,
.bbs-table td:first-child {
    text-align: left;
    width: 50%;
}

.base-table tbody tr.thread-row {
    cursor: pointer;
}

.base-table tbody tr.thread-row:hover {
    background-color: #d6d8db;
}

.base-table tbody tr.thread-row:active {
    background-color: #c6c8cb;
}

.bbs-thread-title {
    text-align: left;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 1;
}

.bbs-link-row td {
    text-align: center !important;
    background-color: #f0f2f5;
    white-space: nowrap;
}

.bbs-link-row:hover {
    background-color: #e4e6e9 !important;
}

.bbs-link {
    display: block;
    text-decoration: none;
    color: #007bff;
}