/* site.css - 共通スタイル
   - 変数でテーマを切り替えやすく
   - header / nav / hero / panels / tiles / grid / responsive を含む
*/

:root {
    --bg: #f5f9ff;
    --bg-soft-1: #eef4ff;
    --bg-soft-2: #f8fbff;
    --bg-glow-a: rgba(30, 91, 215, .12);
    --bg-glow-b: rgba(255, 204, 0, .14);
    --card: #ffffff;
    --text: #111;
    --muted: #667085;
    --border: #e6e8ef;
    --shadow: 0 6px 18px rgba(16, 24, 40, .06);
    --radius: 14px;
    --accent: #1e5bd7;
    --accent2: #ffcc00;
    --max-width: 100%;
    --site-header-h: 0px;
}

/* base */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", "M PLUS Rounded 1c", sans-serif;
    margin: 0;
    background:
        radial-gradient(1200px 520px at 8% -8%, var(--bg-glow-a) 0%, rgba(30, 91, 215, 0) 62%),
        radial-gradient(920px 420px at 92% 2%, var(--bg-glow-b) 0%, rgba(255, 204, 0, 0) 58%),
        linear-gradient(180deg, var(--bg-soft-2) 0%, var(--bg) 46%, var(--bg-soft-1) 100%);
    background-attachment: fixed;
    color: var(--text);
}

body.has-fixed-header {
    padding-top: var(--site-header-h);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--muted);
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 800;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    color: #98a2b3;
}

.breadcrumb-current {
    color: #344054;
    font-weight: 800;
}

/* logo (ball-like) */
.logo {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: linear-gradient(#e53935 0 50%, #ffffff 50% 100%);
    border: 2px solid #111;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.logo::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 3px;
    background: #111;
    transform: translateY(-50%);
}

.logo::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid #111;
    transform: translate(-50%, -50%);
}

.accent {
    color: var(--accent2);
}

/* header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.header-top {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.main-title {
    font-size: 22px;
    font-weight: 900;
    margin: 0;
    line-height: 1.1;
    white-space: nowrap;
    font-family: "M PLUS Rounded 1c", system-ui;
}

/* header search */
.header-search {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-wrap {
    width: min(520px, 100%);
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(16, 24, 40, .05);
}

.search-wrap input {
    width: 100%;
    border: 0;
    outline: 0;
    font-size: 14px;
    background: transparent;
}

.has-search-autocomplete {
    position: relative;
}

.search-autocomplete {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 90;
    border: 1px solid #d4deee;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(20, 42, 78, .08);
    overflow: hidden;
    max-height: min(52vh, 420px);
    overflow-y: auto;
}

.search-suggest-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eef2f8;
    background: #fff;
    text-align: left;
    padding: 8px 12px;
    color: #172033;
    cursor: pointer;
    min-height: 60px;
}

.search-suggest-item:last-of-type {
    border-bottom: 0;
}

.search-suggest-item:hover,
.search-suggest-item.is-active {
    background: #f3f8ff;
}

.search-suggest-thumb-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #deebff;
    background: linear-gradient(180deg, #f8fbff 0%, #edf4ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-suggest-thumb-wrap.is-empty::before {
    content: "●";
    color: #7f98bb;
    font-size: 10px;
}

.search-suggest-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-suggest-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.search-suggest-name {
    display: block;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    color: #162235;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggest-sub {
    font-size: 12px;
    font-weight: 600;
    color: #7a8598;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggest-price {
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    color: #2b3f5f;
    flex-shrink: 0;
    padding-left: 8px;
}

