body {
  padding-bottom: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px));
}

.dock-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dock-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 290;
  background: rgba(0, 0, 0, 0.45);
}

.dock-settings-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.bottom-dock {
  container-type: inline-size;
  container-name: dock;
  --dock-item-count: 7;
  --dock-item-slot: 5.25rem;
  --dock-width-max: min(calc(100% - 1.5rem), calc(var(--dock-item-count) * var(--dock-item-slot)));
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 100%;
  bottom: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: rgba(20, 24, 34, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 768px) {
  .bottom-dock {
    /* inline-size のまま width:auto だと中身幅が無視されて 0 になる */
    container-type: normal;
    width: var(--dock-width-max);
    max-width: var(--dock-width-max);
    bottom: clamp(0.35rem, 2vw, 0.85rem);
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .bottom-dock__nav {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(20, 24, 34, 0.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    width: 100%;
  }

  body {
    padding-bottom: calc(
      var(--dock-height) + clamp(0.5rem, 2vw, 1.5rem) + env(safe-area-inset-bottom, 0px)
    );
  }
}

@media (min-width: 480px) and (max-width: 767.98px) {
  .bottom-dock {
    bottom: clamp(0.35rem, 2vw, 0.85rem);
    width: min(calc(100% - clamp(0.75rem, 4vw, 1.5rem)), 560px);
    max-width: min(calc(100% - clamp(0.75rem, 4vw, 1.5rem)), 560px);
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .bottom-dock__nav {
    border: 1px solid var(--border);
    border-radius: clamp(10px, 2.5vw, 16px);
    overflow: hidden;
    background: rgba(20, 24, 34, 0.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  }

  body {
    padding-bottom: calc(
      var(--dock-height) + clamp(0.5rem, 2vw, 1.5rem) + env(safe-area-inset-bottom, 0px)
    );
  }
}

.dock-settings-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  z-index: 2;
  max-height: min(70vh, 22rem);
  overflow: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

@media (min-width: 480px) {
  .dock-settings-panel {
    bottom: calc(100% + clamp(0.35rem, 1.5vw, 0.5rem));
    border: 1px solid var(--border);
    border-radius: clamp(10px, 2.5vw, 16px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  }
}

.dock-settings-panel[hidden] {
  display: none;
}

.dock-settings-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.dock-settings-panel__title {
  margin: 0;
  font-size: clamp(0.85rem, 2.5vw, 0.92rem);
  font-weight: 700;
}

.dock-settings__close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.dock-settings__close:hover,
.dock-settings__close:focus-visible {
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

.dock-settings-panel__body {
  padding: 0.75rem clamp(0.5rem, 2vw, 0.65rem) 1rem;
}

.dock-settings-panel__empty {
  margin: 0;
  padding: 0.75rem 0.5rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-muted);
  text-align: center;
}

.dock-settings-panel__summary {
  margin: 0 0 0.75rem;
  padding: 0 0.35rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.dock-settings-panel__summary[hidden],
.dock-settings-panel__empty[hidden],
.dock-settings-panel__group[hidden] {
  display: none;
}

.dock-settings-panel__group + .dock-settings-panel__group {
  margin-top: 0.85rem;
}

.dock-settings-panel__hint {
  margin: 0.35rem 0 0;
  padding-left: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.dock-settings-panel__plan-link {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.dock-settings-panel__plan-link a {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.dock-settings-panel__plan-link a:hover {
  text-decoration: underline;
}

@container dock (min-width: 361px) {
  .dock-settings-panel__hint {

    padding-left: calc(2.75rem + clamp(0.25rem, 1.5vw, 0.35rem));
  }
}

.dock-settings-panel__row {
  display: grid;
  grid-template-columns: minmax(2.75rem, auto) minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.25rem, 1.5vw, 0.35rem);
}

.dock-settings-panel__row[hidden] {
  display: none !important;
}

.dock-settings-panel__row--toggle {
  align-items: center;
}

.dock-settings-panel__label {
  font-size: clamp(0.6rem, 2vw, 0.68rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

@container dock (max-width: 360px) {
  .dock-settings-panel__row {
    grid-template-columns: 1fr;
  }

  .dock-settings-panel__label {
    text-align: left;
  }
}

.bottom-dock__strip {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.3rem, 1.5vw, 0.45rem);
  padding: 0.25rem 0;
}

.dock-pill {
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.dock-pill--key {
  width: var(--pill-key-size);
  height: var(--pill-key-size);
  border-radius: 50%;
  font-size: clamp(0.68rem, 2.5vw, 0.82rem);
}

.dock-pill--key.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 158, 255, 0.15);
  transform: scale(1.06);
}

.dock-pill--capo {
  min-width: clamp(1.85rem, 6vw, 2.35rem);
  height: clamp(1.55rem, 5vw, 1.85rem);
  padding: 0 clamp(0.35rem, 2vw, 0.55rem);
  border-radius: 999px;
  font-size: clamp(0.62rem, 2.2vw, 0.72rem);
}

.dock-pill--capo.is-active {
  border-color: #f0a050;
  background: rgba(240, 160, 80, 0.15);
  color: #f0a050;
  transform: scale(1.04);
}

.dock-pill:hover {
  border-color: rgba(108, 158, 255, 0.45);
  color: var(--text);
}

.dock-toggle {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  width: fit-content;
  max-width: 100%;
}

.dock-toggle__btn {
  min-width: clamp(2.5rem, 18vw, 3.25rem);
  padding: 0.35rem clamp(0.45rem, 3vw, 0.65rem);
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: clamp(0.7rem, 2.5vw, 0.78rem);
  font-weight: 600;
  cursor: pointer;
}

.dock-toggle__btn.is-active {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.bottom-dock__nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
  min-height: var(--dock-nav-height);
}

.bottom-dock__nav-link,
.bottom-dock__settings-btn {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.08rem, 0.8vw, 0.2rem);
  min-width: 0;
  padding: clamp(0.25rem, 1.5vw, 0.45rem) 0.1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--dock-label-size);
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.bottom-dock__nav-link:hover,
.bottom-dock__settings-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.bottom-dock__nav-link.is-active,
.bottom-dock__nav-link.is-open,
.bottom-dock__settings-btn.is-active,
.bottom-dock__settings-btn.is-open {
  color: var(--accent);
}

.bottom-dock__nav-link.is-active::before,
.bottom-dock__nav-link.is-open::before,
.bottom-dock__settings-btn.is-active::before,
.bottom-dock__settings-btn.is-open::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1.6rem;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
}

.bottom-dock__nav-icon {
  display: grid;
  place-items: center;
  line-height: 0;
  flex-shrink: 0;
}

.bottom-dock__nav-icon svg {
  width: var(--dock-icon-size);
  height: var(--dock-icon-size);
}

.bottom-dock__nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.bottom-dock__nav-label--short {
  display: none;
}

@container dock (max-width: 400px) {
  .bottom-dock__nav-label--long {
    display: none;
  }

  .bottom-dock__nav-label--short {
    display: inline;
  }
}

@media (min-width: 768px) {
  .bottom-dock__nav-link,
  .bottom-dock__settings-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.75rem;
  }

  .bottom-dock__nav-icon svg {
    width: 1.2rem;
    height: 1.2rem;
  }

  .bottom-dock__nav-label {
    overflow: visible;
    text-overflow: clip;
  }
}

.bottom-dock__nav-link.is-active .bottom-dock__nav-icon {
  transform: scale(1.05);
}


.dock-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dock-menu__item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.dock-menu__item:hover {
  border-color: var(--accent);
  background: rgba(108, 158, 255, 0.08);
}

.dock-menu__item.is-current {
  border-color: var(--accent);
  color: var(--accent);
}

.dock-menu__label {
  font-size: 0.88rem;
  font-weight: 700;
}

.dock-menu__desc {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.site-footer {
  padding-bottom: calc(1.25rem + var(--dock-height) * 0.15);
}
