:root {
  --night: #0f1b2e;
  --winter: #1a2f4a;
  --cream: #f8f4e8;
  --brass: #d4af5f;
  --mint: #9be7c4;
  --persimmon: #e07a5f;
  --focus: #7ec8e3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--cream);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--night);
}

.sky-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, #243b55 0%, #0f1b2e 55%, #0a1220 100%);
  z-index: -1;
}

.masthead {
  padding: 12px 16px 0;
}

.back {
  color: var(--mint);
  text-decoration: none;
  font-size: 0.9rem;
}

.back:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.music-app {
  max-width: 420px;
  margin: 0 auto;
  padding: 8px 16px 28px;
}

.hero {
  text-align: center;
  margin-bottom: 12px;
}

.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--brass);
  margin: 0 0 6px;
}

.hero h1 {
  font-size: 1.35rem;
  margin: 0 0 6px;
  line-height: 1.35;
}

.hero h1 span {
  display: block;
  font-size: 1.05rem;
  color: var(--mint);
}

.catch {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.92;
}

.request-card {
  background:
    linear-gradient(135deg, rgba(212, 175, 95, 0.08), transparent 55%),
    rgba(26, 47, 74, 0.72);
  border: 1px solid rgba(212, 175, 95, 0.42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.request-card h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.request-hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  opacity: 0.9;
}

.status-line {
  margin: 10px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mint);
}

.remain {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brass);
}

.reason-list {
  margin: 8px 0 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: #f2cc8f;
}

.stage {
  position: relative;
  margin-bottom: 10px;
}

#sky-canvas,
#merge-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(126, 200, 227, 0.25);
  background: #0f1b2e;
}

.burapi {
  position: absolute;
  right: 4px;
  bottom: -6px;
  width: 72px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35));
}

.pitch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
  position: relative;
  z-index: 3;
}

.pitch-btn {
  position: relative;
  z-index: 1;
  min-height: 72px;
  border: 2px solid rgba(248, 244, 232, 0.35);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(36, 59, 85, 0.95), rgba(15, 27, 46, 0.95));
  color: var(--cream);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px;
  touch-action: manipulation;
}

.pitch-btn:active {
  transform: scale(0.98);
}

.pitch-btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.pitch-btn[data-pitch="0"] {
  border-color: #3d5a80;
}
.pitch-btn[data-pitch="1"] {
  border-color: #8b6914;
}
.pitch-btn[data-pitch="2"] {
  border-color: #7ec8e3;
}
.pitch-btn[data-pitch="3"] {
  border-color: var(--persimmon);
}