.search-suggest-action {
    width: 100%;
    border: 0;
    border-top: 1px solid #e8eef8;
    background: #f8fbff;
    text-align: left;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.search-suggest-action:hover {
    background: #f1f7ff;
}

.search-suggest-action-label {
    font-size: 13px;
    font-weight: 700;
    color: #24426b;
}

.search-suggest-action-arrow {
    color: #5d769b;
    font-size: 13px;
}

.search-suggest-history {
    border-top: 1px solid #e8eef8;
    background: #fbfdff;
    padding: 6px 8px;
}

.search-suggest-history-title {
    font-size: 11px;
    color: #7a879c;
    font-weight: 700;
    padding: 2px 4px 6px;
}

.search-suggest-history-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 7px 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.search-suggest-history-item:hover {
    background: #f2f7ff;
}

.search-suggest-history-icon {
    color: #7a8da9;
    font-size: 12px;
    flex: 0 0 auto;
}

.search-suggest-history-text {
    font-size: 12px;
    color: #2a3b56;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* header bottom nav */
.header-bottom {
    position: relative;
    z-index: 1;
    background: #111;
    border-top: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .18);
}

.header-bottom-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav {
    display: flex;
    gap: 10px;
    width: max-content;
    min-width: max-content;
    flex: 0 0 auto;
}

.nav a {
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 900;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    white-space: nowrap;
    line-height: 1.2;
}

.nav a:hover {
    background: rgba(255, 255, 255, .12);
}

.nav a.is-active {
    background: rgba(255, 255, 255, .20);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18) inset;
}

/* hero */
.hero {
    margin-top: 18px;
}

.hero-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.hero-title {
    font-size: 18px;
    font-weight: 900;
    margin: 0;
}

.hero-desc {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.data-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

/* panels */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

/* grid / tiles / cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    box-shadow: var(--shadow);
    position: relative;
}

.thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .08);
    background: #f2f4f7;
    transition: transform .2s ease;
}


.thumb-link {
    display: block;
    border-radius: 14px;
    overflow: hidden;
}

.thumb-link:hover {
    text-decoration: none;
}

.card:hover .thumb {
    transform: scale(1.02);
}

.title {
    font-weight: 900;
    font-size: 14px;
    margin: 10px 0 6px;
}

.meta {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}

/* tile (rail) */
.rail {
    display: flex;
    gap: 12px;
    overflow: auto;
    padding: 4px 2px 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.tile {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: 180px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 4px 14px rgba(16, 24, 40, .06);
    position: relative;
}

a[data-sleeve-link="1"] {
    transition: transform .16s ease, box-shadow .22s ease, border-color .22s ease, background-color .22s ease;
    transform: translateZ(0);
}

a.tile[data-sleeve-link="1"]:hover,
a.btn[data-sleeve-link="1"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(30, 91, 215, .18);
}

a[data-sleeve-link="1"]:focus-visible {
    outline: 2px solid #7aa2ff;
    outline-offset: 2px;
}

a[data-sleeve-link="1"].is-selected-sleeve {
    border-color: #86abff;
    box-shadow: 0 0 0 2px rgba(30, 91, 215, .18), 0 12px 28px rgba(30, 91, 215, .22);
}

a[data-sleeve-link="1"].is-picked {
    transform: translateY(-7px) scale(1.02);
    box-shadow: 0 16px 34px rgba(30, 91, 215, .30);
}

@media (prefers-reduced-motion: reduce) {
    a[data-sleeve-link="1"] {
        transition: none;
    }
}

.tile-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    background: #f2f4f7;
    display: block;
}

/* badges */
.badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #ffe082;
    background: #fff8cc;
    color: #5c4b00;
    font-weight: 700;
}

/* small UI */
.pill {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #ffe082;
    background: #fff8cc;
    color: #5c4b00;
    font-weight: 800;
}

.btn {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: #111;
    font-weight: 900;
    font-size: 12px;
}

