:root{
  --bg:#0c1219; --bg2:#060a10;
  --panel:#172233; --panel2:#1c2a40;
  --text:#eef2f7; --muted:#a3b3c6;
  --accent:#ff8a1e; --accent-soft:rgba(255,138,30,.15);
  --line:#223046; --ok:#5fd48a; --blue:#4aa3ff; --gold:#ffd23f;
  --head-h:54px; --nav-h:62px; --maxw:640px;
}
*{box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent;}
html,body{background:var(--bg2);}
body{
  color:var(--text);
  font-family:"Noto Sans JP",system-ui,sans-serif;
  min-height:100vh;
  padding-top:var(--head-h);
  padding-bottom:calc(var(--nav-h) + env(safe-area-inset-bottom,0));
  max-width:var(--maxw); margin:0 auto;
  position:relative;
}
img{max-width:100%;}
button{font-family:inherit; cursor:pointer;}

/* ===== ヘッダー ===== */
.app-head{
  position:fixed; top:0; left:0; right:0; z-index:40;
  height:var(--head-h);
  max-width:var(--maxw); margin:0 auto;
  display:flex; align-items:center; gap:8px;
  padding:0 12px;
  background:rgba(8,12,18,.92); backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
}
.head-back{
  background:none; border:none; color:var(--text);
  font-size:30px; line-height:1; width:32px; height:38px; margin-left:-4px;
}
.app-logo{display:flex; align-items:center; gap:8px; text-decoration:none; color:var(--text);}
.logo-mark{width:30px; height:30px; display:block;}
.logo-txt{font-weight:900; font-size:17px; letter-spacing:.02em;}
.logo-txt b{color:var(--accent); font-weight:900;}
.head-right{margin-left:auto;}
.me-chip{
  background:var(--panel); border:1px solid var(--line);
  width:38px; height:38px; border-radius:50%;
  display:grid; place-items:center; font-size:18px;
}

/* ===== ビュー切替 ===== */
.view{display:none; padding:14px 14px 24px; animation:fade .18s ease;}
.view.active{display:block;}
@keyframes fade{from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;}}
.page-title{font-size:20px; font-weight:900; margin-bottom:12px;}
.sub-title{font-size:14px; font-weight:700; color:var(--muted); margin:20px 2px 10px;}

