/* Anko Ranking Widget */
.anko-ranking {
    font-size: 14px;
    line-height: 1.5;
}

.anko-ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.anko-ranking-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.anko-ranking-item:last-child {
    border-bottom: none;
}

.anko-ranking-badge {
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    border-radius: 4px;
    background: #e8e8e8;
    color: #333;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    line-height: 22px;
}

.anko-ranking-badge-1 {
    background: #f5b301;
    color: #fff;
}

.anko-ranking-badge-2 {
    background: #9aa5b1;
    color: #fff;
}

.anko-ranking-badge-3 {
    background: #c47b42;
    color: #fff;
}

.anko-ranking-thumb {
    flex: 0 0 auto;
}

.anko-ranking-thumb img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
}

.anko-ranking-body {
    flex: 1 1 auto;
    min-width: 0;
}

.anko-ranking-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.45;
    word-break: normal;
    overflow-wrap: break-word;
}

.anko-ranking-title:hover {
    text-decoration: underline;
}

.anko-ranking-meta {
    margin-top: 3px;
    font-size: 12.5px;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.anko-ranking-price {
    color: #b12704;
    font-weight: 700;
}

.anko-ranking-stars {
    color: #e47911;
}

.anko-ranking-move-up {
    color: #067d62;
}

.anko-ranking-move-down {
    color: #b12704;
}

.anko-ranking-move-new {
    color: #e47911;
    font-weight: 700;
    font-size: 11px;
}

.anko-ranking-drop {
    display: inline-block;
    background: #067d62;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    padding: 1px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

.anko-ranking-date {
    margin: 6px 0 0;
    font-size: 12px;
    color: #888;
    text-align: right;
}

/* Footer "see more on Amazon" button (v1.7.0) */
.anko-ranking-more {
    margin: 8px 0 0;
}

.anko-ranking-more-btn {
    display: block;
    padding: 7px 10px;
    background: #ff8c00;
    color: #fff !important;
    text-align: center;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 13px;
    border-radius: 6px;
}

.anko-ranking-more-btn:hover {
    background: #e67e00;
}

/* Tabbed variant
   The tab bar never wraps: it scrolls sideways instead, so tabs also work
   in narrow, tall placements such as a sidebar. */
.anko-ranking-tabs-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-bottom: 6px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.12);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    max-width: 100%;
    box-sizing: border-box;
}

.anko-ranking-tab {
    appearance: none;
    flex: 0 0 auto;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-bottom: none;
    background: #f2f2f2;
    padding: 6px 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    margin-bottom: -2px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Narrow demo / sidebar-width tabbed block */
.anko-ranking-narrow {
    max-width: 340px;
    box-sizing: border-box;
}

.anko-ranking-tab:hover {
    color: #111;
    background: #e7e7e7;
}

.anko-ranking-tab.is-active {
    background: #f5b301;
    border-color: #f5b301;
    color: #fff;
}

.anko-ranking-tab-panel[hidden] {
    display: none;
}

/* Horizontal scroll (carousel) variant */
.anko-ranking-scroll {
    max-width: 100%;
    box-sizing: border-box;
}

.anko-ranking-scroll-wrap {
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
}

.anko-ranking-cards {
    display: flex;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 4px 2px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    max-width: 100%;
    box-sizing: border-box;
}

.anko-ranking-card {
    position: relative;
    flex: 0 0 168px;
    width: 168px;
    scroll-snap-align: start;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.anko-ranking-card .anko-ranking-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
}

.anko-ranking-card-thumb {
    display: block;
}

.anko-ranking-card-thumb img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    display: block;
}

.anko-ranking-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.anko-ranking-card-body .anko-ranking-title {
    font-size: 13.5px;
    margin-top: 6px;
    /* Reserve exactly two lines so card heights stay uniform
       even when a title is short. */
    min-height: calc(1.45em * 2);
}

.anko-ranking-card-meta {
    margin-top: 4px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 12.5px;
    color: #555;
}

.anko-ranking-card-meta .anko-ranking-price {
    font-size: 16px;
}

.anko-ranking-amazon-btn {
    margin-top: auto;
    padding-top: 7px;
    padding-bottom: 7px;
    background: #ff8c00;
    color: #fff !important;
    text-align: center;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 13px;
    border-radius: 6px;
    display: block;
}

.anko-ranking-amazon-btn:hover {
    background: #e67e00;
}

.anko-ranking-scroll-btn {
    position: absolute;
    top: 64px;
    z-index: 3;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(177, 39, 4, 0.92);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    padding: 0;
}

.anko-ranking-scroll-btn.is-prev {
    left: 2px;
}

.anko-ranking-scroll-btn.is-next {
    right: 2px;
}

@media (max-width: 480px) {
    .anko-ranking-card {
        flex-basis: 144px;
        width: 144px;
        padding: 8px;
    }

    .anko-ranking-card-thumb img {
        height: 100px;
    }

    .anko-ranking-scroll-btn {
        width: 30px;
        height: 30px;
        top: 52px;
    }

    .anko-ranking-tab {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* 追従サイドバー向け（コンパクト＋高さ上限） */
.anko-ranking-sticky {
    font-size: 13px;
}

.anko-ranking-sticky .anko-ranking-item {
    gap: 8px;
    padding: 7px 0;
}

.anko-ranking-sticky .anko-ranking-rank {
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
}

.anko-ranking-sticky .anko-ranking-thumb {
    width: 56px;
    height: 56px;
}

.anko-ranking-sticky .anko-ranking-title {
    font-size: 13.5px;
}

.anko-ranking-sticky .anko-ranking-meta {
    font-size: 11.5px;
    gap: 2px 6px;
}

.anko-ranking-sticky .anko-ranking-tab {
    padding: 5px 9px;
    font-size: 12.5px;
}

.anko-ranking-sticky .anko-ranking-date {
    font-size: 11px;
}

/* PC幅ではリスト部分だけを画面高に収め、はみ出す分は内部スクロールにする
   （追従サイドバーで画面下に切れないようにするため） */
@media (min-width: 1024px) {
    .anko-ranking-sticky .anko-ranking-list {
        max-height: calc(100vh - 300px);
        min-height: 200px;
        overflow-y: auto;
        scrollbar-width: thin;
    }
}
