:root {
  --header-background-color: #fbfbfb;
  --header-background-color-hover: #f0f0f0;
  --header-subbar-bg: #f2f3f5;
  --header-subbar-hover: #e5e7eb;
  --header-subbar-h: 30px;
  --header-border-radius: 8px;
  --header-border-color: #1d1d1d;
  --header-color-border-color-top: #dfe0e1;
}

body {
  padding-top: 50px;
}

@media (min-height: 560px) {
  body {
    padding-top: calc(50px + var(--header-subbar-h));
  }
}

main.left {
  justify-content: left;
}

main.center {
  /* space-aroundでは基本はcenterと同じで、はみ出る場合に左揃えになる */
  justify-content: space-around;
}

main.right {
  justify-content: right;
}

main.fit {
  justify-content: center !important;
}

header {
  color: #141414;
  position: fixed;
  display: flex;
  flex-direction: column;
  border-bottom: 0.5px solid var(--header-border-color);
  background: var(--header-background-color);
  margin-bottom: 10px;
  box-sizing: border-box;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 40px;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
}

.header-subbar {
  display: none;
  position: relative;
  align-items: center;
  height: var(--header-subbar-h);
  background: var(--header-subbar-bg);
  border-top: 0.5px solid var(--header-subbar-border-color-top);
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

@media (min-height: 560px) {
  .header-subbar {
    display: flex;
  }
}

.subbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  padding: 0 24px;
  margin: 0 auto; /* 中央揃え */
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-sizing: border-box;
}

.subbar-links::-webkit-scrollbar {
  display: none;
}

.subbar-link {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #4b5563;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.subbar-link:hover {
  background: var(--header-subbar-hover);
  color: #111827;
}

.subbar-link.current {
  font-weight: 600;
  color: #111827;
  background: rgba(0, 0, 0, 0.06);
}

.subbar-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.subbar-btn:hover {
  background: var(--header-subbar-hover) !important;
}

.subbar-btn.left {
  left: 0;
  background: linear-gradient(to right, var(--header-subbar-bg) 65%, transparent);
}

.subbar-btn.right {
  right: 0;
  background: linear-gradient(to left, var(--header-subbar-bg) 65%, transparent);
}

.subbar-btn:hover {
  color: #111;
}

.subbar-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.subbar-btn svg {
  width: 14px;
  height: 14px;
}

.header-dropdown-wrapper {
  display: flex;
}

.header-scalingbtn,
.header-alignbtn {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: fit-content;
  height: fit-content;
  background: transparent;
}

header .pressed {
  outline: inset 1px #eee;
  outline-offset: -4px;
  border-radius: var(--header-border-radius);
}

.header-alignbtn .icon-btn:not(.active) {
  display: none;
}

header .icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  border-radius: var(--header-border-radius);
  cursor: pointer;
}

header .icon-btn:hover {
  background: var(--header-background-color-hover);
}

header .icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.header-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  flex: 1;
  text-align: center;
  overflow: hidden;
}

header .dropdown {
  position: absolute;
  top: 40px;
  left: 0px;
  background: var(--header-background-color);
  border: 0.5px solid;
  border-color: var(--header-color-border-color-top) var(--header-border-color) var(--header-border-color) var(--header-border-color);
  border-left: 0;
  border-radius: 0 0 var(--header-border-radius) 0;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  min-width: 180px;
  box-shadow: none;
}

header .dropdown.open {
  display: flex
}

header .dropdown a {
  font-size: 13px;
  text-decoration: none;
  padding: 7px 10px;
  border-radius: var(--header-border-radius);
  transition: background 0.12s;
}

.dropdown a:hover {
  background: var(--header-background-color-hover);
}
