:root {
  color-scheme: light;
  --ink: #263743;
  --muted: #6b7f8b;
  --line: #dfe7ee;
  --soft: #f4f7f9;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --call-bg: #fff0f5;
  --call-ink: #bd2557;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: #fff;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #fff; }
button, input, textarea { font: inherit; }
a { color: inherit; }

.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner {
  width: min(1080px, calc(100% - 40px));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { color: var(--ink); font-size: 20px; font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.brand:hover { color: var(--accent-dark); }
.site-note { margin: 0; color: var(--muted); font-size: 12px; }

#app { width: min(1080px, calc(100% - 40px)); margin: 0 auto 72px; }

.home-head { padding: 44px 0 18px; }
.home-head h1 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.4; }
.home-head h1 span { margin-left: 10px; color: var(--muted); font-size: 13px; font-weight: 400; }
.home-head p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.song-list { border-top: 1px solid var(--ink); }
.list-head, .song-link {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.2fr) 24px;
  gap: 28px;
  align-items: center;
}
.list-head { padding: 11px 12px 11px 48px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.song-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  margin-inline: -12px;
  border-bottom: 1px solid var(--line);
}
.song-link {
  min-height: 76px;
  padding: 15px 12px;
  text-decoration: none;
  transition: background-color .12s ease;
}
.song-link:hover, .song-link:focus-visible { background: #f2f4f5; }
.song-link:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.song-title { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.5; }
.song-opening { color: var(--muted); font-size: 13px; line-height: 1.6; }
.arrow { color: #aab7bf; font-size: 20px; text-align: right; }

.detail-shell { max-width: 920px; margin: 0 auto; padding-top: 24px; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover, .back-link:focus-visible { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.detail-head { display: flex; align-items: center; gap: 6px; padding: 0 0 18px; }
.fav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #aab7bf;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.fav-button:hover { background: #f2f4f5; }
.fav-button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.fav-button[aria-pressed="true"] { color: #e0a100; }
.detail-head h1 { margin: 0; font-size: 28px; font-weight: 600; line-height: 1.4; letter-spacing: 0; }

.detail-section { margin-top: 28px; }
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}
.section-heading > span { width: 4px; height: 20px; border-radius: 2px; background: var(--accent); }
.song-info-panel {
  margin-top: 13px;
}
.song-facts { margin: 0; border-top: 1px solid var(--line); }
.song-facts div { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 20px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.song-facts dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.song-facts dd { margin: 0; font-size: 14px; line-height: 1.55; }
.song-facts a { color: var(--accent-dark); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.song-facts a:hover, .song-facts a:focus-visible { color: var(--accent); }
.info-unset { color: #9aa8b1; }

.lyrics-section { margin-top: 36px; }
.lyrics-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}
.edit-icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.edit-icon-button:hover, .edit-icon-button:focus-visible { border-color: var(--accent); color: var(--accent-dark); }
.edit-icon-button[aria-pressed="true"] { border-color: var(--accent); background: #f5f8ff; color: var(--accent-dark); }
.edit-icon-button svg { width: 16px; height: 16px; fill: currentColor; }

.lyrics-card {
  min-height: 420px;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 24px rgb(38 55 67 / 6%);
}
.lyrics-view[hidden] { display: none; }
.lyrics {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #25323a;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.95;
}
.empty-lyrics { color: var(--muted); font-style: normal; }
.call {
  display: inline;
  padding: .07em .2em .1em;
  border-radius: .25em;
  background: var(--call-bg);
  color: var(--call-ink);
  font-weight: 700;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.call-zone {
  display: block;
  margin: .2em 0;
  padding-left: .85em;
  border-left: 2px solid #c9d5de;
}
.call-zone-label {
  display: block;
  color: var(--muted);
  font-weight: 700;
}
.content-note { margin: 30px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }

.editor[hidden] { display: none; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-help { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.lyrics-editor {
  display: block;
  width: 100%;
  min-height: 70vh;
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 400 15px/1.8 ui-monospace, "SFMono-Regular", Menlo, monospace;
}
.lyrics-editor:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.editor-actions { margin-top: 14px; }
.save-status { color: var(--muted); font-size: 13px; font-weight: 600; }
.save-status[data-state="success"] { color: #16803c; }
.save-status[data-state="error"] { color: var(--call-ink); }
.save-button {
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.save-button:hover { background: #111d24; }
.save-button:disabled { cursor: wait; opacity: .6; }

.empty, .error, .loading { margin-top: 40px; padding: 36px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }

@media (max-width: 700px) {
  .header-inner, #app { width: calc(100% - 32px); }
  .header-inner { min-height: 70px; }
  .brand { font-size: 17px; }
  .site-note { display: none; }
  .home-head { padding-top: 32px; }
  .home-head h1 { font-size: 20px; }
  .list-head { display: none; }
  .song-list { border-top-color: var(--line); }
  .song-link { grid-template-columns: 1fr 20px; gap: 3px 12px; min-height: 70px; padding-block: 13px; }
  .song-title { font-size: 15px; }
  .song-opening { grid-column: 1; font-size: 12px; }
  .arrow { grid-column: 2; grid-row: 1 / span 2; }
  .detail-shell { padding-top: 20px; }
  .detail-head h1 { font-size: 23px; }
  .detail-section { margin-top: 24px; }
  .song-facts div { grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; padding-inline: 0; }
  .lyrics-section { margin-top: 28px; }
  .lyrics-card { min-height: 360px; padding: 22px 16px; }
  .lyrics { font-size: .98rem; line-height: 1.9; }
  .editor-actions { align-items: stretch; flex-direction: column; }
  .save-button { width: 100%; }
}

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