:root{
  --bg:#ffffff;
  --text:#111111;
  --muted:#6b7280;
  --border:#e5e7eb;
  --red:#d7000f;       /* 日の丸っぽい赤 */
  --red2:#ff1a1a;      /* 強い差し色 */
  --card:#ffffff;
  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --radius: 18px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,#fff 0%, #fff 60%, #fff5f5 100%);
}

a{ color:inherit; text-decoration:none; }
.container{ width:min(1100px, 92vw); margin:0 auto; }

.topbar{
  position:sticky; top:0; z-index:50;
  background:rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
}
.nav{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 0;
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight:800; letter-spacing:.02em;
}
.brand .dot{
  width:34px; height:34px; border-radius:999px;
  background:radial-gradient(circle at 30% 30%, var(--red2), var(--red));
  box-shadow: 0 10px 18px rgba(215,0,15,.25);
}
.navlinks{ display:flex; gap:14px; align-items:center; }
.menu-toggle{
  display:none;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  width:44px;
  height:44px;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}
.navlinks a{
  padding:10px 12px; border-radius:12px; color:var(--muted);
}
.navlinks a.active, .navlinks a:hover{
  color:var(--text);
  background:#fff2f2;
}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
  font-weight:700;
}
.btn.red{
  background:linear-gradient(180deg, var(--red2), var(--red));
  border-color:transparent;
  color:#fff;
  box-shadow: 0 12px 20px rgba(215,0,15,.25);
}
.btn.ghost{
  background:transparent;
}

.hero{
  padding:26px 0 10px;
}
.heroCard{
  border:1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background:
    radial-gradient(circle at 70% 20%, rgba(215,0,15,.12), transparent 38%),
    radial-gradient(circle at 20% 80%, rgba(255,26,26,.10), transparent 40%),
    #fff;
  box-shadow: var(--shadow);
  padding:22px;
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:18px;
}
.h1{ font-size: clamp(22px, 3vw, 36px); margin:0 0 10px; }
.p{ margin:0; color:var(--muted); line-height:1.6; }

.kpis{ display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; margin-top:16px; }
.kpi{
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:12px;
  background:#fff;
}
.kpi b{ font-size:18px; }
.kpi span{ display:block; color:var(--muted); font-size:12px; margin-top:4px; }

