/* Free downloads page */
.page-main {
    padding: 0 20px 28px;
}

.page-header {
    max-width: min(1100px, 96vw);
    margin: 14px auto 12px;
}

.page-title {
    margin: 0 0 4px;
    font-size: clamp(22px, 4vw, 32px);
}

.page-lead {
    margin: 0;
    color: #5b6470;
    font-size: clamp(14px, 2.6vw, 16px);
}

/* デバイス切替チップ */
.dl-dev {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.dl-chip {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .35rem .7rem;
    border: 1px solid #d9e4f2;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: .9rem;
    text-decoration: none;
    transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.dl-chip:hover {
    background: #f7fbff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.dl-chip.is-active {
    background: #eef4ff;
    color: #4f46e5;
    border-color: transparent;
}

/* カードグリッド */
.dl-grid {
    --min: 280px;
    --gap: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr));
    gap: var(--gap);
    max-width: min(1100px, 96vw);
    margin: 18px auto 0;
}

.dl-card {
    position: relative;
    background: #fff;
    border: 1px solid #e7eef6;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
    overflow: hidden;
    transition: transform .16s ease, box-shadow .16s ease;
}

.dl-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .10);
}

/* バッジ */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
}

.badge.new {
    background: #f43f5e;
}

.badge.upd {
    background: #22c55e;
}

/* サムネ（ギャラリー） */
.dl-thumb {
    aspect-ratio: 16/9;
    background: #f3f7fb;
    overflow: hidden;
    position: relative;
    display: block;
}

.dl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 右下アクション（⬇ / ＋） */
.thumb-actions {
    position: absolute;
    right: .6rem;
    bottom: .6rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #dfe7f3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .08);
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    color: #374151;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, .12);
}

@media (max-width:600px) {
    .action-btn {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
}

/* 本文をコンパクトに */
.dl-body {
    padding: 12px 14px 14px;
}

.dl-body.dl-compact {
    padding: 8px 12px 10px;
}

.dl-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
}

.dl-desc {
    margin: 0 0 8px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

/* 1〜2行クランプ（説明を短く） */
.clamp-1 {
    display: -webkit-box;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
}

.clamp-2 {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ボタン系（既存） */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
    border: 1px solid #d9e4f2;
    background: #fff;
    padding: 8px 12px;
    font-size: 14px;
    text-decoration: none;
    color: #374151;
    transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.btn:hover {
    background: #f7fbff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.btn-outline {
    background: #fff;
}

.btn-dl .filetype {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    font-weight: 700;
    background: #eef4ff;
    color: #4f46e5;
    padding: 2px 6px;
    border-radius: 6px;
}

.btn-dl .filesize {
    opacity: .7;
    font-size: 12px;
    margin-left: 2px;
}

.btn-dl .note {
    opacity: .9;
    font-size: 12px;
    margin-left: .2em;
}

.btn-dl .devtag {
    margin-left: .4em;
    padding: 0 .45em;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: #ecfeff;
    color: #0891b2;
    border: 1px solid #c7f9ff;
}

/* サイズ一覧（アコーディオン） */
.dl-sizes {
    list-style: none;
    padding: 0;
    margin: 6px 0 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dl-sizes[hidden] {
    display: none;
}

.dl-empty {
    color: #9aa2ad;
    font-size: 13px;
    padding: 6px 0 2px;
}

/* ライセンス表記 */
.dl-license {
    margin: 6px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.dl-license a {
    color: #5f68ff;
    text-decoration-color: #b6b9ff;
}

/* Tooltip */
.has-tip {
    position: relative;
}

.has-tip[data-tip]:hover::after,
.has-tip[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    z-index: 5;
    background: #fff;
    color: #0f172a;
    border: 1px solid #dfe7f3;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}

.dl-thumb.has-tip:hover::after,
.dl-thumb.has-tip:focus-within::after {
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.has-tip[data-tip-pos="left"]:hover::after,
.has-tip[data-tip-pos="left"]:focus-visible::after {
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

/* スクリーンリーダー専用（見出しを非表示で残す） */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 1px, 1px) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width:600px) {
    .dl-grid {
        --min: 220px;
        --gap: 12px;
    }
}