.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.site-header.has-bottom-space {
  margin-bottom: 10px;
}

.site-header-left,
.site-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.site-brand-wrap {
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  line-height: 1;
}

.site-home-link {
  display: grid;
  grid-template-columns: 26px minmax(0, auto);
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.site-logo {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.site-title {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-title-main {
  display: inline-block;
}

.site-title-suffix {
  display: inline-flex;
  align-items: center;
  height: 26px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.back-button,
.theme-toggle,
.menu-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

.back-button {
  border-radius: 8px;
  font-size: 22px;
  font-weight: 900;
}

.theme-toggle,
.menu-button {
  border-radius: 8px;
}

.site-menu {
  position: relative;
  flex: 0 0 auto;
}

.menu-lines {
  display: grid;
  gap: 3px;
  width: 18px;
}

.menu-lines span {
  display: block;
  height: 3px;
  background: var(--line);
}

body.theme-dark .menu-lines span {
  background: var(--ink);
}

.menu-panel {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 20;
  width: min(292px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

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

.menu-link {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}

.menu-link:hover,
.menu-link:active {
  background: var(--accent);
}

.menu-link.is-disabled {
  cursor: default;
  opacity: 0.68;
}

.menu-link.is-disabled:hover,
.menu-link.is-disabled:active {
  background: var(--chip);
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
}

.menu-copy {
  display: grid;
  align-content: center;
  min-width: 0;
}

.menu-name {
  display: block;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.menu-desc {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

body.theme-dark .back-button,
body.theme-dark .theme-toggle,
body.theme-dark .menu-button,
body.theme-dark .menu-panel {
  background: #222;
  color: var(--ink);
}

body.theme-dark .menu-panel {
  border-color: #5f61d8;
  background: #101729;
}

body.theme-dark .menu-link:hover,
body.theme-dark .menu-link:active {
  background: #242b45;
}

body.theme-dark .menu-link.is-disabled:hover,
body.theme-dark .menu-link.is-disabled:active {
  background: #1a2135;
}

.loading-box {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 150px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.loading-mark {
  position: relative;
  width: 38px;
  height: 38px;
  border: 3px solid var(--soft-line);
  border-top-color: var(--red);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: pachi-spin 0.78s linear infinite;
}

.loading-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.86;
}

@keyframes pachi-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-mark {
    animation: none;
  }
}