.card{
  border:1px solid var(--border);
  background:var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section{ padding:18px 0 28px; }
.sectionTitle{ display:flex; align-items:end; justify-content:space-between; gap:12px; margin:0 0 12px; }
.sectionTitle h2{ margin:0; font-size:18px; }
.sectionTitle small{ color:var(--muted); }

.grid{
  display:grid; gap:14px;
  grid-template-columns: repeat(3, 1fr);
}
.item{
  padding:14px;
}
.badges{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.badge{
  font-size:12px; padding:6px 10px; border-radius:999px;
  border:1px solid var(--border); color:var(--muted); background:#fff;
}
.badge.red{ border-color: rgba(215,0,15,.2); color:var(--red); background:#fff0f0; }
.badge.dark{ border-color:#111; color:#111; background:#fff; }

.row{ display:flex; justify-content:space-between; gap:10px; }
.priceLock{
  border:1px dashed rgba(215,0,15,.45);
  background: linear-gradient(180deg, #fff, #fff6f6);
  padding:12px;
  border-radius: var(--radius);
}
.lockMsg{ color:var(--muted); font-size:13px; margin-top:6px; }

.form{
  display:grid; gap:12px;
}
.input, select{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  outline:none;
}
.input:focus, select:focus{
  border-color: rgba(215,0,15,.45);
  box-shadow: 0 0 0 4px rgba(215,0,15,.10);
}

.footer{
  padding:26px 0;
  border-top:1px solid var(--border);
  color:var(--muted);
  font-size:13px;
}

@media (max-width: 900px){
  .heroCard{ grid-template-columns: 1fr; }
  .grid{ grid-template-columns: 1fr; }
  .kpis{ grid-template-columns: 1fr; }
  .topbar .navlinks{ display:none; }
  .mypageScope .navlinks{ display:flex; }
  .detailGrid{ grid-template-columns: 1fr !important; }
}

@media (max-width: 768px){
  .topbar .nav{
    position:relative;
    gap:10px;
  }
  .topbar .menu-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    margin-left:auto;
  }
  .topbar .topbar-actions{
    display:none !important;
  }
  .topbar .mobile-nav{
    display:none;
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    width:min(240px, 78vw);
    background:#fff;
    border:1px solid var(--border);
    border-radius:12px;
    box-shadow:0 10px 30px rgba(0,0,0,.1);
    padding:8px;
    z-index:80;
    flex-direction:column;
    align-items:stretch;
    gap:4px;
  }
  .topbar .mobile-nav.is-open{
    display:flex;
  }
}

.galleryRow{
  display:flex;
  gap:10px;
  margin-top:10px;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.galleryRow > div{ flex: 0 0 auto; }
.galleryRow > img{ flex: 0 0 auto; }

.listingDetailGrid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:14px;
}
.listingDetailTitle{ margin-top:6px; margin-bottom:6px; }
.listingDetailSection{ margin-top:12px; }
.listingDetailInfoGrid{ margin-top:10px; display:grid; gap:10px; }
.listingGalleryImage,
.listingGalleryEmpty{
  min-width:160px;
  width:160px;
  height:110px;
  border:1px solid var(--border);
  border-radius:14px;
  object-fit:cover;
  background:#fff2f2;
}
.listingGalleryEmpty{
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  font-size:13px;
}
.listingStatusFlow{
  margin-top:10px;
  display:grid;
  gap:8px;
}


.pageHeader h1{ margin:0; font-size:24px; }
.pageHeader p{ margin:8px 0 0; color:var(--muted); }

.panel{ padding:16px; }
.note{ color:var(--muted); font-size:13px; }

.formLabel{ display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
.toolbar{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.fieldGrow{ min-width:220px; flex:1; }
.buttonRow{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

.searchGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}
.searchActions{ display:flex; gap:10px; align-items:end; }

.resultGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
.resultCard{ padding:14px; }
.resultCard h3{ margin:0 0 10px; font-size:17px; }
.resultCard .meta{ color:var(--muted); font-size:13px; display:grid; gap:4px; }

.listRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.listRow:last-child{ border-bottom:none; padding-bottom:0; }

.pager{ margin-top:14px; }

@media (max-width: 900px){
  .searchGrid{ grid-template-columns:1fr; }
  .resultGrid{ grid-template-columns:1fr; }
  .listingDetailGrid{ grid-template-columns:1fr; }
}

/* mypage ui tuning */
.mypageWrap{
  display:grid;
  grid-template-columns: 280px minmax(0,1fr);
  gap:16px;
  margin:20px auto 26px;
}
.mypageSidebar{ padding:14px; align-self:start; }
.mypageUserBlock{ padding:8px 4px 14px; border-bottom:1px solid var(--border); }
.mypageMenu{ display:grid; gap:12px; margin-top:14px; }
.mypageMenuSection{ display:grid; gap:6px; padding:10px; border:1px solid var(--border); border-radius:12px; background:#fff; }
.mypageMenuLabel{ margin:0 0 2px; font-size:12px; color:var(--muted); font-weight:700; }
.mypageMenu a{
  display:block;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid transparent;
  color:#374151;
  font-weight:600;
}
.mypageMenu a:hover,
.mypageMenu a:focus-visible{ background:#fff5f5; border-color:#ffd9d9; color:var(--text); }
.mypageMenu a.active{ background:#fff0f0; border-color:#ffbaba; color:#8f0011; }

.mypageScope .mypageMain h1{ margin-top:0; }
.mypageList{ list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.mypageListItem{ border:1px solid var(--border); border-radius:12px; padding:12px 14px; background:#fff; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.mypageListItem a{ display:block; width:100%; }

.mypageFormStack{ display:grid; gap:14px; max-width:760px; }
.mypageFormInline{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:18px; }
.mypageField label{ display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
.mypageControl,
.mypageScope input[type="text"],
.mypageScope input[type="number"],
.mypageScope input[type="file"],
.mypageScope select,
.mypageScope textarea,
.mypageScope button{
  font:inherit;
}
.mypageControl,
.mypageScope input[type="text"],
.mypageScope input[type="number"],
.mypageScope input[type="file"],
.mypageScope select,
.mypageScope textarea{
  width:100%;
  min-height:44px;
  border:1px solid #d9dde3;
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
  transition:border-color .2s, box-shadow .2s;
}
.mypageScope textarea{ min-height:120px; }
.mypageControl:focus,
.mypageScope input[type="text"]:focus,
.mypageScope input[type="number"]:focus,
.mypageScope input[type="file"]:focus,
.mypageScope select:focus,
.mypageScope textarea:focus{
  outline:none;
  border-color:rgba(215,0,15,.45);
  box-shadow:0 0 0 4px rgba(215,0,15,.1);
}
.mypageScope .btn{ min-height:44px; padding:10px 14px; border-radius:12px; }

.mypageTradeMeta{ margin:12px 0; padding:12px; border:1px solid var(--border); border-radius:12px; }
.mypageChatBox{ border:1px solid #eee; border-radius:12px; padding:14px; height:420px; overflow:auto; background:#fafafa; margin-bottom:14px; }
.mypageChatRow{ display:flex; justify-content:flex-start; margin:8px 0; }
.mypageChatRow.is-mine{ justify-content:flex-end; }
.mypageChatBubble{ max-width:70%; padding:10px 12px; border-radius:14px; border:1px solid #e5e5e5; background:#f3f3f3; }
.mypageChatRow.is-mine .mypageChatBubble{ background:#fff; }
.mypageChatMeta{ font-size:12px; opacity:.7; margin-bottom:4px; }

@media (max-width: 900px){
  .mypageWrap{ grid-template-columns:1fr; }
  .mypageMenuSection{ padding:8px; }
  .mypageListItem{ flex-direction:column; align-items:flex-start; }
  .mypageChatBubble{ max-width:100%; }
}

@media (max-width: 768px){
  .mypageScope .nav{
    position:relative;
    gap:10px;
  }
  .mypageScope .brand{ font-size:14px; }
  .mypageScope .buttonRow{ gap:6px; }
  .mypageScope .buttonRow .note{ display:none; }
  .mypageScope .mypageMenuToggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    order:2;
    z-index:80;
  }
  .mypageScope .mypageHeaderNav{
    display:none;
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    width:min(220px, 70vw);
    background:#fff;
    border:1px solid var(--border);
    border-radius:12px;
    box-shadow:0 10px 30px rgba(0,0,0,.1);
    padding:8px;
    flex-direction:column;
    align-items:stretch;
    gap:4px;
    z-index:75;
  }
  .mypageScope .mypageHeaderNav.active{ display:flex; }
  .mypageScope .mypageHeaderNav a{ width:100%; }
}

.table-wrap{
  width:100%;
  overflow-x:auto;
}
.product-ranking-table{
  width:100%;
  border-collapse:collapse;
  min-width:760px;
}
.product-ranking-table th,
.product-ranking-table td{
  border-bottom:1px solid var(--border);
  padding:10px 8px;
  vertical-align:middle;
}
.product-ranking-table th{
  text-align:left;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}
.product-ranking-table .num{
  text-align:right;
  white-space:nowrap;
}
.rank-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:32px;
  height:32px;
  border-radius:999px;
  background:#fff0f0;
  color:#8f0011;
  font-weight:700;
}
.product-thumb{
  width:72px;
  height:48px;
  object-fit:cover;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
}
.product-thumb.no-image{
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  font-size:12px;
}

.btn.btn-sm{
  min-height:36px;
  padding:8px 10px;
  border-radius:10px;
  font-size:13px;
}
.btn.btn-primary{
  background:linear-gradient(180deg, var(--red2), var(--red));
  border-color:transparent;
  color:#fff;
}
.btn.btn-secondary{
  background:#f9fafb;
  color:#111827;
}
.btn.btn-outline{
  background:transparent;
  border-color:#d1d5db;
  color:#111827;
}

.tablePanel{ padding:12px; }
.mypageTable{
  width:100%;
  border-collapse:collapse;
  min-width:900px;
}
.mypageTable th,
.mypageTable td{
  border-bottom:1px solid var(--border);
  padding:10px 8px;
  vertical-align:middle;
}
.mypageTable th{
  text-align:left;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}
.mypageTable .num{ text-align:right; white-space:nowrap; }
.mypageThumb{
  width:76px;
  height:52px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid var(--border);
  background:#fff;
}
.mypageThumb.no-image{
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  font-size:12px;
}
.table-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.tradePreview{
  max-width:280px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.profileCard{ max-width:760px; }
.profileGrid{
  display:grid;
  grid-template-columns: 180px minmax(0,1fr);
  gap:10px 16px;
  margin:0;
}
.profileGrid dt{
  color:var(--muted);
  font-weight:700;
}
.profileGrid dd{ margin:0; }

@media (max-width: 768px){
  .profileGrid{ grid-template-columns: 1fr; gap:6px; }
  .profileGrid dt{ margin-top:8px; }
}
