:root {
  --hero-h: 75svh; /* ← 入り口の高さ（境目の位置）。100svh で画面いっぱい */
  --bg: #15131b;
  --card: #1f1c28;
  --fg: #f5f1ee;
  --muted: #aaa4b6;
  --accent: #f2b8c6;
  --accent-fg: #2a1820;
  --danger: #ff8a8a;
  --line: #3a3548;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }

/* ---------- 入り口（縦長イラスト） ---------- */
.hero {
  position: relative;
  min-height: var(--hero-h);
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #2b2340 0%, #4a2f4f 55%, #7a4a5a 100%);
}
.hero-bg {
  position: absolute; inset: -40px;
  background-size: cover; background-position: center;
  filter: blur(40px) brightness(.55);
  opacity: 0; transition: opacity 1s;
}
.hero.has-image .hero-bg { opacity: 1; }
.hero-frame {
  position: relative;
  width: min(100%, 1200px); /* ← 入り口の画像の最大の横幅 */
  min-height: var(--hero-h);
  background-size: contain; background-position: center; background-repeat: no-repeat; /* ← 入り口の画像を全部見せる。画面いっぱいに切り抜くなら cover */
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: 24px 20px 28px; /* ← 最後の 28px が「壁紙をみる」の下の余白 */
  text-align: center;
}
.hero-frame::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(15,12,22,.55) 100%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; animation: rise 1.2s ease both; }
.hero h1 { display: none; /* WALLPAPER の文字は出さない */ margin: 0 0 6px; font-size: 1.9rem; letter-spacing: .18em; font-weight: 500; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.hero p { display: none; /* ひとこと文も出さない */ margin: 0 0 22px; color: #e9e2ea; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.enter-btn {
  display: inline-block; padding: 12px 30px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-weight: 600; text-decoration: none;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
/* 画像があるとき：入り口を画像の高さぴったりにして、ボタンは画像のすぐ下へ（パソコンもスマホも） */
.hero.has-image, .hero.has-image .hero-frame { min-height: 0; }
.hero.has-image .hero-frame {
  --w: min(100vw, 1100px, calc(70svh * var(--img-ar, 1.78))); /* ← 画像の横幅（最大1100px、高さは画面の7割まで） */
  width: var(--w);
  background-size: 100% auto; background-position: center top;
  padding: calc(var(--w) / var(--img-ar, 1.78) + 20px) 20px 8px;
}
.hero.has-image .hero-frame::after { display: none; }
.hero.has-image { background: var(--bg); } /* ← 画像まわりの色。真っ黒にしたいときは #000 */
.hero.has-image .hero-bg { display: none; }   /* ぼかしの背景は使わない */
/* 更新のお知らせ（「壁紙をみる」の上） */
.hero-news {
  margin: 0 auto 18px; max-width: 34em; padding: 12px 16px 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--fg);
  text-align: left; font-size: .9rem; line-height: 1.6;
}
.hn-title { font-size: .72rem; letter-spacing: .14em; color: var(--accent); margin-bottom: 6px; }
.hn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hn-list li { display: flex; gap: 10px; align-items: baseline; }
.hn-date { flex: none; min-width: 2.6em; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.hn-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hn-more { margin-top: 10px; }
.hn-more summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.hn-more .hn-list { margin-top: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- 一覧 ---------- */
.wrap { max-width: 1000px; margin: 0 auto; padding: 56px 16px 40px; }
.wrap h2 { font-weight: 500; letter-spacing: .12em; margin: 0 0 6px; font-size: 1.15rem; /* ← 「つくった人」「What's New」の文字の大きさ */ }
.lead { color: var(--muted); margin: 0 0 28px; font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile {
  position: relative; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--card); aspect-ratio: 9 / 16; display: block; width: 100%;
  transition: transform .2s;
}
.tile:hover { transform: translateY(-3px); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  font-size: .8rem; text-align: left; color: #fff; line-height: 1.45;
  display: flex; flex-direction: column;
}
.tile .cap-a { font-size: .7rem; opacity: .8; }
.tile .new {
  position: absolute; top: 8px; left: 8px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-size: .65rem; font-weight: 700; letter-spacing: .08em;
}

/* ---------- いいね ---------- */
.tile-wrap { position: relative; transition: transform .2s; }
.tile-wrap:hover { transform: translateY(-3px); }
.tile-wrap .tile:hover { transform: none; }
.like-chip {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  min-width: 36px; min-height: 30px; padding: 2px 10px; border: 0; border-radius: 999px;
  background: rgba(10,8,14,.55); color: #fff; font-size: .8rem; line-height: 1.6;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.like-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.like-chip:focus-visible, .like-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.like-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
dialog#viewer .like-btn { border-color: #f5f1ee; color: #f5f1ee; }
dialog#viewer .like-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-fg); }

/* ---------- ボツ部屋（見るだけ） ---------- */
footer .secret { display: block; width: fit-content; margin: 26px auto 0; font-size: .7rem; opacity: .32; text-decoration: none; letter-spacing: .1em; }
footer .secret:hover, footer .secret:focus-visible { opacity: .8; }
.nosave img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.nosave .tile img { pointer-events: none; }
.v-pic { position: relative; line-height: 0; }
.v-shield { position: absolute; inset: 0; }             /* 画像の上にかぶせる透明な板（長押しで保存させない） */
.b-title { letter-spacing: .14em; }
.b-note { margin: 0; font-size: 1rem; color: #f5f1ee; white-space: pre-wrap; }
.v-meta .b-by { margin: 4px 0 0; font-size: .8rem; color: rgba(245,241,238,.6); }
.b-row { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; background: #15131b; border-radius: 12px; padding: 10px; }
.b-row img { width: 72px; aspect-ratio: 9/16; object-fit: cover; border-radius: 8px; }
.b-row .t { word-break: break-word; white-space: pre-wrap; }
.b-row .d { color: var(--muted); font-size: .8rem; }
.b-row .row { margin-top: 8px; }
.b-row .btn { padding: 4px 14px; font-size: .8rem; }
details.panel > summary { cursor: pointer; font-size: 1.05rem; font-weight: 600; }
details.panel[open] > summary { margin-bottom: 14px; }

/* ---------- つくった人（トップ） ---------- */
#authors { scroll-margin-top: 16px; }
.authors { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 760px) { .authors { grid-template-columns: repeat(3, 1fr); } }
.author-card {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 14px;
  border-radius: 18px; text-decoration: none;
  background: var(--a-bg); color: var(--a-fg);
  border: 1px solid color-mix(in srgb, var(--a-accent) 45%, transparent);
  box-shadow: 0 6px 22px rgba(0,0,0,.25);
  transition: transform .2s;
}
.author-card:hover { transform: translateY(-3px); }
.ac-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ac-thumbs img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; display: block; background: rgba(127,127,127,.2); }
.ac-name { font-size: 1.05rem; font-weight: 600; letter-spacing: .04em; word-break: break-word; display: flex; align-items: center; gap: 8px; }
.ac-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--a-accent); background: rgba(127,127,127,.2); }
.ac-name-t { min-width: 0; }
.ac-name:has(.ac-icon) + .ac-sub { margin-top: -4px; padding-left: 40px; }
.ac-sub { font-size: .78rem; opacity: .7; display: flex; gap: 8px; align-items: center; margin-top: -8px; }
.ac-new { background: var(--a-accent); color: var(--a-bg); border-radius: 999px; padding: 0 7px; font-size: .62rem; font-weight: 700; opacity: 1; }
.news { margin-top: 64px; }

/* ---------- 作者ページ ---------- */
.a-head { max-width: 1000px; margin: 0 auto; padding: 24px 16px 0; }
.a-head .back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.a-head h1 { margin: 28px 0 4px; font-weight: 500; letter-spacing: .08em; font-size: 1.7rem; word-break: break-word; }
.a-note { margin: 0; color: var(--muted); white-space: pre-wrap; }
/* 作者紹介（アイコン・紹介文・リンク） */
.a-top { display: flex; gap: 16px; align-items: center; margin-top: 24px; }
.a-top h1 { margin: 0 0 4px; }
.a-id { min-width: 0; }
.a-icon { flex: none; width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); background: var(--card); }
.a-bio { margin: 16px 0 0; max-width: 40em; white-space: pre-wrap; line-height: 1.85; font-size: .95rem; }
.a-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.a-links .btn { padding: 5px 16px; font-size: .85rem; }
.a-count { margin: 6px 0 0; color: var(--accent); font-size: .85rem; }
.a-wrap { padding-top: 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; } /* 種類が多いときは折り返して全部見せる */
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); font-size: .88rem; display: inline-flex; gap: 6px; align-items: center;
}
.tab-n { font-size: .72rem; color: var(--muted); }
.tab[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tab[aria-pressed="true"] .tab-n { color: inherit; opacity: .75; }
.v-author { color: var(--accent); font-size: .85rem; text-decoration: none; display: inline-block; margin-top: 2px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
footer { text-align: center; color: var(--muted); padding: 32px 16px 56px; font-size: .85rem; }
footer a { color: var(--muted); }

/* ---------- ビューア ---------- */
dialog#viewer {
  border: 0; padding: 0; background: transparent; color: #f5f1ee;
  max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh;
}
dialog#viewer::backdrop { background: rgba(8,6,12,.88); }
.v-body { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.v-body img { max-height: 72vh; max-width: min(92vw, 460px); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.v-meta { text-align: center; max-width: 460px; }
.v-meta h3 { margin: 0; font-weight: 500; }
.v-meta p { margin: 4px 0 0; color: rgba(245,241,238,.7); font-size: .9rem; white-space: pre-wrap; }
.v-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-block; padding: 9px 20px; border-radius: 999px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); text-decoration: none; font-size: .95rem;
}
.btn.primary { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; }
.v-nav.prev { left: 10px; } .v-nav.next { right: 10px; }
.v-close { position: absolute; top: 12px; right: 14px; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 1.2rem; }

/* ---------- 管理ページ ---------- */
.admin { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.admin h1 { font-weight: 500; letter-spacing: .1em; font-size: 1.4rem; }
.panel { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.panel h2 { margin: 0 0 14px; font-size: 1.05rem; font-weight: 600; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=url], input[type=date], textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #3a3548;
  background: #15131b; color: var(--fg); font: inherit;
}
input[type=file] { color: var(--muted); max-width: 100%; }
select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #3a3548;
  background: #15131b; color: var(--fg); font: inherit;
}
input[type=color] { width: 56px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid #3a3548; background: #15131b; cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
.check { display: inline-flex !important; gap: 8px; align-items: center; color: var(--fg) !important; margin: 0 !important; font-size: .9rem !important; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.bulk.on { position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.bulk { margin: 16px 0; padding: 12px; border-radius: 12px; background: #2a2636; border: 1px solid #3a3548; display: grid; gap: 8px; }
.bulk-n { font-size: .85rem; color: var(--muted); }
.bulk-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bulk-row select { width: auto; flex: 1 1 160px; padding: 6px 10px; }
.bulk-row .btn { padding: 6px 14px; font-size: .85rem; }
.item.picked { outline: 2px solid var(--accent); }
.item .pick { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; accent-color: var(--accent); }
.item .thumbbox { position: relative; }
.tag { font-size: .7rem; padding: 1px 8px; border-radius: 999px; border: 1px solid #4a4458; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.author-row { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; background: #15131b; border-radius: 12px; padding: 10px; }
.author-row .sw { width: 40px; height: 40px; border-radius: 10px; border: 2px solid; }
.author-row .t { font-weight: 600; }
.author-row .d { color: var(--muted); font-size: .8rem; }
.author-row .row { margin-top: 6px; }
.author-row .btn { padding: 4px 14px; font-size: .8rem; }
.author-form { grid-column: 1 / -1; }
.colors { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.colors label { margin-top: 12px; }
.theme-preview { flex: 1 1 160px; border-radius: 12px; padding: 10px 14px; font-size: .9rem; border: 1px solid #3a3548; }
.theme-preview b { display: inline-block; margin-top: 6px; padding: 2px 12px; border-radius: 999px; font-weight: 600; font-size: .8rem; }
.cat-list { display: grid; gap: 6px; }
.cat-row { display: flex; gap: 6px; align-items: center; }
.cat-row input { flex: 1; }
.cat-row .btn { padding: 4px 10px; font-size: .8rem; }
.cat-row .n { font-size: .75rem; color: var(--muted); min-width: 3em; text-align: right; }
.pager { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.pager .btn { padding: 5px 14px; font-size: .85rem; }
.pager .pi { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.pager select { width: auto; padding: 5px 10px; margin-left: auto; }
#listTop { scroll-margin-top: 12px; }
.news-row { display: flex; gap: 10px; align-items: baseline; background: #15131b; border-radius: 12px; padding: 10px 12px; }
.news-row .nd { flex: none; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.news-row .nt { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.news-row .btn { flex: none; padding: 4px 14px; font-size: .8rem; }
.icon-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.icon-pv { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.icon-row .btn { padding: 4px 14px; font-size: .8rem; }
.link-row { flex-wrap: wrap; }
.link-row .link-label { flex: 0 1 9em; min-width: 6em; }
.link-row .link-url { flex: 1 1 14em; min-width: 0; }
textarea { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.msg { margin-top: 12px; font-size: .9rem; min-height: 1.4em; }
.msg.err { color: var(--danger); } .msg.ok { color: #9fe3b0; }
.preview { max-height: 220px; border-radius: 10px; margin-top: 10px; display: none; }
.list { display: grid; gap: 12px; }
.item { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; background: #15131b; border-radius: 12px; padding: 10px; }
.item img { width: 72px; aspect-ratio: 9/16; object-fit: cover; border-radius: 8px; }
.item .t { font-weight: 600; word-break: break-word; }
.item .d { color: var(--muted); font-size: .8rem; }
.badge { font-size: .7rem; padding: 1px 8px; border-radius: 999px; background: #3a3548; margin-left: 6px; }
.badge.draft { background: #5a4630; }
.item .row { margin-top: 8px; }
.item .btn { padding: 4px 14px; font-size: .8rem; }
.edit-form { grid-column: 1 / -1; }
[hidden] { display: none !important; }

/* ---------- ログインした人による出し分け ---------- */
body:not([data-role="owner"]) .owner-only { display: none !important; }
body:not([data-role="editor"]) .editor-only { display: none !important; }
body:not([data-role="owner"]):not([data-role="editor"]) .need-user { display: none !important; }
.badge.wait { background: #6a4a1e; color: #ffd9a0; }
.pending-note { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: #3a2f1c; color: #ffd9a0; font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pending-note .btn { padding: 4px 12px; font-size: .8rem; border-color: #ffd9a0; color: #ffd9a0; }

/* 入り口のすぐ下（「つくった人」）との間 ← 数字を小さくするともっと詰まる */
.hero + .wrap { padding-top: 20px; }

/* ホーム画面に置く案内 */
.homeadd { max-width: 560px; margin: 8px auto 0; padding: 0 16px; }
.homeadd summary { cursor: pointer; list-style: none; width: fit-content; margin: 0 auto; padding: 10px 18px; border: 1px solid var(--line, rgba(255,255,255,.18)); border-radius: 999px; font-size: .88rem; color: var(--muted); }
.homeadd summary::-webkit-details-marker { display: none; }
.homeadd[open] summary { color: inherit; }
.homeadd-body { margin-top: 14px; padding: 16px 18px; border: 1px solid var(--line, rgba(255,255,255,.18)); border-radius: 14px; font-size: .9rem; line-height: 1.8; text-align: left; }
.homeadd-body h3 { font-size: .92rem; margin: 14px 0 4px; }
.homeadd-body ol { margin: 0; padding-left: 1.3em; }
.homeadd-body p { margin: 0; }
.homeadd-note { margin-top: 12px !important; font-size: .8rem; color: var(--muted); }
