/* スキアツメ 公開版 — 控えめで実用的なデザイン。装飾より「次に何をすればいいか分かる」ことを優先。 */
:root {
  --ink: #22252a;
  --sub: #6b7280;
  --line: #e3e5e8;
  --bg: #ffffff;
  --panel: #f7f7f8;
  --accent: #e5484d;
  --accent-ink: #c62f35;
  --ok: #1a7f37;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.spacer { flex: 1; }
.hint { color: var(--sub); font-size: 13px; }
.error { color: var(--accent-ink); font-size: 13px; }
.field-hint { display: block; font-weight: 400; color: var(--sub); font-size: 12px; margin-top: 4px; }

/* キーボード操作時のフォーカスを分かりやすく */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { border-color: #9ca3af; }

/* ボタン */
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 14px; min-height: 40px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--panel); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--panel); }
.btn.danger { color: var(--accent-ink); border-color: #f0c4c6; }
.btn.wide { width: 100%; padding: 12px; }
.btn:disabled { opacity: .55; cursor: default; }

/* 認証 */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--panel); }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 380px; }
.logo { font-size: 28px; font-weight: 800; letter-spacing: .2px; margin: 0; }
.logo.small { font-size: 19px; }
.tagline { color: var(--sub); margin: 8px 0 20px; }
.auth-tabs { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.auth-tab { flex: 1; padding: 9px; background: #fff; border: 0; cursor: pointer; min-height: 40px; }
.auth-tab.active { background: var(--ink); color: #fff; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.auth-card input { width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.fineprint { color: var(--sub); font-size: 12px; margin-top: 14px; }

/* 紹介（ランディング） */
.lp-wrap { min-height: 100dvh; background: var(--panel); padding: 36px 16px 56px; }
.lp { max-width: 880px; margin: 0 auto; }
.lp-hero { margin-bottom: 40px; }
.lp-logo { font-size: 40px; }
.lp-logo::after { content: ""; display: block; width: 84px; height: 6px; background: var(--accent); border-radius: 3px; margin-top: 10px; }
.lp-lead { font-size: 24px; font-weight: 800; line-height: 1.45; margin: 20px 0 12px; }
.lp-sub { color: var(--sub); margin: 0 0 22px; max-width: 640px; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.lp-btn { padding: 12px 22px; min-height: 48px; font-size: 16px; font-weight: 700; border-radius: 10px; }
.lp-img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.lp-sec { margin-bottom: 40px; }
.lp-h2 { font-size: 21px; font-weight: 800; margin: 0 0 16px; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.lp-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.lp-card h3 { margin: 0 0 6px; font-size: 16px; }
.lp-card p { margin: 0; color: var(--sub); font-size: 14px; }
.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lp-steps li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.lp-step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.lp-note { color: var(--sub); font-size: 14px; margin: 14px 0 0; }
.lp-auth-head { margin-top: 8px; }
#authCard { margin: 0 auto; }

/* ヘッダー */
.app-header {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
}
.user-email { color: var(--sub); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; }

.container { max-width: 1080px; margin: 0 auto; padding: 14px 14px 110px; }

/* リスト操作 */
.list-bar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.list-bar select { flex: 1; min-width: 130px; min-height: 40px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 600; }
.share-btn { background: #18181b; color: #fff; border-color: #18181b; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-left: 4px; }
.share-btn:hover { background: #000; }

/* 追加バー */
.add-bar { display: flex; gap: 8px; margin-top: 14px; }
.add-bar input { flex: 1; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; }
.add-bar .btn { min-height: 44px; }
.add-hint { color: var(--sub); font-size: 12px; margin: 6px 0 0; }
.add-msg { margin: 8px 0 0; font-size: 13px; color: var(--ok); }
.add-msg.bad { color: var(--accent-ink); }

.tools { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

/* ツールバー（検索・絞り込み・並び替え） */
.toolbar { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.toolbar input[type="search"] { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; min-height: 42px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 6px 14px; min-height: 36px; cursor: pointer; font-size: 14px;
}
.chip:hover { background: var(--panel); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.chip.drop-chip { color: #b91c1c; border-color: #f0c4c6; font-weight: 600; }
.chip.drop-chip.active { background: #b91c1c; border-color: #b91c1c; color: #fff; }
#suggestListBtn { position: relative; border-color: var(--line); }
.count-badge {
  position: absolute; top: -7px; right: -7px; z-index: 2;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #ff3b30; color: #fff;
  border: 2px solid #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 15px; text-align: center;
  pointer-events: none;
}
.toolbar-selects { display: flex; gap: 14px; flex-wrap: wrap; }
.toolbar-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--sub); }
.toolbar-label select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-weight: 400; min-height: 38px; }

.meta-line { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--sub); }
.meta-line .total { font-weight: 700; color: var(--ink); }

/* 商品グリッド */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff;
  display: flex; flex-direction: column; cursor: pointer; position: relative;
}
.card:hover { border-color: #c9ccd1; }
.card.dragging { opacity: .5; }
.card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--panel); }
.card.is-soldout img { opacity: .55; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-name { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-price { font-weight: 800; }
.card-price.is-drop { color: #b91c1c; }
.card-price .was { color: var(--sub); font-weight: 400; font-size: 12px; }
.card-price .was.strike { text-decoration: line-through; }
.drop-tag {
  position: absolute; top: 0; right: 0; z-index: 2;
  background: #b91c1c; color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  padding: 4px 9px; border-bottom-left-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  pointer-events: none;
}
.card-shop { color: var(--sub); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--sub); }
.badge-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.badge { font-size: 11px; font-weight: 700; background: #3f434a; color: #fff; border-radius: 6px; padding: 2px 8px; }
.badge.purchased { background: var(--ok); }
.badge.drop { background: #b91c1c; }
.badge.gift { background: #2563eb; }
.badge.ended { background: var(--accent-ink); }
.prio { font-size: 11px; font-weight: 700; color: var(--accent-ink); border: 1px solid #f0c4c6; border-radius: 6px; padding: 2px 7px; }
.card-memo { font-size: 12px; color: var(--sub); background: var(--panel); border-radius: 6px; padding: 5px 8px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.move-btns { display: flex; gap: 6px; padding: 0 12px 12px; }
.move-btns button { flex: 1; padding: 5px; font-size: 13px; min-height: 34px; }

.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 14px; color: var(--sub); }
.empty-title { font-size: 17px; font-weight: 700; color: var(--ink); }

/* FAB */
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 13px 20px;
  font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.22); cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* シート */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(20,22,26,.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet label { display: block; font-size: 13px; font-weight: 600; margin-top: 12px; }
.sheet input, .sheet select, .sheet textarea {
  width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.sheet-item-head { display: flex; gap: 12px; }
.sheet-item-head img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; background: var(--panel); }
.sh-name { font-weight: 700; margin: 0; }
.sh-price { font-weight: 800; margin: 2px 0 0; }
.sh-shop { color: var(--sub); font-size: 12px; margin: 2px 0 4px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.sheet-actions.left { justify-content: flex-start; }
.sh-price-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.sh-price-info { margin: 0; font-size: 13px; font-weight: 600; }
.sh-price-history { margin: 6px 0 0; padding-left: 18px; color: var(--sub); font-size: 13px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }

/* リスト設定シート */
.sheet-section { padding: 12px 0; border-top: 1px solid var(--line); }
.sheet-section:first-of-type { border-top: 0; padding-top: 2px; }
.sheet-section-title { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.sheet-current { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; flex-wrap: wrap; }
.list-desc-box { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; background: #fff; resize: vertical; min-height: 48px; }
.list-desc-box::placeholder { color: #a1a1aa; }
.sync-view { font-size: 13px; margin: 0; }
.sync-view .btn { margin-left: 6px; min-height: 34px; padding: 4px 10px; }

body.is-member .owner-only { display: none !important; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sg-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sg-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.sg-main { flex: 1; min-width: 0; }
.sg-sub { color: var(--sub); font-size: 12px; margin: 2px 0 0; }
.sg-msg { font-size: 13px; margin: 4px 0 0; }
.sg-actions { display: flex; gap: 8px; margin-top: 8px; }

.danger-zone { margin: 40px 0 8px; text-align: center; }

@media (min-width: 720px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 16px; }
}
@media (max-width: 639px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-name { font-size: 13px; }
  .user-email { display: none; }
}
