:root {
  --button-fill: rgba(242, 242, 242, 0.055);
  --button-fill-hover: rgba(242, 242, 242, 0.1);
  --button-line: rgba(242, 242, 242, 0.16);
  --button-line-hover: rgba(242, 242, 242, 0.3);
  --button-specular: rgba(242, 242, 242, 0.13);
  --button-specular-hover: rgba(242, 242, 242, 0.22);
  --button-lit-fill: rgba(242, 242, 242, 0.15);
  --button-lit-fill-hover: rgba(242, 242, 242, 0.21);
  --button-lit-line: rgba(242, 242, 242, 0.42);
  --button-lit-line-hover: rgba(242, 242, 242, 0.58);
  --button-danger: #f08a80;
  --button-danger-fill: rgba(229, 100, 90, 0.08);
  --button-danger-fill-hover: rgba(229, 100, 90, 0.15);
  --button-danger-line: rgba(229, 100, 90, 0.3);
  --button-danger-line-hover: rgba(229, 100, 90, 0.52);
  --button-depth: 0 -10px 18px -14px rgba(0, 0, 0, 0.7) inset;
  --button-drop: 0 10px 22px -16px rgba(0, 0, 0, 0.9);
  --button-drop-hover: 0 14px 28px -16px rgba(0, 0, 0, 0.95);
}

.button {
  display: inline-flex;
  height: var(--control-height);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--button-line);
  border-radius: var(--radius-control);
  background: var(--button-fill);
  box-shadow:
    0 1px 0 var(--button-specular) inset,
    var(--button-depth),
    var(--button-drop);
  color: var(--ink);
  cursor: pointer;
  font: 600 13px / 1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition:
    transform var(--micro) var(--spring),
    border-color var(--ui) var(--out),
    background-color var(--ui) var(--out),
    box-shadow var(--ui) var(--out),
    color var(--ui) var(--out);
}

.button:active {
  transform: scale(0.97);
}

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

.button.primary {
  border-color: var(--button-lit-line);
  background: var(--button-lit-fill);
}

.button.danger {
  border-color: var(--button-danger-line);
  background: var(--button-danger-fill);
  color: var(--button-danger);
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink-2);
}

.button .icon {
  width: 15px;
  height: 15px;
  flex: none;
  margin-left: -2px;
}

.button.small {
  height: 28px;
  gap: 6px;
  padding: 0 10px;
  border-radius: var(--radius-chip);
  font-size: var(--text-label);
}

.button.small .icon {
  width: 13px;
  height: 13px;
}

.button.icon {
  width: var(--control-height);
  padding: 0;
  font-size: 16px;
  font-weight: 400;
}

.signout-popover {
  width: min(320px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  background: var(--raised);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  color: var(--ink);
  font: var(--text-body) / 1.5 var(--sans);
}

.signout-popover::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

.signout-popover p {
  margin: 0 0 18px;
  font-weight: 600;
}

.signout-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.signout-actions form {
  margin: 0;
}

.button-arrow {
  width: 14px;
  height: 14px;
  margin-right: -2px;
  transition: transform var(--ui) var(--out);
}

@media (hover: hover) {
  .button:hover {
    border-color: var(--button-line-hover);
    background: var(--button-fill-hover);
    box-shadow:
      0 1px 0 var(--button-specular-hover) inset,
      var(--button-depth),
      var(--button-drop-hover);
  }

  .button.primary:hover {
    border-color: var(--button-lit-line-hover);
    background: var(--button-lit-fill-hover);
  }

  .button.danger:hover {
    border-color: var(--button-danger-line-hover);
    background: var(--button-danger-fill-hover);
  }

  .button.quiet:hover {
    border-color: transparent;
    background: var(--button-fill);
    box-shadow: none;
    color: var(--ink);
  }

  .button:hover .button-arrow {
    transform: translateX(2px);
  }
}

input[type="file"]::file-selector-button {
  height: var(--control-height);
  margin-right: 10px;
  padding: 0 13px;
  border: 1px solid var(--button-line);
  border-radius: var(--radius-control);
  background: var(--button-fill);
  box-shadow: 0 1px 0 var(--button-specular) inset;
  color: var(--ink);
  cursor: pointer;
  font: 600 13px var(--sans);
  transition:
    border-color var(--ui) var(--out),
    background-color var(--ui) var(--out);
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--button-line-hover);
  background: var(--button-fill-hover);
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .button-arrow {
    transition:
      border-color var(--ui) var(--out),
      background-color var(--ui) var(--out),
      color var(--ui) var(--out);
  }

  .button:active {
    transform: none;
  }
}
