/* ランキング表メーカー：エンタメパンダ ツールズと同じ白・墨・パンダ朱 */
:root {
  --ink: #1F1D1B;
  --sub: #66615C;
  --line: #E8E3DD;
  --surface: #F6F3EF;
  --blush: #FDF0EB;
  --shu: #E5452B;
  --shu-deep: #C93A22;
  --shu-text: #C93A22;
  --dash: #CFC8C0;
  --accent: #C93A22;
  --font-gothic: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
body[data-theme="sky"] { --accent: #2F55B8; }
body[data-theme="violet"] { --accent: #6B4FB8; }
body[data-theme="forest"] { --accent: #2F7A55; }
body[data-theme="sakura"] {
  --accent: #C84B78;
  --card-bg: #FFFDFD;
  --card-ink: #33252B;
  --card-sub: #7A636E;
  --card-line: #F3DCE5;
  --card-rule: #D885A4;
  --card-accent: #C84B78;
  --card-rank1-bg: #C84B78;
  --card-rank2-bg: #6F4E5F;
  --card-rank3-bg: #9C7185;
  --card-shadow: 0 18px 40px rgba(181, 86, 122, .12);
}
body[data-theme="pop"] {
  --accent: #E62E6B;
  --card-bg: #FFFFFF;
  --card-ink: #241923;
  --card-sub: #6E5A68;
  --card-line: #F7DCE6;
  --card-rule: #E62E6B;
  --card-accent: #E62E6B;
  --card-rank1-bg: #E62E6B;
  --card-rank2-bg: #3B2440;
  --card-rank3-bg: #B86B28;
  --card-shadow: 0 18px 40px rgba(230, 46, 107, .16);
}
body[data-theme="dark"] {
  --accent: #0E7490;
  --card-bg: #1E2130;
  --card-border: 1.5px solid #343A56;
  --card-ink: #F5F7FF;
  --card-sub: #B4BCD4;
  --card-line: #313750;
  --card-rule: #38E8FF;
  --card-accent: #38E8FF;
  --card-rank1-bg: #38E8FF;
  --card-rank1-ink: #111420;
  --card-rank2-bg: #FF4FD8;
  --card-rank2-ink: #111420;
  --card-rank3-bg: #A78BFA;
  --card-rank3-ink: #111420;
  --card-brand-ink: #CBD3EA;
  --card-brand-alpha: .78;
  --card-shadow: 0 20px 48px rgba(0, 0, 0, .45);
}
body[data-theme="lemon"] {
  --accent: #A86400;
  --card-bg: #FFFEF7;
  --card-ink: #2A2316;
  --card-sub: #6D614D;
  --card-line: #EFE6C8;
  --card-rule: #D4941A;
  --card-accent: #A86400;
  --card-rank1-bg: #E5A910;
  --card-rank1-ink: #2A2316;
  --card-rank2-bg: #4A3F2B;
  --card-rank3-bg: #8A795D;
  --card-shadow: 0 18px 40px rgba(148, 108, 20, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--font-gothic);
  font-size: 15px;
  line-height: 1.8;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; display: block; height: 4px; background: var(--shu); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-feature-settings: "palt"; word-break: auto-phrase; text-wrap: pretty; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 8px; }
.file-button:focus-within, .image-picker:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 40px; }
.u { background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .35s ease; }
a.u:hover { background-size: 100% 2px; }
.skip-link { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 8px 14px; border-radius: 8px; background: var(--ink); color: #FFF; font-size: 14px; font-weight: 700; transform: translateY(-160%); }
.skip-link:focus { transform: none; }

/* ヘッダー（サイト共通） */
.hd { display: flex; align-items: center; gap: 8px 32px; height: 60px; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-right: auto; }
.logo img { width: 34px; height: 34px; object-fit: contain; }
.logo b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; letter-spacing: .04em; white-space: nowrap; }
.logo b span { color: var(--shu-text); }
.logo small { display: block; margin-top: 1px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--sub); }
.nav { display: flex; align-items: center; gap: 28px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 6px; min-height: 44px; transition: color .2s; }
.nav a:hover { color: var(--shu-text); }
.nav svg { width: 13px; height: 13px; }

/* タイトル */
.crumb { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 12px; color: var(--sub); }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--ink); }
.title { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.title h1 { font-size: 32px; font-weight: 900; line-height: 1.3; }
.title p { margin-top: 6px; font-size: 14px; color: var(--sub); }

/* 作業エリア */
.tabs { display: none; }
.work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; margin-top: 28px; }
.panel { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.group { display: flex; flex-direction: column; gap: 12px; }
.group > h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 900; }
.ears { display: flex; flex-shrink: 0; gap: 4px; }
.ears i { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); }
.group > h2 .ears { gap: 3px; }
.group > h2 .ears i { width: 9px; height: 9px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 13px; font-weight: 700; }
.topic-presets { display: flex; flex-wrap: nowrap; gap: 5px; overflow-x: auto; padding: 6px; margin: 0 -6px; }
.topic-chip { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 0 6px; border: 1px solid var(--dash); border-radius: 8px; background: #FFF; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.topic-chip:hover, .topic-chip:active { background: var(--line); }
.topic-chip svg { flex: none; width: 16px; height: 16px; }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #FFF; font-size: 15px; color: var(--ink); }
.input:focus { outline: none; border-color: var(--ink); }
.input::placeholder { color: #6B645E; }

/* 項目 */
.items { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.item { position: relative; display: grid; grid-template-columns: 32px 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 8px 8px 6px; border: 1.5px solid var(--line); border-radius: 12px; background: #FFF; }
.item:focus-within { border-color: var(--dash); }
.item.dragging { opacity: .5; border-color: var(--ink); }
.drag-handle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 32px; height: 48px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 16px; font-weight: 900; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; cursor: grab; }
.drag-handle svg { width: 12px; height: 12px; color: var(--sub); opacity: .7; }
@media (pointer: fine) { .drag-handle { touch-action: none; } }
.item:nth-child(-n+3) .drag-handle { color: var(--accent); }
.drag-handle:hover { background: var(--surface); }
.drag-handle:active { cursor: grabbing; }
.image-picker { position: relative; display: grid; place-items: center; width: 56px; height: 46px; overflow: hidden; border: 1.5px dashed var(--dash); border-radius: 8px; background: var(--surface); color: var(--sub); cursor: pointer; }
.image-picker.has-image { border-style: solid; border-color: var(--line); }
.image-picker svg { width: 18px; height: 18px; }
.image-picker img { width: 100%; height: 100%; object-fit: cover; }
.image-picker input, .file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.item-fields { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.item-fields .input { min-height: 38px; padding: 6px 10px; border: 1px solid #DFD8D0; border-radius: 8px; background: #FAF8F5; transition: border-color .15s, background-color .15s; }
.item-fields .input::placeholder { color: #7C746D; }
.item-fields .input:focus { border-color: var(--ink); background: #FFF; }
.item-fields .name-input { font-size: 15px; font-weight: 700; }
.item-fields .comment-input { min-height: 34px; font-size: 13px; color: var(--ink); }
.item-fields .comment-input[hidden] { display: none; }
.ops { display: flex; gap: 2px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--sub); cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:disabled:hover { background: transparent; color: var(--sub); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .op-label { display: none; }
.more-btn { display: none; }
.add { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border: 1.5px dashed var(--dash); border-radius: 12px; background: transparent; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.add:hover:not(:disabled) { border-color: var(--ink); }
.add:disabled { color: var(--sub); cursor: default; }
.add svg { width: 16px; height: 16px; }

/* 見た目 */
.seg, .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: #FFF; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; }
.seg-icons svg { width: 16px; height: 16px; flex: none; }
.font-sample { font-size: 15px; font-weight: 900; line-height: 1; }
.font-sample[data-font="rounded"] { font-family: ui-rounded, "Hiragino Maru Gothic ProN", "Zen Kaku Gothic New", sans-serif; }
.font-sample[data-font="serif"] { font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; }
.seg button:hover, .swatches button:hover { border-color: var(--dash); }
.seg button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #FFF; }
.swatches button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 8px; border: 1.5px solid var(--line); border-radius: 999px; background: #FFF; font-size: 13px; font-weight: 700; cursor: pointer; }
.swatches button[aria-pressed="true"] { border-color: var(--ink); }
.sw { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.sw-shu { background: #C93A22; }
.sw-sky { background: #2F55B8; }
.sw-violet { background: #6B4FB8; }
.sw-forest { background: #2F7A55; }
.sw-sakura { background: linear-gradient(135deg, #FAD4E2 0%, #D8628E 100%); }
.sw-pop { background: linear-gradient(135deg, #FF5C93 0%, #FFD166 100%); }
.sw-dark { background: linear-gradient(135deg, #151722 0%, #1E2130 52%, #38E8FF 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.sw-lemon { background: linear-gradient(135deg, #FFE885 0%, #C8830A 100%); }
.tbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: #FFF; font-size: 13px; font-weight: 700; cursor: pointer; }
.tbtn:hover:not(:disabled) { border-color: var(--ink); }
.tbtn:disabled { color: var(--sub); opacity: .55; cursor: default; }
.file-button { position: relative; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.toggles label { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13px; font-weight: 700; cursor: pointer; }
.toggles input { width: 18px; height: 18px; margin: 0; accent-color: var(--shu-deep); }

/* プレビュー */
.preview { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 24px; border-radius: 20px; background: var(--surface); }
.preview:focus { outline: none; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-head h2 { font-size: 16px; font-weight: 900; }
.preview-stage { display: grid; place-items: center; padding: 24px; border-radius: 14px; background-color: #EFE8E1; background-size: cover; background-position: center; }
.ranking-card { display: flex; flex-direction: column; width: 100%; max-width: 520px; padding: 28px 28px 18px; border: var(--card-border, 0); border-radius: 14px; background: var(--card-bg, #FFF); color: var(--card-ink, var(--ink)); box-shadow: var(--card-shadow, 0 18px 40px rgba(31, 29, 27, .08)); }
.ranking-card.no-brand { padding-bottom: 24px; }
.ranking-card[data-font="rounded"] { font-family: ui-rounded, "Hiragino Maru Gothic ProN", "Zen Kaku Gothic New", "Yu Gothic", sans-serif; }
.ranking-card[data-font="serif"] { font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; }
.eyebrow { font-size: 12px; font-weight: 900; letter-spacing: .1em; color: var(--card-accent, var(--accent)); }
.card-header h3 { margin-top: 4px; padding-bottom: 14px; border-bottom: 2px solid var(--card-rule, var(--ink)); font-size: 24px; font-weight: 900; line-height: 1.4; color: var(--card-ink, var(--ink)); overflow-wrap: anywhere; }
.card-items { margin: 0; padding: 0; list-style: none; }
.card-item { display: grid; grid-template-columns: 44px 88px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 86px; padding: 12px 0; }
.card-item + .card-item { border-top: 1px solid var(--card-line, var(--line)); }
.card-item.layout-image-right { grid-template-columns: 44px minmax(0, 1fr) 88px; }
.card-item.layout-text-only, .card-item.no-image.layout-image-left, .card-item.no-image.layout-image-right { grid-template-columns: 44px minmax(0, 1fr); min-height: 64px; }
.crown-rank { display: grid; place-items: center; width: 40px; height: 34px; padding-top: 8px; font-size: 15px; font-weight: 900; line-height: 1; color: #FFF; clip-path: polygon(4% 18%, 26% 40%, 50% 2%, 74% 40%, 96% 18%, 84% 100%, 16% 100%); font-variant-numeric: tabular-nums; }
.card-item.rank-1 .crown-rank { background: var(--card-rank1-bg, var(--accent)); color: var(--card-rank1-ink, #FFF); }
.card-item.rank-2 .crown-rank { background: var(--card-rank2-bg, var(--ink)); color: var(--card-rank2-ink, #FFF); }
.card-item.rank-3 .crown-rank { background: var(--card-rank3-bg, #7A716A); color: var(--card-rank3-ink, #FFF); }
.card-item.rank-n .crown-rank { padding-top: 0; font-size: 22px; color: var(--card-ink, var(--ink)); clip-path: none; }
/* 空の項目は編集中の目印として薄く出す（PNGには入らない） */
.card-item-image { width: 88px; height: 62px; border-radius: 8px; object-fit: cover; }
.card-copy { min-width: 0; }
.card-copy strong { display: block; font-size: 16px; font-weight: 900; line-height: 1.45; color: var(--card-ink, var(--ink)); overflow-wrap: anywhere; }
.card-copy p { margin-top: 2px; font-size: 12px; line-height: 1.6; color: var(--card-sub, var(--sub)); overflow-wrap: anywhere; }
/* 右下に小さく薄く。作品の本文と見分けられるよう、文字も色も控えめにする（PNGも同じ見た目） */
.card-footer { display: flex; justify-content: flex-end; margin-top: auto; padding-top: 10px; }
.card-brand { display: flex; flex: none; align-items: center; gap: 4px; font-family: var(--font-gothic); font-size: 10px; font-weight: 700; color: var(--card-brand-ink, var(--sub)); opacity: var(--card-brand-alpha, .5); }
.card-brand img { width: 14px; height: 14px; object-fit: contain; }
.preview-foot { display: flex; justify-content: flex-end; align-items: center; }
.brand-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; }
.brand-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--shu-deep); }
.sd-options { display: flex; flex-direction: column; gap: 4px; padding: 8px 16px 4px; border-top: 1px solid var(--line); }
.sd-options p { font-size: 12px; color: var(--sub); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 24px; border: 0; border-radius: 999px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--shu-deep); color: #FFF; }
.btn.primary:hover:not(:disabled) { background: #B03119; }
.btn.ghost { border: 1.5px solid var(--ink); background: #FFF; color: var(--ink); }
.btn.ghost:hover { background: var(--surface); }
.actions .btn.ghost { padding: 0 18px; font-size: 14px; }
.textlink { min-height: 44px; margin-left: auto; padding: 0 4px; border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--sub); cursor: pointer; }
.textlink:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* お知らせ */
.notice { position: fixed; z-index: 30; left: 0; right: 0; bottom: 24px; width: fit-content; max-width: min(560px, calc(100% - 32px)); margin: 0 auto; padding: 10px 18px; border-radius: 12px; background: var(--ink); color: #FFF; font-size: 13px; font-weight: 700; line-height: 1.6; }
.notice:empty { display: none; }
.notice.error { background: #A3301A; }

/* 確認ダイアログ */

/* ほかのツール・フッター */
.sec { margin-top: 80px; }
.sh { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.sh h2 { font-size: 24px; font-weight: 900; line-height: 1.3; }
.more { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-left: auto; font-size: 13px; font-weight: 700; white-space: nowrap; }
.others { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.other { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; background: var(--surface); transition: background .3s; }
a.other:hover { background: var(--blush); }
.other .mark { display: grid; flex-shrink: 0; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: #FFF; color: var(--ink); }
.other .mark svg { width: 26px; height: 26px; }
.other b { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 900; }
.other b em { padding: 0 8px; border-radius: 999px; background: #FFF; font-size: 12px; font-style: normal; font-weight: 700; color: var(--sub); }
.other span { font-size: 13px; color: var(--sub); }
.ft { margin-top: 88px; padding: 28px 0 20px; background: var(--surface); }
.ft-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 40px; }
.ft-logo { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.ft-logo img { width: 34px; height: 34px; object-fit: contain; }
.ft-logo b { font-size: 18px; font-weight: 900; letter-spacing: .04em; }
.ft-nav { display: flex; flex-wrap: wrap; gap: 4px 28px; font-size: 13px; font-weight: 700; }
.ft-nav a { display: flex; align-items: center; min-height: 44px; }
.copy { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--sub); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 1020px) {
  .wrap { padding: 0 28px; }
  .work { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; order: -1; }
  .others { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  body { font-size: 14px; }
  .wrap { padding: 0 18px; }
  .logo b { font-size: 16px; }
  .logo img { width: 30px; height: 30px; }
  .logo small { display: none; }
  .nav { gap: 16px; font-size: 13px; }
  .nav .hide-sp, .nav .ext { display: none; }
  .title { padding-bottom: 14px; }
  .title h1 { font-size: 24px; }
  .title p { font-size: 13px; }

  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px -18px 0; padding: 8px 18px; background: #FFF; border-bottom: 1px solid var(--line); }
  .tabs button { min-height: 44px; border: 0; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 700; color: var(--sub); cursor: pointer; }
  .tabs button[aria-selected="true"] { background: var(--ink); color: #FFF; }
  .work { gap: 24px; margin-top: 20px; }
  .work[data-view="editor"] .preview, .work[data-view="preview"] .panel { display: none; }
  .preview { order: 0; padding: 14px 12px; border-radius: 16px; }
  .preview .actions, .preview-head h2 { display: none; }
  .preview-stage { padding: 12px 8px; }

  .seg button, .swatches button, .tbtn, .toggles label { min-height: 44px; }
  .item { grid-template-columns: 28px 48px minmax(0, 1fr) 44px; gap: 6px; padding: 6px 4px 6px 2px; }
  .drag-handle { width: 28px; font-size: 18px; }
  .image-picker { width: 48px; height: 44px; }
  .item-fields .input { min-height: 44px; font-size: 16px; }
  .item-fields .comment-input { min-height: 44px; font-size: 15px; }
  .more-btn { display: grid; width: 44px; height: 44px; }
  .ops { position: absolute; z-index: 4; top: calc(100% - 6px); right: 4px; display: none; flex-direction: column; gap: 8px; min-width: 168px; padding: 6px; border: 1.5px solid var(--line); border-radius: 12px; background: #FFF; box-shadow: 0 12px 28px rgba(31, 29, 27, .12); }
  .item.menu-open { z-index: 4; }
  .item.menu-open .ops { display: flex; }
  .ops .icon-btn { display: flex; justify-content: flex-start; gap: 10px; width: 100%; height: 44px; padding: 0 10px; color: var(--ink); }
  .ops .icon-btn .op-label { display: inline; font-size: 14px; font-weight: 700; }
  .ops .icon-btn:disabled { display: none; }
  .input { font-size: 16px; }

  .ranking-card { padding: 18px 14px 12px; }
  .card-header h3 { padding-bottom: 10px; font-size: 18px; }
  .card-item { grid-template-columns: 34px 64px minmax(0, 1fr); gap: 10px; min-height: 66px; padding: 8px 0; }
  .card-item.layout-image-right { grid-template-columns: 34px minmax(0, 1fr) 64px; }
  .card-item.layout-text-only, .card-item.no-image.layout-image-left, .card-item.no-image.layout-image-right { grid-template-columns: 34px minmax(0, 1fr); min-height: 52px; }
  .crown-rank { width: 32px; height: 28px; padding-top: 6px; font-size: 13px; }
  .card-item.rank-n .crown-rank { font-size: 18px; }
  .card-item-image { width: 64px; height: 46px; }
  .card-copy strong { font-size: 14px; }

  .sec { margin-top: 56px; }
  .sh { margin-bottom: 16px; padding-bottom: 10px; }
  .sh h2 { font-size: 20px; }
  .sh .more { display: none; }
  .ft { margin-top: 56px; }
  .ft-top { flex-direction: column; align-items: flex-start; gap: 4px; }

  .notice { bottom: 92px; }
}

.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-top .textlink { min-height: 44px; }
.notice { display: flex; align-items: center; gap: 12px; }
.notice-undo { min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: #FFF; font: inherit; font-weight: 900; text-decoration: underline; cursor: pointer; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.look > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; font-weight: 900; cursor: pointer; list-style: none; }
.look > summary::-webkit-details-marker { display: none; }
.look > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; border: solid var(--sub); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s; }
.look[open] > summary::after { transform: rotate(-135deg); }
.look > summary small { font-size: 12px; font-weight: 400; color: var(--sub); }
.look > summary .ears i { width: 9px; height: 9px; }
.look[open] > summary { margin-bottom: 12px; }
.moves { display: flex; gap: 4px; }
.item { scroll-margin-top: 72px; scroll-margin-bottom: 110px; }
.save-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 0; border-radius: 16px; background: #FFF; color: var(--ink); box-shadow: 0 16px 48px rgba(31, 29, 27, .25); }
.save-dialog[open] { display: flex; flex-direction: column; }
.save-dialog::backdrop { background: rgba(31, 29, 27, .55); }
.sd-head, .sd-foot { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; }
.sd-head { justify-content: space-between; border-bottom: 1px solid var(--line); }
.sd-head h2 { font-size: 16px; font-weight: 900; }
.sd-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.sd-close svg { width: 20px; height: 20px; }
.sd-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px; background: var(--surface); }
.sd-body img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 10px rgba(31, 29, 27, .12); }
.sd-foot { border-top: 1px solid var(--line); padding: 10px 12px; }
.sd-foot .btn { flex: 1; min-height: 48px; }

/* 1366x768でも最初の画面に項目と追加ボタンが入るよう詰める */
@media (min-width: 1021px) {
  .hd { height: 52px; }
  .crumb, .crumb a { min-height: 34px; }
  .title { padding-top: 20px; padding-bottom: 10px; }
  .title p { margin-top: 2px; }
  .group > h2 { font-size: 15px; }
  .title h1 { font-size: 26px; }
  .work { margin-top: 14px; }
  .panel { gap: 14px; }
  .group { gap: 8px; }
  .editor-top .textlink { min-height: 44px; }
  .item { grid-template-columns: 44px 56px minmax(0, 1fr) auto auto; padding: 5px 8px 5px 6px; }
  .drag-handle { width: 44px; }
  .item-fields .input { min-height: 32px; }
  .item-fields .comment-input { min-height: 28px; }
  .items { gap: 6px; }
  .moves, .ops { gap: 4px; }
  .icon-btn { width: 44px; height: 44px; }
}
@media (max-width: 700px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .item {
    grid-template-columns: 28px 48px minmax(0, 1fr) 44px 44px;
    grid-template-areas: "handle img name more moves" "comment comment comment comment comment";
    gap: 6px; padding: 6px; align-items: center;
  }
  .item:has(.moves):not(:has(.moves button:enabled)) {
    grid-template-columns: 28px 48px minmax(0, 1fr) 44px;
    grid-template-areas: "handle img name more" "comment comment comment comment";
  }
  .item .drag-handle { grid-area: handle; width: 28px; }
  .item .image-picker { grid-area: img; }
  .item .item-fields { display: contents; }
  .item .name-input { grid-area: name; min-width: 0; }
  .item .comment-input { grid-area: comment; width: 100%; }
  .item .more-btn { grid-area: more; }
  .item .moves { grid-area: moves; flex-direction: column; gap: 4px; }
  .item .moves:not(:has(button:enabled)), .item .moves button:disabled { display: none; }
  .moves .icon-btn { width: 44px; height: 44px; }
}
.look-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.look > summary small { display: block; overflow-wrap: anywhere; }

/* スマホの最初の画面にタイトル・サンプル・1項目目が入るよう詰める */
@media (max-width: 700px) {
  .hd { height: 46px; }
  .crumb, .crumb a { min-height: 30px; }
  .title { padding-top: 12px; padding-bottom: 8px; }
  .title h1 { font-size: 21px; }
  .title p { display: none; }
  .tabs { margin-top: 6px; padding: 6px 18px; }
  .tabs button { min-height: 44px; }
  .work { margin-top: 10px; }
  .panel { gap: 10px; }
  .group { gap: 6px; }
  .group > h2 { font-size: 14px; }
  .editor-top { gap: 0 8px; flex-wrap: nowrap; }
  .editor-top .textlink { flex: none; min-height: 44px; margin-left: 0; font-size: 12px; }
  .field { gap: 2px; }
  .field > label { font-size: 12px; }
  .field-row { gap: 6px; }
  .field-row .input { min-height: 44px; padding: 6px 12px; }
  .items { gap: 6px; }
  .item-fields .input { min-height: 44px; }
  .item-fields .comment-input { min-height: 44px; font-size: 16px; }
  .toggles input { width: 24px; height: 24px; }
}

/* 操作画面の下に置く静的な使い方・FAQ */
.tool-guide { box-sizing: border-box; width: min(100% - 32px, 900px); margin: 40px auto; padding: 24px 0 48px; color: #1F1D1B; font-size: 15px; line-height: 1.9; }
.tool-guide h2 { font-size: 22px; margin: 28px 0 12px; }
.tool-guide h3 { font-size: 17px; margin: 20px 0 8px; }
.tool-guide p { margin: 0 0 14px; }
.tool-guide ul { padding-left: 1.5em; }
.tool-guide a { text-decoration: underline; text-underline-offset: .2em; }
.tool-screen { display: flex; flex-direction: column; flex: none; height: 100vh; height: 100dvh; min-height: 500px; }

/* 長い名前・コメントは折り返して全文を見せる */
.item-fields textarea.input { display: block; overflow: hidden; resize: none; line-height: 1.45; font-family: inherit; }
.item-fields textarea.input:focus-visible { outline: 3px solid var(--ink); outline-offset: 0; }

/* 「…」メニュー */
.editor-top { gap: 0 8px; }
.editor-top .textlink { margin-left: 0; }
.editor-top #resetAll { margin-left: auto; }


/* 保存できない理由は保存ボタン（共通の操作バー）のすぐ横に出す。PCはバーの下、スマホは固定バーの真上。 */
.save-reason { max-width: 1160px; margin: -6px auto 10px; padding: 0 16px; font-size: 12px; line-height: 1.6; color: var(--sub); text-align: right; }

/* お知らせ：「元に戻す」は折り返さず、5秒で消える。押せるのは「元に戻す」があるときだけ。 */
.notice { pointer-events: none; }
.notice:has(.notice-undo) { pointer-events: auto; }
.notice-undo { flex: none; white-space: nowrap; }
@media (max-width: 700px) {
  .save-reason { position: fixed; z-index: 29; left: 0; right: 0; bottom: calc(61px + env(safe-area-inset-bottom)); max-width: none; margin: 0; padding: 4px 16px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); text-align: center; }
  html.ep-keyboard-open .save-reason { display: none; }
  body.save-blocked { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .notice { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.save-blocked .notice { bottom: calc(110px + env(safe-area-inset-bottom)); }
  html.ep-keyboard-open .notice, html.ep-keyboard-open body.save-blocked .notice { bottom: calc(var(--ep-keyboard-inset, 0px) + 12px); }
}
@media (max-width: 700px) { .item-fields { gap: 8px; } }

.editor-top { flex-wrap: nowrap; justify-content: flex-end; }
.editor-top .textlink { flex: none; }

.seg button, .swatches button, .tbtn { min-height: 44px; }
.toggles label, .brand-toggle { min-height: 44px; }

/* ── PC（701px〜）：ゲーム自己紹介・Tier表などと同じ構成 ──
   上の行＝ツール名と説明（1行）・「新しく作る」。右のプレビューの見出し行に「画像を保存」（共有できる環境では「共有」も）。
   共通の上部操作バー（.ep-shell-actions）はPCでは出さない（tool-shell.css）。スマホは従来どおり下部バー。 */
.title-tools, .preview-acts, .save-reason-pc { display: none; }
.preview-acts .btn { min-height: 44px; padding: 0 20px; font-size: 14px; }
.preview-acts .btn.ghost { padding: 0 18px; }
/* 保存できない間のボタン（全ツール共通の無効表示）：グレーの面・枠なし・影なし。朱を薄めない。 */
.btn:disabled, [data-ep-shell] .ep-shell-actions button:disabled { border-color: transparent; background: #E6E0D7; color: #5f5852; box-shadow: none; opacity: 1; cursor: not-allowed; }
.btn[aria-busy="true"]:disabled { cursor: progress; }
.btn.primary:hover:disabled { background: #E6E0D7; }
[hidden] { display: none !important; }
@media (min-width: 701px) {
  .title { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 72px; padding: 0; border-bottom: 0; }
  .title-main { display: flex; flex-wrap: wrap; flex: 1 1 auto; align-items: baseline; gap: 2px 14px; min-width: 0; }
  .title .title-main h1 { font-size: 22px; line-height: 1.4; }
  .title .title-main p { margin: 0; font-size: 14px; }
  .title-tools { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 10px; max-width: 50%; }
  .editor-top, #saveReason { display: none; }
  .work { margin-top: 0; }
  .preview-head { flex-wrap: wrap; gap: 8px 16px; }
  .preview-acts { display: flex; flex: none; flex-wrap: wrap; order: 3; justify-content: flex-end; gap: 10px; }
  .save-reason-pc { display: block; flex: 1 1 0; order: 2; min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.5; color: #8F2A18; text-align: right; }
}
@media (min-width: 701px) and (max-width: 1020px) {
  /* 1列の幅では、項目の操作（上下・画像なし・削除）を1行に並べる。1021px以上の項目行と同じ寸法 */
  .item { grid-template-columns: 44px 56px minmax(0, 1fr) auto auto; padding: 5px 8px 5px 6px; }
  .drag-handle { width: 44px; }
  .item-fields .input { min-height: 36px; }
  .item-fields .comment-input { min-height: 32px; }
  .items { gap: 6px; }
  .moves, .ops { gap: 4px; }
  .icon-btn { width: 44px; height: 44px; }
}
@media (min-width: 1021px) {
  /* 保存ボタンが常に見えるよう、プレビューは画面内に収め、カードだけをスクロールさせる */
  .preview { top: 16px; max-height: calc(100dvh - 32px); padding: 20px 24px 22px; gap: 16px; }
  .preview-stage { min-height: 0; overflow: auto; }
}
@media (min-width: 1101px) {
  .work { grid-template-columns: minmax(0, 500px) minmax(0, 1fr); gap: 40px; }
}

/* 初回見本プレビュー：入力するまでは完成見本＋お試し例ボタンを出す */
.card-header h3:empty { display: none; }
.preview-guide { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 10px; background: #FFF; border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--sub); }
.ranking-card.is-sample { opacity: .82; }
.ranking-card.is-sample .card-item-thumb-placeholder { display: grid; place-items: center; width: 88px; height: 62px; border-radius: 8px; background: linear-gradient(135deg, #FCE4EC, #E3F2FD); color: #8C354B; font-size: 11px; font-weight: 900; }
@media (max-width: 700px) {
  .ranking-card.is-sample .card-item-thumb-placeholder { width: 64px; height: 46px; font-size: 10px; }
}

/* PC幅でもタッチ操作の端末（タブレットなど）では、項目欄を44px以上にする */
@media (min-width: 701px) and (pointer: coarse) {
  .item-fields .input, .item-fields .comment-input { min-height: 44px; }
}