/* ===== ヒーロー ===== */
.hero-strip{
  background:linear-gradient(135deg,#16233b,#0d1626);
  border:1px solid var(--line); border-radius:14px;
  padding:16px 18px; margin-bottom:14px;
}
.hero-copy{font-size:18px; font-weight:900; line-height:1.4;}
.hero-copy b{color:var(--accent);}
.hero-sub{font-size:12px; color:var(--muted); margin-top:4px;}

/* ===== 検索・チップ ===== */
.search-wrap{margin-bottom:10px;}
.search{
  width:100%; background:var(--panel); border:1px solid var(--line);
  border-radius:10px; padding:11px 14px; font-size:14px; color:var(--text);
}
.search::placeholder{color:var(--muted);}
.search:focus{outline:none; border-color:var(--accent);}
.chips{display:flex; gap:8px; overflow-x:auto; padding-bottom:10px; scrollbar-width:none;}
.chips::-webkit-scrollbar{display:none;}
.chip{
  flex:none; font-size:12.5px; font-weight:700;
  padding:7px 15px; border-radius:999px;
  background:var(--panel); border:1px solid var(--line); color:var(--muted);
}
.chip.on{background:var(--accent-soft); border-color:var(--accent); color:#ffc98d;}

.sort-row{display:flex; align-items:center; justify-content:space-between; margin:2px 0 12px;}
.sort-tabs{display:flex; gap:6px;}
.sort-tab{
  font-size:12.5px; font-weight:700; padding:6px 13px; border-radius:999px;
  background:transparent; border:1px solid var(--line); color:var(--muted);
}
.sort-tab.on{background:var(--panel2); color:var(--text); border-color:var(--panel2);}
.feed-count{font-size:11px; color:var(--muted);}

/* ===== フィード（カード） ===== */
.feed{display:grid; grid-template-columns:1fr 1fr; gap:11px;}
@media(min-width:520px){ .feed{grid-template-columns:1fr 1fr 1fr;} }
.vcard{
  background:var(--panel); border:1px solid var(--line);
  border-radius:13px; overflow:hidden; text-align:left;
  padding:0; color:var(--text); border-width:1px; display:flex; flex-direction:column;
  transition:transform .12s, border-color .12s;
}
.vcard:active{transform:scale(.98);}
.thumb{
  aspect-ratio:4/3; position:relative;
  display:grid; place-items:center; overflow:hidden;
  background:linear-gradient(160deg,#24344f,#0e1724);
}
.thumb img{width:100%; height:100%; object-fit:cover;}
.thumb .ph{font-size:30px; opacity:.5;}
.thumb .src{
  position:absolute; left:6px; top:6px; font-size:9.5px;
  background:rgba(0,0,0,.6); padding:2px 7px; border-radius:5px; color:#dfe6ef;
}
.thumb .hall{
  position:absolute; right:6px; top:6px; font-size:9.5px; font-weight:900;
  background:var(--gold); color:#3a2c00; padding:2px 7px; border-radius:5px;
}
.vmeta{padding:9px 10px 11px; display:flex; flex-direction:column; gap:5px; flex:1;}
.vmeta .trade{font-size:10px; color:var(--accent); font-weight:700;}
.vmeta h3{font-size:12.5px; line-height:1.45; font-weight:700; flex:1;}
.vmeta .who{font-size:10.5px; color:var(--muted); display:flex; justify-content:space-between; align-items:center; gap:6px;}
.vmeta .who .nm{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.vmeta .likes{color:#ffc98d; font-weight:700; flex:none;}

/* レベルバッジ */
.lv{font-size:9px; font-weight:900; padding:1px 6px; border-radius:999px; color:#0c1219; flex:none;}

/* ===== 詳細 ===== */
.detail{padding:0 0 24px;}
.d-hero{
  width:100%; aspect-ratio:4/3; max-height:360px;
  background:linear-gradient(160deg,#24344f,#0e1724);
  display:grid; place-items:center; overflow:hidden;
}
.d-hero img{width:100%; height:100%; object-fit:cover;}
.d-hero .ph{font-size:54px; opacity:.4;}
.carousel{display:flex; overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none; aspect-ratio:4/3; max-height:360px;}
.carousel::-webkit-scrollbar{display:none;}
.carousel .cslide{flex:none; width:100%; scroll-snap-align:start; position:relative; background:linear-gradient(160deg,#24344f,#0e1724); display:grid; place-items:center;}
.carousel .cslide img{width:100%; height:100%; object-fit:cover;}
.carousel .step-tag{position:absolute; left:10px; top:10px; background:rgba(255,138,30,.92); color:#14100a; font-size:11px; font-weight:900; padding:3px 11px; border-radius:999px;}
.carousel .cnt{position:absolute; right:10px; top:10px; background:rgba(0,0,0,.6); font-size:11px; padding:3px 9px; border-radius:999px;}
.dots{display:flex; justify-content:center; gap:6px; padding:9px 0 2px;}
.dots span{width:6px; height:6px; border-radius:50%; background:#33465f;}
.dots span.on{background:var(--accent);}

.d-body{padding:14px 16px;}
.d-body .trade{color:var(--accent); font-size:11px; font-weight:700;}
.d-body h2{font-size:19px; line-height:1.45; margin:5px 0 10px; font-weight:900;}
.d-who{display:flex; align-items:center; gap:9px; margin-bottom:14px;}
.d-who .avatar{width:34px; height:34px; border-radius:50%; background:var(--panel2); border:1px solid var(--line); display:grid; place-items:center; font-size:16px;}
.d-who .nm{font-size:13px; font-weight:700;}
.d-who .meta{font-size:11px; color:var(--muted);}

.actions{display:flex; gap:9px; margin-bottom:16px;}
.act{
  flex:1; text-align:center; font-size:12px; font-weight:700;
  border:1px solid var(--line); border-radius:11px; padding:11px 4px;
  color:var(--muted); background:var(--panel); transition:transform .1s;
}
.act:active{transform:scale(.95);}
.act.primary{background:var(--accent-soft); border-color:var(--accent); color:#ffc98d;}
.act.liked{background:var(--accent); border-color:var(--accent); color:#14100a;}
.act.saved-on{background:rgba(95,212,138,.15); border-color:var(--ok); color:var(--ok);}
.act .n{display:block; font-size:15px; font-weight:900; margin-top:1px;}

.spec{border:1px solid var(--line); border-radius:12px; overflow:hidden; margin-bottom:14px;}
.spec .row{display:grid; grid-template-columns:92px 1fr; border-bottom:1px solid var(--line);}
.spec .row:last-child{border-bottom:none;}
.spec .k{background:var(--panel); font-size:11px; font-weight:700; color:var(--muted); padding:11px 10px;}
.spec .v{font-size:13px; padding:11px 12px; line-height:1.75; white-space:pre-wrap;}
.spec .row.tip .k{color:var(--accent);}
.spec .row.tip .v{background:var(--accent-soft);}
.cite{font-size:10.5px; color:var(--muted); padding:0 2px;}

/* ===== フォーム ===== */
.post-note{font-size:12px; color:var(--muted); line-height:1.7; margin-bottom:8px;}
.post-note b{color:var(--accent);}
.f-label{display:block; font-size:12.5px; font-weight:700; margin:15px 0 6px;}
.f-label .req{color:var(--accent); font-size:10px; margin-left:6px;}
.f-input,.f-select,.f-area{
  width:100%; background:#0e1724; border:1px solid #33465f;
  border-radius:10px; color:var(--text); font-size:14px; font-family:inherit; padding:11px 12px;
}
.f-input:focus,.f-select:focus,.f-area:focus{outline:none; border-color:var(--accent);}
.f-area{min-height:74px; resize:vertical; line-height:1.7;}
.upload-box{
  border:2px dashed #33465f; border-radius:12px;
  text-align:center; padding:22px 12px; font-size:13px; color:var(--muted); line-height:1.7;
}
.img-strip{display:flex; gap:8px; margin-top:10px; flex-wrap:wrap;}
.img-strip .im{
  width:66px; height:66px; border-radius:10px; overflow:hidden;
  border:1px solid var(--line); position:relative; background:#0e1724;
}
.img-strip .im img{width:100%; height:100%; object-fit:cover;}
.img-strip .im .rm{
  position:absolute; right:2px; top:2px; width:18px; height:18px; border-radius:50%;
  background:rgba(0,0,0,.7); color:#fff; border:none; font-size:12px; line-height:1; display:grid; place-items:center;
}
.img-strip .im .idx{
  position:absolute; left:3px; top:3px; background:var(--accent); color:#14100a;
  font-size:9px; font-weight:900; width:15px; height:15px; border-radius:50%; display:grid; place-items:center;
}
.guideline{
  margin-top:16px; background:rgba(255,138,30,.08);
  border:1px solid rgba(255,138,30,.3); border-radius:10px;
  font-size:11px; color:#ffc98d; padding:11px 12px; line-height:1.8;
}
.submit{
  width:100%; margin-top:16px; background:var(--accent); color:#14100a;
  font-weight:900; font-size:15px; border:none; border-radius:11px; padding:15px 0;
  transition:transform .1s;
}
.submit:active{transform:scale(.98);}
.submit-note{text-align:center; font-size:10.5px; color:var(--muted); margin-top:9px; line-height:1.6;}

/* ===== ランキング ===== */
.rank-tabs,.me-tabs{display:flex; gap:8px; margin-bottom:14px;}
.rank-tab{
  flex:1; text-align:center; font-size:13px; font-weight:700; padding:10px 4px; border-radius:10px;
  background:var(--panel); border:1px solid var(--line); color:var(--muted);
}
.rank-tab.on{background:var(--accent-soft); border-color:var(--accent); color:#ffc98d;}
.rank-item{
  display:flex; align-items:center; gap:11px;
  background:var(--panel); border:1px solid var(--line); border-radius:12px;
  padding:11px 12px; margin-bottom:9px; text-align:left; width:100%; color:var(--text);
}
.rank-no{font-size:17px; font-weight:900; width:30px; text-align:center; flex:none; color:var(--muted);}
.rank-no.top1{color:var(--gold);} .rank-no.top2{color:#cfd8e3;} .rank-no.top3{color:#e0a86b;}
.rank-thumb{width:52px; height:52px; border-radius:9px; flex:none; overflow:hidden; background:linear-gradient(160deg,#24344f,#0e1724); display:grid; place-items:center; font-size:22px;}
.rank-thumb img{width:100%; height:100%; object-fit:cover;}
.rank-main{flex:1; min-width:0;}
.rank-main .t{font-size:13px; font-weight:700; line-height:1.4; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;}
.rank-main .s{font-size:11px; color:var(--muted); margin-top:3px; display:flex; align-items:center; gap:6px;}
.rank-like{font-size:13px; font-weight:900; color:#ffc98d; flex:none;}
.rank-ava{width:52px; height:52px; border-radius:50%; flex:none; background:var(--panel2); border:1px solid var(--line); display:grid; place-items:center; font-size:24px;}

/* ===== マイページ ===== */
.me-card{
  background:linear-gradient(135deg,#1a2a44,#0d1626);
  border:1px solid var(--line); border-radius:16px; padding:18px; margin-bottom:8px;
}
.me-top{display:flex; align-items:center; gap:13px;}
.me-big-ava{width:56px; height:56px; border-radius:50%; background:var(--panel2); border:1px solid var(--line); display:grid; place-items:center; font-size:28px; flex:none;}
.me-name{font-size:18px; font-weight:900;}
.me-lv{margin-top:5px;}
.me-stats{display:flex; gap:10px; margin-top:15px;}
.me-stat{flex:1; background:rgba(0,0,0,.2); border:1px solid var(--line); border-radius:10px; padding:10px 6px; text-align:center;}
.me-stat b{display:block; font-size:20px; font-weight:900; color:var(--accent);}
.me-stat span{font-size:10.5px; color:var(--muted);}
.me-prog{margin-top:14px;}
.me-prog .bar{height:8px; background:rgba(0,0,0,.3); border-radius:99px; overflow:hidden;}
.me-prog .bar i{display:block; height:100%; background:linear-gradient(90deg,var(--accent),var(--gold)); border-radius:99px;}
.me-prog .txt{font-size:10.5px; color:var(--muted); margin-top:6px;}
.me-edit{margin-top:12px; font-size:11px; color:var(--blue); background:none; border:none; text-decoration:underline;}

/* ===== ボトムナビ ===== */
.bnav{
  position:fixed; bottom:0; left:0; right:0; z-index:40;
  max-width:var(--maxw); margin:0 auto;
  height:calc(var(--nav-h) + env(safe-area-inset-bottom,0));
  padding-bottom:env(safe-area-inset-bottom,0);
  display:grid; grid-template-columns:repeat(5,1fr);
  background:rgba(9,13,19,.97); backdrop-filter:blur(8px);
  border-top:1px solid var(--line);
}
.bnav-item{
  background:none; border:none; color:var(--muted);
  font-size:10.5px; font-weight:700; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
}
.bnav-item .ico{font-size:19px;}
.bnav-item.on{color:var(--accent);}
.bnav-item.post-btn{position:relative;}
.bnav-item.post-btn .ico{
  width:46px; height:46px; margin-top:-16px; border-radius:50%;
  background:var(--accent); color:#14100a; display:grid; place-items:center;
  font-size:28px; font-weight:900; box-shadow:0 6px 18px rgba(255,138,30,.4);
}

/* ===== トースト ===== */
.toast{
  position:fixed; left:50%; bottom:calc(var(--nav-h) + 18px); transform:translateX(-50%) translateY(10px);
  z-index:60; max-width:90%;
  background:var(--panel2); border:1px solid var(--accent); color:var(--text);
  font-size:13px; font-weight:700; padding:12px 18px; border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.5); opacity:0; transition:opacity .25s, transform .25s; text-align:center; line-height:1.5;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
.toast.levelup{border-color:var(--gold); background:linear-gradient(135deg,#2a2410,#1c2a40);}

/* ===== モーダル ===== */
.modal{position:fixed; inset:0; z-index:80; background:rgba(4,8,13,.86); display:grid; place-items:center; padding:22px;}
.modal-box{background:var(--panel); border:1px solid var(--line); border-radius:18px; padding:26px 22px; width:100%; max-width:360px; text-align:center;}
.modal-logo{display:flex; align-items:center; justify-content:center; gap:8px; margin-bottom:14px;}
.modal-box h2{font-size:19px; font-weight:900; margin-bottom:6px;}
.modal-box p{font-size:12.5px; color:var(--muted); line-height:1.7; margin-bottom:14px;}
.modal-box .f-input{margin-bottom:12px;}
.ava-pick{display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:6px;}
.ava-pick button{width:44px; height:44px; border-radius:50%; background:var(--panel2); border:2px solid var(--line); font-size:22px; display:grid; place-items:center;}
.ava-pick button.on{border-color:var(--accent); background:var(--accent-soft);}

.empty{text-align:center; color:var(--muted); font-size:13px; line-height:1.9; padding:40px 20px;}

/* like pop animation */
@keyframes pop{0%{transform:scale(1);}40%{transform:scale(1.35);}100%{transform:scale(1);}}
.pop{animation:pop .35s ease;}