/* delta / chips */
.delta {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.chip {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #f6f8ff;
    color: #111;
    font-weight: 800;
}

.up {
    color: #d32f2f;
}

.down {
    color: #1976d2;
}

.flat {
    color: #667085;
}

/* rank */
.rank-row {
    display: flex;
    align-items: flex-start;
    /* ← center → flex-start */
    gap: 8px;
    margin-top: 10px;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-weight: 900;
    font-size: 12px;
    flex-shrink: 0;
    /* ← 追加：バッジが潰れないように */
    margin-top: 1px;
    /* ← 追加：テキストの上端と視覚的に揃える */
}

.rank-row .title {
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* ← 追加：2行でクランプ */
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

/* error */
.error {
    background: #fff3f3;
    border: 1px solid #ffcccc;
    padding: 12px;
    border-radius: 12px;
    color: #b00020;
    margin-bottom: 12px;
    display: none;
}

/* footer */
footer.site-footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* responsive */
@media (max-width:900px) {
    .main {
        grid-template-columns: 1fr;
    }

    .rail-btn {
        display: none;
    }

    .tile {
        width: 150px;
    }
}

@media (max-width:700px) {
    .header-top {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 10px;
        row-gap: 10px;
        padding: 10px 14px;
    }

    .logo {
        width: 32px;
        height: 32px;
    }

    .main-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-right {
        display: none;
    }

    .header-search {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: flex-start;
    }

    .search-wrap {
        width: 100%;
        border-radius: 12px;
        padding: 10px 12px;
    }

    .search-wrap input {
        font-size: 16px;
    }

    .search-autocomplete {
        top: calc(100% + 6px);
        border-radius: 14px;
        max-height: min(52vh, 360px);
    }

    .search-suggest-item {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 8px;
        padding: 8px 10px;
        min-height: 56px;
    }

    .search-suggest-thumb-wrap {
        width: 40px;
        height: 40px;
    }

    .search-suggest-name {
        font-size: 13px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .search-suggest-sub,
    .search-suggest-price,
    .search-suggest-action-label {
        font-size: 12px;
    }

    .header-bottom-inner {
        padding: 8px 14px;
    }

    .nav {
        gap: 8px;
    }

    .nav a {
        white-space: nowrap;
        font-size: 12px;
        padding: 7px 9px;
    }

}

@media (max-width:600px) {
    .container {
        padding: 14px;
    }

    .thumb {
        height: 130px;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

/* ===== sections / head ===== */
.sections {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.more {
    font-size: 13px;
    font-weight: 800;
    color: var(--accent);
    white-space: nowrap;
}

/* ===== rail buttons ===== */
.rail-wrap {
    position: relative;
}

.rail-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 8px 18px rgba(16, 24, 40, .10);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #111;
    user-select: none;
    z-index: 2;
}

.rail-btn:hover {
    background: #fff;
}

.rail-btn.left {
    left: -10px;
}

.rail-btn.right {
    right: -10px;
}

@media (max-width: 900px) {
    .rail-btn.left {
        left: -6px;
    }

    .rail-btn.right {
        right: -6px;
    }
}

/* ===== tile (rail) text styles ===== */
.tile {
    color: inherit;
    /* ←青リンク化を防ぐ */
    text-decoration: none;
    /* ←下線を防ぐ */
}

.tile:hover {
    text-decoration: none;
    outline: 2px solid rgba(30, 91, 215, .10);
}

.tile-name {
    font-size: 13px;
    font-weight: 900;
    margin: 10px 0 6px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
}

.tile-price {
    font-size: 15px;
    font-weight: 900;
    margin: 0;
}

.tile-sub {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
}

.tile-rank-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    min-width: 36px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    background: rgba(17, 17, 17, .88);
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
    z-index: 2;
    pointer-events: none;
}

.chipline {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== filter panel polish ===== */
.panel h2 {
    font-size: 16px;
    font-weight: 900;
    margin: 0 0 6px;
}

.panel .small {
    margin: 0 0 14px;
    font-size: 12px;
    color: var(--muted);
}

/* controls layout */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

/* each field becomes a mini-card */
.controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #1f2a37;
    padding: 10px 10px 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
    box-shadow: 0 6px 16px rgba(16, 24, 40, .06);
    min-width: 160px;
}

/* select */
.controls select {
    width: 100%;
    border: 1px solid rgba(16, 24, 40, .10);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(16, 24, 40, .06);
    background-image:
        linear-gradient(45deg, transparent 50%, #111 50%),
        linear-gradient(135deg, #111 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.controls select:focus {
    outline: none;
    border-color: rgba(30, 91, 215, .55);
    box-shadow: 0 0 0 4px rgba(30, 91, 215, .12), 0 2px 10px rgba(16, 24, 40, .06);
}

/* clear button */
.controls button#clear {
    height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(16, 24, 40, .10);
    background: #111;
    color: #fff;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(16, 24, 40, .14);
}

.controls button#clear:hover {
    opacity: .92;
}

/* tighten on small screens */
@media (max-width: 700px) {
    .controls label {
        min-width: calc(50% - 6px);
    }

    .controls button#clear {
        width: 100%;
    }
}
