:root{
  --bg:#0f1220;
  --line:rgba(255,255,255,.14);
  --text:#fff;
  --muted:rgba(255,255,255,.72);
  --gold: rgba(255,210,124,.75);
  --shadow: 0 16px 45px rgba(0,0,0,.45);
  --radius:16px;

  /* iPhone safe-area */
  --safeTop: env(safe-area-inset-top, 0px);
  --safeRight: env(safe-area-inset-right, 0px);
  --safeBottom: env(safe-area-inset-bottom, 0px);
  --safeLeft: env(safe-area-inset-left, 0px);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
html{
  -webkit-text-size-adjust: 100%;
}
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,"Noto Sans JP",sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-left: var(--safeLeft);
  padding-right: var(--safeRight);
}

.sell-header{
  position:sticky;
  top:0;
  z-index:50;
  padding-top: var(--safeTop);
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sell-head-inner{
  position:relative;
  padding: 16px 14px 10px;
  min-height: 64px;
}

/* ✅ 追加：中央寄せコンテナ（タイトル＋サブ） */
.sell-head-center{
  text-align:center;
  padding: 0 56px; /* 左の戻る＆右の？の分、中央を守る */
}

/* 既存 */
.sell-title{ font-size: 20px; font-weight: 900; }
.sell-sub{ margin-top:4px; color: var(--muted); font-size: 12px; line-height:1.35; }

/* ✅ 左上：←戻る（safe-area対応） */
.back-btn{
  position:absolute;
  top: 10px;
  left: calc(10px + var(--safeLeft));
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.35));
  color:#fff;
  font-weight: 900;
  font-size: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.back-btn:active{ transform: translateY(1px) scale(.96); }

/* ✅ 右上ヘルプ（既存そのまま） */
.help-btn{
  position:absolute;
  top: 10px;
  right: calc(10px + var(--safeRight));
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border:1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.35));
  color:#fff;
  font-weight:900;
  font-size:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.help-btn:active{ transform: translateY(1px) scale(.96); }

.sell-app{
  padding: 10px 12px calc(26px + var(--safeBottom));
  max-width: 980px;
  margin: 0 auto;
}

.btn{
  appearance:none;
  border:1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 900;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active{ transform: translateY(1px); }
.btn-ghost{ background: rgba(0,0,0,.18); }

.sell-top{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  padding: 12px;
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
}
.pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
}
.pill .tag{ color: var(--muted); font-weight: 900; }
.pill .num{ font-size: 18px; font-weight: 900; }

.sell-tools{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 170px;
  gap:10px;
}

/* ✅ iOSズーム防止：input/selectは必ず16px */
.search, .select{
  width:100%;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding: 12px 12px;
  outline:none;
  font-size: 16px;
  line-height: 1.2;
}
.search::placeholder{ color: rgba(255,255,255,.5); }
.select{ cursor:pointer; }

@media (max-width: 640px){
  .sell-tools{ grid-template-columns: 1fr; }
}

/* =========================
   ✅ 2列表示固定
   - スマホ：2列
   - タブレット：3列
   - PC：4列
========================= */
.sell-grid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* ✅ スマホでも2列固定 */
  gap:10px;
}

@media (min-width: 860px){
  .sell-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1100px){
  .sell-grid{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.card{
  border:1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(0,0,0,.18);
  overflow:hidden;
  display:grid;
}

/* ✅ Safariのはみ出し対策 */
.card-top{
  display:grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap:10px;
  padding: 10px;
  align-items:center;
}

.imgbox{
  width:88px;
  height:88px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  padding: 5px;
}
.imgbox img{
  width:100%;
  height:100%;
  object-fit: contain;
  image-rendering: pixelated;
  display:block;
}

.meta{
  display:grid;
  gap:6px;
  min-width: 0;
}
.name{
  font-weight:900;
  line-height:1.2;
  overflow-wrap:anywhere;
}
.desc{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap:anywhere;
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding: 0 10px 10px;
  min-width:0;
}
.badge{
  font-size: 12px;
  color: rgba(255,255,255,.88);
  min-width:0;
  overflow-wrap:anywhere;
}
.badge b{ font-size: 14px; }
.sellbtn{
  flex: 0 0 auto;
  border-color: rgba(255,210,124,.40);
  background: linear-gradient(180deg, rgba(255,210,124,.22), rgba(0,0,0,.18));
  box-shadow: 0 0 0 2px rgba(255,210,124,.08) inset, 0 10px 24px rgba(0,0,0,.35);
}

/* ===== Modal ===== */
.modal{ position:fixed; inset:0; display:none; z-index:1000; }
.modal.is-open{ display:block; }
.modal__backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.72); }

.modal__sheet{
  position:absolute;
  left:50%;
  transform: translateX(-50%);
  bottom: calc(10px + var(--safeBottom));
  width: min(720px, 96vw);
  max-height: calc(86vh - var(--safeTop));
  overflow:hidden;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(20,28,40,.96), rgba(10,14,20,.96));
  box-shadow: var(--shadow);
}

.modal__grab{
  width: 46px; height: 5px; border-radius:999px;
  background: rgba(255,255,255,.22);
  margin: 10px auto 0;
}
.modal__head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.modal__title{ font-weight: 900; min-width:0; overflow-wrap:anywhere; }
.modal__x{ padding: 8px 10px; }
.modal__body{
  padding: 12px;
  overflow:auto;
  max-height: calc(86vh - 54px);
  -webkit-overflow-scrolling: touch;
}

.fx{
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.18));
  padding: 12px;
}
.fx .note{ color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap:anywhere; }
.fx .line{ border-top:1px solid rgba(255,255,255,.08); margin: 10px 0; }

.qty{
  width:100%;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding: 12px 12px;
  font-size: 16px;
}