.pitch-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.pitch-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.pitch-num {
  font-size: 0.75rem;
  opacity: 0.75;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-tool,
.btn-primary,
.btn-ghost {
  font: inherit;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid rgba(248, 244, 232, 0.25);
}

.btn-tool {
  background: rgba(26, 47, 74, 0.9);
  color: var(--cream);
  flex: 1 1 auto;
  min-width: 72px;
}

.btn-primary {
  background: linear-gradient(180deg, #c9a44d, #9a7b32);
  color: #1a1208;
  font-weight: 700;
  width: 100%;
  margin-top: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--cream);
}

.btn-tool:focus-visible,
.btn-primary:focus-visible,
.btn-ghost:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.mute-toggle {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kb-hint,
.records {
  font-size: 0.78rem;
  opacity: 0.8;
  margin: 8px 0 0;
}

.constellation-panel,
.summary-panel {
  text-align: center;
}

.constellation-panel h2,
.summary-panel h2 {
  font-size: 1.1rem;
}

.summary-stars {
  font-size: 1.4rem;
  color: var(--brass);
  font-weight: 700;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.promo-only {
  display: none;
}

[data-capture="1"] .capture-hide,
[data-promo-shot="1"] .promo-hide {
  display: none !important;
}

html[data-capture="1"] .promo-only {
  display: none !important;
}

html[data-promo-shot="1"] .promo-only {
  display: block;
}

/* promo=shot: タイトル表示＋844を密度まで埋める */
html[data-promo-shot="1"],
html[data-promo-shot="1"] body {
  height: 844px;
  max-height: 844px;
  overflow: hidden;
}

html[data-promo-shot="1"] .music-app {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 844px;
  max-height: 844px;
  min-height: 844px;
  padding: 6px 12px 8px;
  max-width: 390px;
}

html[data-promo-shot="1"] .hero {
  flex-shrink: 0;
  text-align: center;
  margin: 0 0 4px;
  padding: 2px 4px 0;
}

html[data-promo-shot="1"] .promo-title {
  font-size: 1rem;
  line-height: 1.25;
  margin: 0 0 2px;
}

html[data-promo-shot="1"] .promo-title span {
  display: block;
  font-size: 0.9rem;
  color: var(--mint);
}

html[data-promo-shot="1"] .promo-catch {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.92;
}

html[data-promo-shot="1"] .compose-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

html[data-promo-shot="1"] .request-card {
  padding: 6px 10px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

html[data-promo-shot="1"] .request-card h2 {
  font-size: 0.88rem;
  margin-bottom: 2px;
}

html[data-promo-shot="1"] .request-hint {
  font-size: 0.72rem;
  line-height: 1.28;
}

html[data-promo-shot="1"] .status-line {
  margin-top: 4px;
  font-size: 0.82rem;
}

html[data-promo-shot="1"] .stage {
  margin-bottom: 4px;
  flex-shrink: 0;
}

html[data-promo-shot="1"] #sky-canvas {
  height: 148px;
  width: 100%;
  object-fit: cover;
}

html[data-promo-shot="1"] .stage .burapi {
  display: none;
}

html[data-promo-shot="1"] .pitch-grid {
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

html[data-promo-shot="1"] .pitch-btn {
  min-height: 58px;
  padding: 2px 4px;
}

html[data-promo-shot="1"] .pitch-name {
  font-size: 0.86rem;
}

html[data-promo-shot="1"] .tool-row {
  gap: 6px;
  padding-bottom: 0;
  flex-shrink: 0;
}

html[data-promo-shot="1"] .btn-tool {
  padding: 7px 8px;
  font-size: 0.84rem;
}

html[data-promo-shot="1"] .promo-lower {
  position: relative;
  flex: 1 1 auto;
  min-height: 228px;
  margin-top: 6px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 95, 0.4);
  background: linear-gradient(180deg, #152238 0%, #1c2f48 55%, #243b55 100%);
}

html[data-promo-shot="1"] #promo-deck-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 228px;
}

html[data-promo-shot="1"] .promo-lower-copy {
  position: absolute;
  left: 10px;
  right: 108px;
  bottom: 10px;
  pointer-events: none;
}

html[data-promo-shot="1"] .promo-tip {
  margin: 0 0 4px;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--cream);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

html[data-promo-shot="1"] .promo-progress {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mint);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

html[data-promo-shot="1"] .promo-burapi {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 88px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
}

/* capture=1: 844内に音札・tool-row・失敗理由を常時収める */
html[data-capture="1"],
html[data-capture="1"] body {
  height: 844px;
  max-height: 844px;
  overflow: hidden;
}

html[data-capture="1"] .music-app {
  padding: 4px 12px 12px;
  max-width: 390px;
  max-height: 844px;
  box-sizing: border-box;
}

html[data-capture="1"] .hero {
  display: none;
}

html[data-capture="1"] .compose-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 836px;
}

html[data-capture="1"] .request-card {
  padding: 8px 10px 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

html[data-capture="1"] .request-card h2 {
  font-size: 0.92rem;
  margin-bottom: 2px;
}

html[data-capture="1"] .request-hint {
  display: none;
}

html[data-capture="1"] .status-line {
  margin-top: 4px;
  font-size: 0.84rem;
  line-height: 1.35;
}

html[data-capture="1"] .reason-list {
  max-height: 2.5em;
  overflow: hidden;
  margin: 4px 0 0;
  padding-left: 1rem;
  font-size: 0.72rem;
  line-height: 1.25;
}

html[data-capture="1"] .stage {
  margin-bottom: 6px;
  flex-shrink: 0;
}

html[data-capture="1"] #sky-canvas {
  height: 172px;
  width: 100%;
  object-fit: cover;
}

html[data-capture="1"] .burapi {
  width: 50px;
  bottom: 0;
}

html[data-capture="1"] .pitch-grid {
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

html[data-capture="1"] .pitch-btn {
  min-height: 64px;
  padding: 4px 6px;
}

html[data-capture="1"] .tool-row {
  gap: 6px;
  padding-bottom: 4px;
  margin-top: auto;
  flex-shrink: 0;
}

html[data-capture="1"] .btn-tool {
  padding: 9px 10px;
  font-size: 0.88rem;
}

@media (min-width: 720px) {
  .music-app {
    max-width: 480px;
  }
  .pitch-btn {
    min-height: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pitch-btn:active {
    transform: none;
  }
}
