/* ==========================================================================
   nnnakasato — layout
   レイアウトは <html> のクラスで切り替える：
     .wide … 3カラム（左：プロフィール / 中：作品 / 右：テキスト）
     .tall … 縦長画面（上：ヘッダー / 下：作品）
   切り替えの比率は index.html の LAYOUT_TALL_BELOW で1か所だけ設定する。
   ========================================================================== */
:root {
  --title-w: 100%; /* 一番上のタイトル画像の幅（レイアウトごとに下で設定） */
  --bg: #dceff5;
  --paper: #fff;
  --ink: #333;
  --sub: #555;
  --mute: #666;
  --line: #ccc;
  --link: #5fa0c0;
  /* 本来意図されていたフォント。以前の見た目（端末の等幅フォント）に戻すなら monospace だけにする */
  --font: "Roboto Mono", "M PLUS 1 Code", monospace;
  --hair: max(0.07vw, 1px);
  --col: calc(100vw / 3);
  --hh: 0px; /* 縦長レイアウト時のヘッダー高さ（JSが設定） */
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  min-height: 100vh;
}
*::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }

a { text-decoration: none; color: inherit; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { display: block; }
.pixel { image-rendering: pixelated; }

/* ---------- header（プロフィール） ---------- */
header {
  position: fixed;
  top: 0; left: 0;
  display: flex;
  background: var(--paper);
  z-index: 950;
}
.header-left { display: flex; flex-direction: column; align-items: flex-start; }
.title img { height: auto; max-width: 100%; }
header img.icon { object-fit: cover; min-width: 50px; min-height: 50px; }
.site-info { display: flex; flex-direction: column; }
.name-jp { font-weight: 700; line-height: 1.2; }
.name-en { font-weight: 700; }
/* タイトル画像と同じ幅に収め、入りきらないときは区切り（|）の位置で折り返す */
/* 1行固定。タイトル画像の幅を超えるときは JS (fitOneLine) が文字を縮めて収める */
.tags { color: var(--sub); white-space: nowrap; overflow: hidden; max-width: var(--title-w); }
.tags span { color: #aaa; margin: 0 .5em; }

/* 経歴リンク：横画面はタグ行のやや下、縦画面は CONTACT の下でタグ行と同じ高さ */
.cv-link { display: inline-block; color: #000; font-weight: 700; }

.contact { display: flex; flex-direction: column; }
.contact .label a { color: #000; font-weight: 700; }
.contact .email { line-height: 1.4; white-space: nowrap; overflow: hidden; max-width: 100%; }
/* 1行固定。入りきらないときは JS (fitOneLine) が文字を縮める */
.contact .sns { white-space: nowrap; overflow: hidden; max-width: 100%; line-height: 1.4; }
.contact .sns a { color: var(--link); }
.contact .sns span { color: #aaa; margin: 0 .4em; }

/* ---------- 絞り込み ---------- */
/* Search と表示切り替えを並べるバー */
/* 一覧の枠の幅いっぱいに置き、表示切替と Search を両端に分ける（間はクリックを下に通す） */
.toolbar { position: fixed; z-index: 1600; display: flex; align-items: stretch; justify-content: space-between; gap: .5em; pointer-events: none; }
.toolbar > * { pointer-events: auto; }
.search-tab, .view-switch {
  background: var(--paper);
  padding: 0.2em 0.6em;
  border: var(--hair) solid var(--line);
  cursor: pointer;
  font-weight: 700;
}
.search-tab small { font-weight: 400; color: var(--sub); }
/* Search の横の表示（PIXELART #夜 など）は1行にし、入りきらなければ「…」で省く */
.search-tab { display: flex; align-items: baseline; gap: .4em; min-width: 0; white-space: nowrap; }
.search-tab small { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.view-switch { display: flex; align-items: center; gap: .5em; cursor: default; font-weight: 400; }
.view-switch button { display: flex; background: none; border: none; padding: 0; cursor: pointer; color: #bbb; font: inherit; }
.view-switch button svg { width: 1.1em; height: 1.1em; fill: currentColor; }
.view-switch button[aria-pressed="true"] { color: var(--ink); }
.view-switch button:hover { color: var(--sub); }
.view-switch button[aria-pressed="true"]:hover { color: var(--ink); }
nav {
  display: none;
  position: fixed;
  background: var(--paper);
  border: var(--hair) solid var(--line);
  z-index: 1500;
  box-shadow: 0 4px 8px rgba(0,0,0,.2);
}
nav.open { display: block; }
nav ul { list-style: none; padding: 0; margin: 0; }
nav a { color: var(--ink); display: inline-block; cursor: pointer; word-break: break-word; }
nav a.all { font-weight: 700; }
nav a.current { font-weight: 700; text-decoration: underline; }
nav ul ul { display: none; margin-left: 2em; }
nav ul ul.open { display: block; }
nav ul ul li a::before { content: "└"; margin-right: 0.3em; color: var(--sub); }

body.viewing .toolbar, body.viewing nav { display: none; }

/* ---------- Grid 表示：3列・正方形（作品の中央を切り抜き） ---------- */
/* 行の高さは列幅から計算して明示する（--tile = 1マスの一辺） */
main.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: var(--tile); gap: var(--tile-gap); align-content: start; }
/* size 封じ込めだとグリッドの行の高さが崩れるので、Grid では横方向だけにする（枠は正方形なので cqw = 高さ） */
main.grid .work { width: auto; height: 100%; aspect-ratio: auto; container-type: inline-size; }
main.grid .work.pan-y img { animation-name: pan-y-sq; }
@keyframes pan-y-sq { from { transform: translateY(0); } to { transform: translateY(calc(-100% + 100cqw)); } }
main.grid .work img { object-fit: cover; object-position: 50% 50%; }
main.grid .work.pan-x img { object-fit: initial; }
main.grid .text-link, main.grid .empty { grid-column: 1 / -1; align-self: center; }
main.grid .badge { font-size: 9px; }

.copyright { position: fixed; color: var(--mute); z-index: 2001; }

/* ---------- 作品一覧 ---------- */
main { display: flex; flex-direction: column; align-items: center; }
.work {
  --ar: 1;      /* 作品の縦横比（JSが設定） */
  --box: 1;     /* 表示枠の縦横比（極端な作品は制限される） */
  --hk: 1;      /* 枠の高さの上限 ÷ 最大横幅（縦長作品は 2/3。JSが設定） */
  position: relative;
  flex: none;
  aspect-ratio: var(--box);
  overflow: hidden;
  cursor: pointer;
  border: var(--hair) solid var(--line);
  background: rgba(255,255,255,.35);
  container-type: size;
}
.work img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .5s ease;
}
.work img.loaded { opacity: 1; }
/* 極端に横長・縦長の作品は枠に収めて自動でゆっくりパン */
.work.pan-x .track { width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x pan-y; cursor: grab; }
.work.pan-x .track.dragging { cursor: grabbing; }
.work.pan-x img { width: auto; max-width: none; height: 100%; user-select: none; -webkit-user-drag: none; }
.work.pan-y img { height: auto; max-height: none; width: 100%; animation: pan-y var(--dur, 20s) ease-in-out infinite alternate paused; }
.work.inview img { animation-play-state: running; }
.work:hover img { animation-play-state: paused; }
.work .badge {
  position: absolute; right: 0.4em; bottom: 0.3em;
  font-size: 10px; color: var(--sub);
  background: rgba(255,255,255,.8); padding: 0 .3em;
  pointer-events: none;
}
@keyframes pan-y { from { transform: translateY(0); } to { transform: translateY(calc(-100% + 100cqh)); } }

.text-link { display: block; text-align: left; color: #000; }
.empty { color: var(--sub); padding: 2em; }

/* ---------- テキスト作品リスト ---------- */
.text-works { display: none; }
.text-works h3 { font-weight: 700; margin: 0 0 .6em; font-size: 1em; }
.text-works ul { list-style: disc; padding-left: 1.2em; margin: 0; }
.text-works li { line-height: 1.6; }
.text-works a { color: var(--ink); }

/* ---------- 作品詳細・経歴 ---------- */
.panel { display: none; background: var(--bg); }
.panel.open { display: block; }
.detail-content { text-align: left; }
.back-button {
  display: inline-block;
  padding: 0.4em 0.8em;
  background: var(--paper);
  border: var(--hair) solid #aaa;
  cursor: pointer;
}
.detail-nav { display: flex; justify-content: space-between; align-items: center; gap: 1em; }
.detail-nav .step { display: flex; gap: .4em; }
.detail-nav .step button { background: none; border: none; cursor: pointer; padding: .2em .4em; color: var(--sub); }
.detail-nav .step button:disabled { opacity: .3; cursor: default; }
#detail-date, .meta { color: var(--sub); }
#detail-title { font-weight: 700; }
/* 横長作品の「全体 / スクロール」切り替え */
#detail-stage .mode-switch { display: flex; justify-content: flex-end; align-items: center; gap: .4em; margin-bottom: .5em; font-size: 12px; color: #aaa; }
#detail-stage .mode-switch button { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--sub); }
#detail-stage .mode-switch button[aria-pressed="true"] { color: var(--ink); font-weight: 700; cursor: default; }
#detail-stage img.single {
  max-width: 100%;
  max-height: 70vh;
  width: auto; height: auto;
  border: var(--hair) solid var(--line);
  cursor: zoom-in;
}
#detail-description { line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
#detail-description a, #cv-view a.ref { color: var(--link); }
/* サーバー（api/page.php）が検索エンジン向けに入れておく作品の中身。表示が始まると一覧に置き換わる */
.seo-work { padding: 1.5em; line-height: 1.7; white-space: pre-wrap; }
.seo-work img { max-width: 100%; height: auto; display: block; }
/* テキスト作品の中の画像（行の位置にそのまま入る） */
#detail-description img.text-img { display: block; cursor: zoom-in; max-width: 100%; max-height: 80vh; width: auto; height: auto; margin: 1em 0; }

/* 経歴 */
#cv-view h2 { font-weight: 700; }
#cv-view h3 { font-weight: 700; font-size: 1em; margin: 2em 0 .6em; border-bottom: var(--hair) solid var(--line); padding-bottom: .3em; }
#cv-view dl { display: grid; grid-template-columns: 6.5em 1fr; gap: .5em 1em; margin: 0; line-height: 1.6; }
#cv-view dt { color: var(--sub); }
#cv-view dd { margin: 0; }
#cv-view .intro { line-height: 1.8; white-space: pre-wrap; }
#cv-view .about-text { line-height: 1.9; margin: 0 0 1.4em; max-width: 46em; white-space: pre-line; }
#cv-view .about-text a { color: var(--link); }

/* ---------- 横/縦スクロール表示（極端な比率の作品） ---------- */
.scroller { position: relative; outline: none; }
.scroller .track { overflow: auto; overscroll-behavior: contain; cursor: grab; touch-action: pan-x pan-y; }
.scroller .track.dragging { cursor: grabbing; }
.scroller.x .track { height: var(--sh, 60vh); overflow-y: hidden; }
.scroller.x img { height: 100%; width: auto; max-width: none; }
.scroller.y .track { height: var(--sh, 70vh); overflow-x: hidden; }
.scroller.y img { width: 100%; height: auto; }
.scroller img { user-select: none; -webkit-user-drag: none; }
.scroller .ui { display: flex; align-items: center; gap: .6em; margin-top: .4em; font-size: 12px; color: var(--sub); }
.scroller .bar { position: relative; flex: 1; height: 3px; background: rgba(0,0,0,.08); }
.scroller .bar span { position: absolute; top: 0; height: 100%; background: var(--sub); }
.scroller .ui button { background: var(--paper); border: var(--hair) solid var(--line); cursor: pointer; padding: .1em .6em; font-size: 12px; }
.scroller.framed .track { border: var(--hair) solid var(--line); }

/* ---------- 全画面表示 ---------- */
#fullscreen-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}
#fullscreen-overlay.open { display: flex; }
#fullscreen-overlay > img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-out; }
#fullscreen-overlay .scroller { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; }
#fullscreen-overlay .scroller .ui { position: absolute; left: 1em; right: 1em; bottom: 1em; }
#fullscreen-overlay .close {
  position: absolute; top: .6em; right: .8em; z-index: 2;
  background: rgba(255,255,255,.85); border: var(--hair) solid var(--line);
  cursor: pointer; padding: .1em .6em; font-size: 14px;
}

/* ---------- 拡大表示 ---------- */
#fullscreen-overlay .zoom-root { position: absolute; inset: 0; }
.zoomer { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: zoom-out; }
.zoomer.zoomed { cursor: grab; }
.zoomer.dragging { cursor: grabbing; }
.zoomer img { position: absolute; left: 0; top: 0; max-width: none; max-height: none; user-select: none; -webkit-user-drag: none; }

/* ---------- 共有ボタン（詳細画面） ---------- */
.share { display: flex; align-items: center; flex-wrap: wrap; gap: .4em; margin: .6em 0; font-size: 12px; color: #aaa; }
/* 見えている項目の間にだけ「|」 */
.share > :not([hidden]) ~ :not([hidden])::before { content: "|"; color: #aaa; margin-right: .4em; display: inline-block; text-decoration: none; }
.share[hidden], .share [hidden] { display: none; }
.share button, .share a { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--link); text-decoration: none; }
.share button:hover, .share a:hover { text-decoration: underline; }
/* POST on SNS：押すと下に X / Instagram の選択肢 */
.share .post { position: relative; }
.share .sns-menu {
  position: absolute; left: 0; top: calc(100% + .4em); z-index: 5;
  display: flex; flex-direction: column; align-items: flex-start; gap: .5em; min-width: 8em; padding: .6em .9em;
  background: var(--paper); border: var(--hair) solid var(--line); box-shadow: 0 4px 8px rgba(0,0,0,.15);
}
.share .sns-menu[hidden] { display: none; }
.share .sns-menu > * { text-align: left; }
.share .sns-menu > *::before { content: none !important; }
/* 共有・表示切り替えの文字も画面の大きさに合わせる（作品情報の行と同じ大きさ） */
.wide .share, .wide #detail-stage .mode-switch { font-size: max(1vw, 11px); }
.tall .share, .tall #detail-stage .mode-switch { font-size: 2.8vw; }

/* ---------- キーボードで操作したときの目印（マウスでは出ない） ---------- */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.work:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.work:focus-visible::after { content: ""; position: absolute; inset: 3px; border: 2px solid #fff; pointer-events: none; z-index: 3; }
.scroller:focus-visible, .zoomer:focus-visible { outline-offset: -3px; }

@media (prefers-reduced-motion: reduce) {
  .work img { animation: none !important; transition: none; }
}

/* ==========================================================================
   .wide  — 3カラム
   ========================================================================== */
.wide header {
  width: var(--col); height: 100vh;
  flex-direction: column;
  padding: 1.5vw;
  border-right: var(--hair) solid var(--line);
}
.wide .title { margin: 1.5vw 1.5vw 0; }
.wide { --title-w: calc(var(--col) - 6vw); }
.wide .title img { width: var(--title-w); }
.wide header img.icon { width: 10vw; height: 10vw; margin: 1.5vw 0 0 1.5vw; }
.wide .name-jp { font-size: max(1.8vw, 18px); margin: 1.5vw 0 0 1.5vw; }
.wide .name-en { font-size: max(1.2vw, 13px); margin: .3vw 0 0 1.5vw; }
.wide .tags { font-size: max(1vw, 11px); margin: 1.5vw 0 0 1.5vw; }
.wide .cv-link { margin: 1.5vw 0 0 1.5vw; font-size: max(1.6vw, 16px); }
/* 右にも余白を取り、メールアドレスなどが左の枠からはみ出さないようにする（入りきらない行は JS で文字を縮める） */
.wide .contact { margin: auto 1.5vw 1.5vw 1.5vw; min-width: 0; font-size: max(1vw, 11px); }
.wide .contact .label a { font-size: max(1.6vw, 16px); }
.wide .contact .email { margin: .8vw 0; font-size: max(1.2vw, 12px); }
.wide .contact .sns { font-size: max(1vw, 11px); }

.wide main {
  position: fixed;
  top: 0; bottom: 0; left: var(--col);
  width: var(--col);
  overflow: auto;
  padding: 10vh 0 6vh;
  gap: 2vw;
}
/* 横幅 = 最大幅 × min(1, 比率 × 高さ上限)。縦長作品は高さが最大幅の --hk 倍になる */
.wide .work { width: calc(100% * min(1, var(--box) * var(--hk))); }
.wide .text-link { width: 90%; font-size: max(1.2vw, 13px); }

.wide .toolbar { top: 1.2vw; left: calc(var(--col) + 1.2vw); right: calc(var(--col) + 1.2vw); font-size: max(1vw, 11px); }
.wide main.grid { --tile-gap: .5vw; gap: var(--tile-gap); --tile: calc((var(--col) - 2 * var(--tile-gap)) / 3); }
/* プルダウンは Search のタブのすぐ下から開く（タブの高さ ≒ 2em） */
.wide nav { top: calc(1.2vw + 2.2em + .3vw); right: calc(var(--col) + 1.2vw); min-width: 12vw; max-width: calc(var(--col) - 3vw); padding: .8vw; font-size: max(1vw, 11px); }
.wide nav li { margin-bottom: .5vw; }
/* 横画面ではテキスト作品は右の列に常に出ているので、Search の Text は出さない */
.wide nav li.nav-text { display: none; }

.wide .text-works {
  display: block;
  position: fixed;
  right: 0; top: 0;
  width: var(--col); height: 100vh;
  overflow: auto;
  padding: 1.5vw 1.5vw 2vw;
  background: var(--bg);
  border-left: var(--hair) solid var(--line);
  box-shadow: 0 .3vw .6vw rgba(0,0,0,.06) inset;
  z-index: 900;
  font-size: max(1.2vw, 13px);
}
.wide .text-works li { margin: .5vw 0; }

.wide .panel {
  position: fixed;
  top: 0; left: var(--col);
  width: calc(var(--col) * 2); height: 100vh;
  overflow: auto;
  padding: 2vw 3vw 6vw;
  z-index: 1000;
}
.wide .detail-content { max-width: 1200px; margin: 0 auto; }
.wide .back-button, .wide .detail-nav .step button { font-size: max(1vw, 12px); }
.wide #detail-date, .wide .meta { font-size: max(1vw, 11px); margin: .8vw 0 .4vw; }
.wide #detail-title, .wide #cv-view h2 { font-size: max(1.6vw, 16px); margin: 1vw 0; }
.wide #detail-description { font-size: max(1.1vw, 13px); }
.wide #cv-view { font-size: max(1.05vw, 13px); }
.wide .copyright { bottom: 1.5vw; right: 1.5vw; font-size: max(.9vw, 10px); }

/* ==========================================================================
   .tall  — 縦長画面
   ========================================================================== */
.tall body { font-size: 3vw; }
.tall header {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  column-gap: 2vw;
  padding: 2vw;
  border-bottom: var(--hair) solid var(--line);
}
.tall .header-left { grid-column: 1; grid-row: 1 / 3; }
/* 右列の最大幅 = 画面幅 − 左右の余白(2vw×2) − 列の間隔(2vw) − タイトル画像の幅 */
.tall .contact { grid-column: 2; grid-row: 1 / 3; align-self: end; min-width: 0; max-width: calc(100vw - 6vw - var(--title-w)); }
/* header-left の下端＝タグ行の下端なので、下揃えで同じ高さになる */
.tall .cv-link { margin: 2vw 0 0; font-size: 3.6vw; line-height: 1; }
.tall { --title-w: 50vw; }
.tall .title img { width: var(--title-w); }
.tall header img.icon { width: 10vw; height: 10vw; margin: 2vw 0 0; }
.tall .name-jp { font-size: 4vw; margin: 2vw 0 0; }
.tall .name-en { font-size: 2.5vw; margin: .3vw 0 0; }
.tall .tags { font-size: 2vw; margin: 2vw 0 0; }
.tall .contact { align-items: flex-end; text-align: right; font-size: 3vw; }
.tall .contact .label a { font-size: 3.6vw; }
.tall .contact .email { font-size: 2.8vw; }
.tall .contact .sns { font-size: 2.8vw; margin-top: 1vw; }

/* 下に固定の Search・表示切替（その下にコピーライト）に最後の作品が隠れないよう、下の余白を取る */
.tall main { padding: calc(var(--hh) + 6vw) 0 10vw; gap: 3vw; }
.tall .work { width: calc(90vw * min(1, var(--box) * var(--hk))); }
.tall .text-link { width: 90%; font-size: 4vw; }

/* 縦画面のツールバーは、一番下のコピーライトの1行分だけ上に置く */
.tall { --tb-bottom: 7vw; }
.tall .toolbar { bottom: var(--tb-bottom); left: 2vw; right: 2vw; font-size: 3vw; flex-direction: row-reverse; }
.tall .search-tab, .tall .view-switch { padding: .4em .8em; }
.tall main.grid { --tile-gap: 1.5vw; gap: var(--tile-gap); --tile: calc((90vw - 2 * var(--tile-gap)) / 3); padding-left: 5vw; padding-right: 5vw; }
.tall nav { bottom: calc(var(--tb-bottom) + 3.2em); left: 2vw; min-width: 30vw; padding: 2vw; font-size: 3.4vw; }
.tall nav li { margin-bottom: 3vw; }
.tall nav ul ul li { margin: 2vw 0; }

.tall body.viewing header,
.tall body.viewing main,
.tall body.viewing .toolbar { display: none; }
.tall .panel { padding: 5vw 5vw 12vw; }
.tall #detail-title, .tall #cv-view h2 { font-size: 5vw; margin: 3vw 0 2vw; }
.tall #detail-date, .tall .meta { font-size: 2.8vw; }
.tall #detail-description { font-size: 3.4vw; line-height: 1.6; }
.tall #cv-view { font-size: 3.4vw; }
.tall #cv-view dl { grid-template-columns: 5.5em 1fr; }
.tall .back-button, .tall .detail-nav .step button { font-size: 3.4vw; padding: .5em 1em; }
.tall #detail-stage img.single { width: 100%; max-height: none; }
/* 縦画面では下に固定の Search・表示切替があるので、コピーライトは画面に固定せずページの一番下に置く
   （下の余白はツールバーの高さ分。最後までスクロールしてもツールバーの上に出る） */
/* 中身が短いときも画面の下端近くに来るよう、body を画面の高さ以上にして一番下へ押し下げる */
.tall body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
.tall body > * { flex-shrink: 0; }
/* コピーライトは Search・表示切替の下（ページの一番下） */
.tall .copyright { position: static; margin-top: auto; text-align: right; padding: 0 2vw 2.5vw; font-size: 2.4vw; line-height: 1.5; }
.tall body.viewing .copyright { padding-bottom: 4vw; }

/* ---------------- タグ ---------------- */
/* 詳細画面：左に media、右にタグ */
/* タグ（種類・#タグ）はメディアの上の行に、やや薄く */
.meta { display: flex; flex-direction: column; align-items: flex-start; }
#detail-tags { display: flex; flex-wrap: wrap; gap: .2em .9em; min-height: 1.5em; }
#detail-tags a { color: #999; text-decoration: none; }
#detail-tags a:hover { color: var(--sub); text-decoration: underline; }
/* Search のプルダウンの下：タグを手で入れる欄 */
.tag-search { display: flex; align-items: center; gap: .5em; margin-top: .6em; padding-top: .6em; border-top: var(--hair) solid var(--line); }
.tag-search label { font-weight: 700; }
.tag-search input { flex: 1; min-width: 0; width: 10em; font: inherit; color: var(--ink); background: #fff; border: var(--hair) solid var(--line); border-radius: 0; padding: .2em .4em; }
.tall .tag-search { margin-top: 2vw; padding-top: 3vw; }
/* タグで探したときの区切り（合う作品の後ろに、ほかの作品が続く） */
.tag-head, .tag-sep { box-sizing: border-box; width: 100%; color: var(--sub); margin: 0; padding: .4em .3em; grid-column: 1 / -1; }
.wide .tag-head, .wide .tag-sep { font-size: max(1vw, 11px); }
.tall .tag-head, .tall .tag-sep { font-size: 3vw; }
.tag-sep { border-top: var(--hair) solid var(--line); margin-top: .6em; }

/* タグ入力欄の三角：よく使われているタグ（3作品以上）を、作品数の多い順に出す
   横画面は入力欄の下、縦画面はプルダウンの右側に出す */
.tag-search { position: relative; flex-wrap: wrap; }
.tag-toggle { background: none; border: none; padding: 0 .2em; cursor: pointer; color: var(--ink); font: inherit; line-height: 1; }
.tag-toggle::before { content: "▼"; font-size: .8em; }
.tag-toggle[aria-expanded="true"]::before { content: "▲"; }
.tall .tag-toggle::before { content: "▶"; }
.tall .tag-toggle[aria-expanded="true"]::before { content: "◀"; }
.tag-pop { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.tag-pop[hidden] { display: none; }
.tag-pop li { display: flex; justify-content: space-between; gap: 1em; }
.tag-pop a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.tag-pop a:hover, .tag-pop a.current { text-decoration: underline; }
.tag-pop .n { color: var(--sub); }
.tag-pop .none { color: var(--sub); }
.wide .tag-pop { flex-basis: 100%; max-height: 40vh; margin-top: .4vw; padding-top: .4vw; border-top: var(--hair) dashed var(--line); }
.wide .tag-pop li { margin: 0 0 .4vw; }
.tall .tag-pop {
  position: absolute; left: calc(100% + 2vw + var(--hair)); bottom: calc(-2vw - var(--hair));
  min-width: 34vw; max-width: calc(100vw - 100% - 8vw); max-height: 70vh;
  background: var(--paper); border: var(--hair) solid var(--line); box-shadow: 0 4px 8px rgba(0,0,0,.2); padding: 2vw;
}
.tall .tag-pop li { margin: 0 0 2.4vw; }
.tall .tag-pop li:last-child { margin-bottom: 0; }
.tag-search input::placeholder { color: #aaa; opacity: 1; }

/* 名前：押すとフルネームに切り替わる */
.name-toggle { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.name-toggle .name-more { display: none; }
.name-toggle[aria-pressed="true"] .name-more { display: inline; }
