:root {
  color-scheme: dark;
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  background: #100017;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  display: grid;
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  place-items: center;
  color: #fff;
  background: #100017;
}

button { font: inherit; }

.integrated-app {
  position: relative;
  width: min(100%, 540px);
  height: 100svh;
  min-height: 540px;
  overflow: hidden;
  isolation: isolate;
  background: #190024 url("../images/background.png") center / cover no-repeat;
}

/* iOS Safari: タイトル画面の長押しで選択・画像メニューを出さない。 */
.integrated-app, .integrated-app * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.integrated-app img {
  -webkit-user-drag: none;
  user-drag: none;
}

.integrated-app::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(18, 0, 35, .35), rgba(4, 0, 16, .5));
  content: "";
}

.sound-notice {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.4rem;
  padding: 2rem;
  text-align: center;
  background: rgba(17, 0, 32, .94);
}

.sound-notice p {
  margin: 0;
  color: #f6efff;
  font-size: clamp(1.08rem, 5.3vw, 1.4rem);
  font-weight: 800;
  line-height: 1.8;
}

.sound-notice button {
  min-width: 5.2rem;
  padding: .55rem 1rem;
  border: 1px solid rgba(130, 252, 255, .55);
  border-radius: .45rem;
  color: #eaffff;
  background: rgba(255, 255, 255, .08);
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}

.music-title {
  position: relative;
  display: grid;
  min-height: 100%;
  align-content: center;
  justify-items: center;
  gap: .56rem;
  padding: max(1rem, env(safe-area-inset-top)) 1.1rem max(3.55rem, env(safe-area-inset-bottom));
  text-align: center;
}

.title-prefix {
  margin: 0 -1.6rem -.76rem 0;
  color: #f4e7bc;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(1.15rem, 5.6vw, 1.75rem);
  font-weight: 700;
  letter-spacing: .1em;
  text-shadow: 0 1px 10px rgba(255, 224, 149, .35);
}

.title-logo {
  display: block;
  width: min(90vw, 460px);
  height: auto;
  max-height: 30svh;
  object-fit: contain;
}

.start-copy {
  margin: .12rem 0;
  color: #f5eaff;
  font-size: clamp(.76rem, 3.5vw, .95rem);
  font-weight: 700;
  line-height: 1.6;
}

.start-button {
  min-width: 200px;
  padding: .78rem 1.5rem;
  border: 2px solid #fff;
  border-radius: 99px;
  color: #22001d;
  background: #fff000;
  box-shadow: 0 0 24px rgba(255, 243, 0, .7);
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: .1em;
  cursor: pointer;
}

.start-button:disabled { cursor: not-allowed; opacity: .38; box-shadow: none; }

.high-score {
  display: grid;
  gap: .1rem;
  margin: -.1rem 0 0;
  color: #c9faff;
  font: 800 .66rem ui-monospace, monospace;
  letter-spacing: .12em;
}

.high-score strong {
  color: #fff300;
  font-size: 1.22rem;
  letter-spacing: .04em;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.song-selector {
  position: relative;
  width: min(100%, 294px);
  height: 64px;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 2rem;
  align-items: center;
  gap: 0;
  justify-self: center;
  margin: .04rem 0 0;
  padding: .22rem .08rem 1.05rem;
  border: 1px solid rgba(130, 252, 255, .42);
  border-radius: .62rem;
  background: rgba(11, 0, 26, .6);
  touch-action: pan-y;
}

.selector-arrow {
  width: 2rem;
  height: 2.45rem;
  border: 0;
  padding: 0;
  color: #9bfaff;
  background: transparent;
  font-size: 1.62rem;
  line-height: 1;
  cursor: pointer;
}

.song-card {
  min-width: 0;
  height: 2.48rem;
  display: grid;
  grid-template-rows: 1.6rem .88rem;
  place-content: center;
  padding: .08rem;
}

.song-card p { margin: 0; }

.song-card #song-select-label {
  display: grid;
  place-items: center;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(.7rem, 3.1vw, .84rem);
  font-weight: 600;
  line-height: 1.23;
}

.song-card.is-placeholder #song-select-label {
  color: #cbbfd3;
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .12em;
}

