/* ランキング表メーカー：エンタメパンダ ツールズと同じ白・墨・パンダ朱 */
: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; }

* { 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; }
.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: #8A837C; }

/* 項目 */
.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: grid; place-items: center; width: 32px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 20px; font-weight: 900; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; cursor: grab; 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; min-width: 0; }
.item-fields .input { min-height: 36px; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; }
.item-fields .input:focus { background: var(--surface); }
.item-fields .name-input { font-size: 15px; font-weight: 700; }
.item-fields .comment-input { min-height: 32px; font-size: 13px; color: var(--sub); }
.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 { min-height: 40px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 999px; background: #FFF; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; }
.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%; }
.sw-shu { background: #C93A22; }
.sw-sky { background: #2F55B8; }
.sw-violet { background: #6B4FB8; }
.sw-forest { background: #2F7A55; }
.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); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: 12px; line-height: 1.7; color: var(--sub); }
.note svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px; 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-head span { font-size: 12px; color: var(--sub); }
.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-radius: 14px; background: #FFF; box-shadow: 0 18px 40px rgba(31, 29, 27, .08); }
.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(--accent); }
.card-header h3 { margin-top: 4px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); font-size: 24px; font-weight: 900; line-height: 1.4; 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(--line); }
.card-item.layout-image-right { grid-template-columns: 44px minmax(0, 1fr) 88px; }
.card-item.layout-text-only { 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:nth-child(1) .crown-rank { background: var(--accent); }
.card-item:nth-child(2) .crown-rank { background: var(--ink); }
.card-item:nth-child(3) .crown-rank { background: #7A716A; }
.card-item:nth-child(n+4) .crown-rank { padding-top: 0; font-size: 22px; color: var(--ink); clip-path: none; }
.card-item-image, .card-image-placeholder { width: 88px; height: 62px; border-radius: 8px; object-fit: cover; }
.card-image-placeholder { display: block; background: var(--surface); }
.card-copy { min-width: 0; }
.card-copy strong { display: block; font-size: 16px; font-weight: 900; line-height: 1.45; overflow-wrap: anywhere; }
.card-copy strong.empty { color: #7A736C; font-weight: 700; }
.card-copy p { margin-top: 2px; font-size: 12px; line-height: 1.6; color: var(--sub); overflow-wrap: anywhere; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--sub); }
.card-footer p { min-width: 0; overflow-wrap: anywhere; }
.card-brand { display: flex; flex: none; align-items: center; gap: 6px; font-family: var(--font-gothic); font-weight: 700; color: var(--ink); }
.card-brand img { width: 22px; height: 22px; object-fit: contain; }
.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.primary:disabled { opacity: .7; cursor: progress; }
.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; }

/* 確認ダイアログ */
.confirm-dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; background: #FFF; color: var(--ink); box-shadow: 0 24px 60px rgba(31, 29, 27, .2); }
.confirm-dialog::backdrop { background: rgba(31, 29, 27, .45); }
.confirm-dialog form { padding: 26px 24px 22px; }
.confirm-dialog h2 { font-size: 19px; font-weight: 900; line-height: 1.4; }
.confirm-dialog p { margin: 8px 0 22px; font-size: 14px; line-height: 1.7; color: var(--sub); overflow-wrap: anywhere; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions .btn { min-height: 46px; padding: 0 12px; font-size: 14px; }

/* ほかのツール・フッター */
.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); }
.savebar { display: none; }

@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: 640px) {
  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 { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px -18px 0; padding: 8px 18px; background: rgba(255, 255, 255, .96); 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: 0; 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 { grid-template-columns: 34px minmax(0, 1fr); min-height: 52px; }
  .crown-rank { width: 32px; height: 28px; padding-top: 6px; font-size: 13px; }
  .card-item:nth-child(n+4) .crown-rank { font-size: 18px; }
  .card-item-image, .card-image-placeholder { width: 64px; height: 46px; }
  .card-copy strong { font-size: 14px; }
  .card-footer { flex-wrap: wrap; gap: 4px 12px; }

  .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; }

  .savebar { position: sticky; bottom: 0; z-index: 6; display: flex; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); }
  .savebar .btn { flex: 1; min-height: 50px; }
  .savebar .btn.ghost { flex: 0 0 auto; padding: 0 18px; }
  .savebar-menu { position: absolute; right: 18px; bottom: calc(100% + 8px); display: flex; flex-direction: column; min-width: 200px; padding: 6px; border: 1.5px solid var(--line); border-radius: 12px; background: #FFF; box-shadow: 0 12px 28px rgba(31, 29, 27, .12); }
  .savebar-menu button, .savebar-menu label { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; }
  .savebar-menu button:hover, .savebar-menu label:hover { background: var(--surface); }
  .notice { bottom: 92px; }
}
