:root {
  --red: #c8102e;
  --red-soft: #fdecee;
  --white-team: #9a6a2a;
  --white-soft: #f5ecdb;
  --ink: #222;
  --muted: #777;
  --line: #e4e4e4;
  --bg: #f6f4f1;
  --card: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 15px;
}

button, input { font: inherit; }

.site-header {
  text-align: center;
  padding: 28px 16px 12px;
}
.site-header h1 {
  margin: 0;
  font-family: "Shippori Mincho", "Yu Mincho", serif;
  font-weight: 500;
  font-size: 32px;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #d6bd84, #a8843f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.site-header p { margin: 6px 0 0; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

.panel {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.panel h2 { font-size: 17px; margin: 18px 0 10px; }
.panel h2:first-child { margin-top: 0; }

.preview-panel { position: sticky; top: 16px; align-self: start; }
@media (max-width: 860px) { .preview-panel { position: static; } }

input[type=text], input[type=number] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
}
input:focus { outline: 2px solid #f0a3ae; border-color: var(--red); }
input:disabled { background: #f2f2f2; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row-3 { grid-template-columns: 90px 1fr 1fr; }
.field-row label { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

.adder { display: grid; gap: 8px; }
.adder-actions { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.suggest-wrap { position: relative; }
.suggest {
  position: absolute;
  z-index: 10;
  left: 0; right: 0; top: calc(100% + 2px);
  margin: 0; padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.suggest.open { display: block; }
.suggest li {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.suggest li.active, .suggest li:hover { background: #fff2f4; }
.suggest .sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.suggest .tag-red { color: var(--red); }
.suggest .tag-white { color: var(--white-team); }

button {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
button.ghost { border: none; color: var(--muted); padding: 8px 0; margin-top: 8px; }

.team-picker, .size-picker { display: inline-flex; border: 1px solid #ccc; border-radius: 8px; overflow: hidden; }
.team-picker button, .size-picker button { border: none; border-radius: 0; border-right: 1px solid #ccc; }
.team-picker button:last-child, .size-picker button:last-child { border-right: none; }
.team-picker button.on[data-team=red] { background: var(--red); color: #fff; }
.team-picker button.on[data-team=white] { background: var(--white-team); color: #fff; }
.team-picker button.on[data-team=special] { background: #555; color: #fff; }
.size-picker button.on { background: #333; color: #fff; }

.hint { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--red); }

.counts { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .lists { grid-template-columns: 1fr; } }
h3 { font-size: 14px; margin: 6px 0; padding: 4px 8px; border-radius: 6px; }
h3.red { background: var(--red-soft); color: var(--red); }
h3.white { background: var(--white-soft); color: var(--white-team); }
h3.special { background: #eee; color: #444; margin-top: 12px; }

.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 6px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.entry-list .name { font-weight: 700; overflow-wrap: anywhere; }
.entry-list .song { color: var(--muted); font-size: 13px; grid-column: 1; overflow-wrap: anywhere; cursor: pointer; }
.entry-list .song:hover { text-decoration: underline; }
.entry-list .ctrl { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 4px; align-items: center; }
.entry-list .ctrl button { padding: 3px 7px; font-size: 12px; }
.entry-list .count { width: 52px; padding: 3px 4px; font-size: 12px; }
.entry-list .empty { color: #aaa; font-size: 13px; border: none; display: block; }
.entry-list .song-edit { grid-column: 1 / -1; }

.canvas-box { margin: 12px 0; background: #eee; border-radius: 8px; padding: 8px; text-align: center; }
.canvas-box canvas { max-width: 100%; max-height: 70vh; height: auto; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; }

.site-footer { text-align: center; font-size: 11px; color: #aaa; padding: 8px 16px 20px; }

.share-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-menu button { padding: 11px 6px; font-weight: 700; }
.share-menu [data-sns] { border: none; color: #fff; }
.sns-x { background: #000; }
.sns-instagram { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.sns-line { background: #06c755; }
.sns-threads { background: #333; }
.sns-facebook { background: #1877f2; }
.share-msg { margin: 8px 0 0; font-size: 13px; color: #333; min-height: 0; }
.share-msg:empty { display: none; }

.note {font-size: 12px; color: var(--muted); margin: 10px 0 0; }