.song-difficulty {
  min-height: .88rem;
  margin-top: .13rem !important;
  color: #fff000;
  font-size: .76rem;
  letter-spacing: .1em;
  text-shadow: 0 0 7px rgba(255, 240, 0, .36);
}

.song-indicator {
  position: absolute;
  right: 0;
  bottom: .3rem;
  left: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .32rem;
  height: 3px;
}

.indicator-bar {
  width: 22px;
  height: 3px;
  border-radius: 99px;
  background: rgba(119, 119, 130, .5);
}

.indicator-bar.is-active { background: #9bfaff; }

.title-footer {
  position: absolute;
  right: 1rem;
  bottom: max(.8rem, env(safe-area-inset-bottom));
  left: 1rem;
  display: grid;
  justify-items: center;
  gap: .2rem;
  color: rgba(222, 243, 255, .72);
  font-size: .57rem;
  letter-spacing: .025em;
  line-height: 1.45;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}

.title-footer p { margin: 0; }

.title-footer button {
  border: 0;
  padding: .16rem .35rem;
  color: #8cfcff;
  background: transparent;
  font: inherit;
  font-weight: 800;
  letter-spacing: .11em;
  text-decoration: underline;
  text-underline-offset: .26em;
  cursor: pointer;
}

.credits-dialog {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.3rem;
  background: rgba(4, 0, 12, .78);
}

.credits-card {
  position: relative;
  width: min(100%, 335px);
  padding: 1.25rem;
  border: 1px solid rgba(130, 252, 255, .68);
  border-radius: .85rem;
  background: linear-gradient(135deg, #1b002c, #0c001d);
  box-shadow: 0 0 22px rgba(255, 50, 192, .18);
}

.credits-card h2 { margin: 0 0 .85rem; text-align: center; font-size: 1rem; letter-spacing: .12em; }
.credits-card button { position: absolute; top: .35rem; right: .45rem; border: 0; color: #b9faff; background: transparent; font-size: 1.4rem; cursor: pointer; }
.credits-card dl { display: grid; gap: .6rem; margin: 0; }
.credits-card dl div { display: grid; gap: .08rem; }
.credits-card dt { color: #91f7ff; font-size: .64rem; font-weight: 800; }
.credits-card dd { margin: 0; color: #fff5ce; font-size: .8rem; font-weight: 700; }

.high-score-reset-dialog {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.3rem;
  background: rgba(4, 0, 12, .78);
}

.high-score-reset-card {
  width: min(100%, 310px);
  padding: 1.2rem;
  border: 1px solid rgba(130, 252, 255, .68);
  border-radius: .85rem;
  background: linear-gradient(135deg, #1b002c, #0c001d);
  box-shadow: 0 0 22px rgba(255, 50, 192, .18);
}

.high-score-reset-card p { margin: 0 0 1rem; color: #fff5ce; text-align: center; font-size: .93rem; font-weight: 800; }
.high-score-reset-actions { display: flex; justify-content: center; gap: .65rem; }
.high-score-reset-actions button { min-width: 6.4rem; padding: .55rem .75rem; border-radius: .45rem; font-size: .8rem; font-weight: 800; cursor: pointer; }
.high-score-reset-actions .secondary-button { border: 1px solid rgba(130, 252, 255, .52); color: #d9feff; background: rgba(255, 255, 255, .08); }
.reset-button { border: 1px solid rgba(255, 119, 177, .75); color: #fff; background: rgba(180, 20, 97, .58); }

.integrated-app > iframe {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #110018;
}

@media (min-width: 700px) {
  .integrated-app {
    height: min(100svh, 900px);
    margin-top: 0;
    border-radius: 18px;
    box-shadow: 0 0 60px #000;
  }
}

@media (max-width: 699px) {
  .music-title { padding-inline: 0; }
  .title-prefix { margin-right: 0; }
  .title-logo { width: 100vw; max-height: 29.5svh; }
  .start-copy { padding-inline: 1.1rem; }
  .song-selector { transform: none; }
}

@media (max-height: 700px) {
  .music-title { gap: .42rem; padding-top: max(.8rem, env(safe-area-inset-top)); }
  .title-logo { max-height: 28svh; }
  .start-copy { line-height: 1.45; }
}
